Commit 3a6f61f3 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Add --title option to compare script.

To allow easier changing of title of the produced HTML file.
parent 007e21c3
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -9,7 +9,10 @@ require "cgi"
require "optparse"
require "jsduck/json_duck"

options = {}
options = {
  :title => "Comparison of Ext 4.0.7 and Ext 4.1.1",
}

input_files = OptionParser.new do |opts|
  opts.banner = "Produces diff of two JSDuck exports.\n\n" +
    "Usage: compare [options] old/classes/ new/classes/ output.html\n\n"
@@ -22,6 +25,11 @@ input_files = OptionParser.new do |opts|
    options[:type] = name
  end

  opts.on("--title=TEXT", "Title for the generated HTML page.",
    "Defaults to: 'Comparison of Ext 4.0.7 and Ext 4.1.1'") do |text|
    options[:title] = text
  end

  opts.on("-h", "--help", "Show this help message") do
    puts opts
    exit
@@ -270,7 +278,7 @@ html << <<-EOHTML
<!DOCTYPE html>
<html>
<head>
<title>#{title}</title>
<title>#{options[:title]}</title>
<style type="text/css">
body { font-family: Georgia, serif; }
li h2 { font-size: medium; font-weight: normal; }
@@ -287,7 +295,7 @@ $(function() {
</script>
</head>
<body>
<h1>#{title}</h1>
<h1>#{options[:title]}</h1>
EOHTML

html << "<ul>"