Sha256: 98291d92d98d295fc5cd13e48fcd4d5dc76f948f367bee46d8a29284b1ecbe9b

Contents?: true

Size: 1.95 KB

Versions: 1

Compression:

Stored size: 1.95 KB

Contents

#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + "/../lib/mizuho")
require 'optparse'
require 'rubygems'
require 'mizuho/generator'

$KCODE = 'UTF-8' if RUBY_VERSION < '1.9'

options = { :topbar => true, :attributes => [] }
parser = OptionParser.new do |opts|
	nl = "\n" + ' ' * 37
	opts.banner = "Usage: mizuho [options] INPUT"
	opts.separator ""
	
	opts.separator "Options:"
	opts.on("-c", "--comments SYSTEM",
	        "Use a commenting system. The only#{nl}" +
	        "supported commenting system right now is#{nl}" +
	        "'juvia'.") do |value|
		if value != 'juvia'
			abort "The only supported commenting system right now is 'juvia'."
		end
		options[:commenting_system] = value
	end
	opts.on("--juvia-url URL", "When using Juvia as the commenting system,#{nl}" +
	        "specify the Juvia base URL here.") do |value|
		options[:juvia_url] = value
	end
	opts.on("--juvia-site-key KEY", "When using Juvia as the commenting system,#{nl}" +
	        "specify the Juvia site key here.") do |value|
		options[:juvia_site_key] = value
	end
	#opts.on("-m", "--multi-page", "Generate one file per chapter.") do |value|
	#	options[:multi_page] = value
	#end
	opts.on("--icons-dir DIR", "Specify the directory in which icons#{nl}" <<
		"should be searched. Defaults to#{nl}" <<
		"'images/icons'.") do |value|
		options[:icons_dir] = value
	end
	opts.on("-a", "--attribute=ATTRIBUTE", "Define or delete document attribute. Uses#{nl}" <<
		"same syntax as asciidoc's '-a' option.") do |value|
		options[:attributes] << value
	end
	opts.on("-o", "--output FILE", String, "Specify the output filename.") do |value|
		options[:output] = value
	end
end
begin
	parser.parse!
rescue OptionParser::ParseError => e
	STDERR.puts e
	STDERR.puts
	STDERR.puts "Please see '--help' for valid options."
	exit 1
end

begin
	if ARGV.empty?
		puts parser
		exit 1
	else
		Mizuho::Generator.new(ARGV[0], options).start
	end
rescue Mizuho::GenerationError
	STDERR.puts "*** ERROR"
	exit 2
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mizuho-0.9.12 bin/mizuho