Sha256: 2e2d238c052cfa575ab0c14d0ef13f56d559dfe344a4b99918f9e64f40b2d3da

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

#! /usr/bin/env ruby
# coding: utf-8

require "optparse"
require "pp"
require "fileutils"
require "madowu"

ENCODING = "UTF-8"
HTML2PDF = "wkhtmltopdf"
HTML2PDF_OPTIONS = "-B 1cm -L 1.5cm -R 1.5cm -T 1.5cm -s A4 --encoding #{ENCODING} "

### option analysis
OPTIONS = {}
op = OptionParser.new
op.banner = [
  "Usage: #{File.basename("#{__FILE__}")} [options] foo.md",
  "      You can see help with '#{File.basename("#{__FILE__}")} --help'.",
].join("\n")
op.on("-c css_file", "--css=file", "Indicate css file"){|v| OPTIONS[:css] = v}
op.on("-o"    , "--outline"    , "Embed outline"){    OPTIONS[:outline] = true}
op.on("-d"    , "--dirmap-side", "Embed sideber of directory map"){OPTIONS[:dirmap] = true}
op.on("-s file"    , "--side", "Read file for sidebar"){|v|OPTIONS[:sidebar] = v}
op.on("-m markdown"    , "--markdown=command", "Indicate Markdown command"){|v| OPTIONS[:markdown] = v}
op.parse!(ARGV)

#pp OPTIONS

unless ARGV.size == 1
  puts op.banner
  exit
end

md_file = ARGV[0]
html_file = md_file.sub(/\.md/, ".html")
hg = Madowu::HtmlGenerator.new(md_file, OPTIONS[:markdown])
File.open(html_file, "w") { |io| io.puts hg.generate(OPTIONS) }

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
madowu-0.0.1 bin/madowu
madowu-0.0.0 bin/madowu