bin/guider in guider-0.0.1 vs bin/guider in guider-0.0.2

- old
+ new

@@ -8,23 +8,29 @@ require "fileutils" require "guider/guide" require "guider/config" require "guider/template" require "guider/index" +require "guider/inline_tags" options = { :output => Dir.pwd + "/out", + :link_url => "http://localhost/extjs/", } input_files = OptionParser.new do |opts| opts.banner = "Generates a guide.\n\n" + "Usage: guider <guides.json>\n\n" opts.on("-o", "--output=DIR", "Where to output the guides.") do |dir| options[:output] = dir end + opts.on("--link-url=URL", "Base path for links created by {@link} tags.") do |url| + options[:link_url] = url + end + opts.on("-h", "--help", "Show this help message") do puts opts exit end end.parse! @@ -38,17 +44,21 @@ tpl_dir = File.dirname(File.dirname(__FILE__)) + "/template" Dir[tpl_dir+"/*.{js,css,ico}"].each do |fname| FileUtils.cp(fname, options[:output]) end +# Configure {@link} tags. +inline_tags = Guider::InlineTags.new +inline_tags.link_url = options[:link_url] + # Read the template HTML file tpl = Guider::Template.new(tpl_dir + "/guide.html") # The guides.json file config_file = input_files[0] -guides = Guider::Config.new(config_file, tpl).guides +guides = Guider::Config.new(config_file, tpl, inline_tags).guides guides.each do |guide| guide.write(options[:output]) end @@ -57,9 +67,5 @@ html = index_tpl.apply({ :title => "Guides", :content => "blah", }) - - - -