The `html2haml` executable.
Processes the options set by the command-line arguments, and runs the HTML compiler appropriately.
# File lib/haml/exec.rb, line 607
607: def process_result
608: super
609:
610: require 'haml/html'
611:
612: input = @options[:input]
613: output = @options[:output]
614:
615: @module_opts[:erb] ||= input.respond_to?(:path) && input.path =~ /\.(rhtml|erb)$/
616: @module_opts[:erb] &&= @options[:no_erb] != false
617:
618: output.write(::Haml::HTML.new(input, @module_opts).render)
619: rescue ::Haml::Error => e
620: raise "#{e.is_a?(::Haml::SyntaxError) ? "Syntax error" : "Error"} on line " +
621: "#{get_line e}: #{e.message}"
622: rescue LoadError => err
623: handle_load_error(err)
624: end
Tells optparse how to parse the arguments.
@param opts [OptionParser]
# File lib/haml/exec.rb, line 573
573: def set_opts(opts)
574: opts.banner = Usage: html2haml [options] [INPUT] [OUTPUT]Description: Transforms an HTML file into corresponding Haml code.Options:
575:
576: opts.on('-e', '--erb', 'Parse ERb tags.') do
577: @module_opts[:erb] = true
578: end
579:
580: opts.on('--no-erb', "Don't parse ERb tags.") do
581: @options[:no_erb] = true
582: end
583:
584: opts.on('-r', '--rhtml', 'Deprecated; same as --erb.') do
585: @module_opts[:erb] = true
586: end
587:
588: opts.on('--no-rhtml', "Deprecated; same as --no-erb.") do
589: @options[:no_erb] = true
590: end
591:
592: opts.on('-x', '--xhtml', 'Parse the input using the more strict XHTML parser.') do
593: @module_opts[:xhtml] = true
594: end
595:
596: super
597: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.