|
| 1 | +task :install do |
| 2 | +end |
| 3 | + |
| 4 | +desc "Generate HTML output" |
| 5 | +task :publish do |
| 6 | + input = "src/en-US/jquery-fundamentals-book.xml" |
| 7 | + xalan = "scripts/libs/xalan/xalan-j_2_7_1" |
| 8 | + xslthl_jar = "scripts/libs/xslthl/xslthl-2.0.2.jar" |
| 9 | + xsl = "scripts/libs/docbook-xsl/docbook-xsl-1.75.2" |
| 10 | + |
| 11 | + xsl_all_in_one = "xsl/xhtml.xsl" |
| 12 | + output_all_in_one = "release/html/book.html" |
| 13 | + |
| 14 | + xsl_chunked = "xsl/xhtml-chunked.xsl" |
| 15 | + output_chunked = "release/html/index.html" |
| 16 | + |
| 17 | + file "#{xalan}/xalan.jar" do |
| 18 | + raise "Xalan not found. Run rake install" |
| 19 | + end |
| 20 | + |
| 21 | + # Ensure there is a directory for our output |
| 22 | + directory "release/html" |
| 23 | + file "release/html" do |
| 24 | + cp ["imgs", "style/*", "#{xsl}/images"], "release/html" |
| 25 | + end |
| 26 | + |
| 27 | + # Output chunked html |
| 28 | + sh <<-COMMAND |
| 29 | + java \ |
| 30 | + -Djava.endorsed.dirs=#{xalan} \ |
| 31 | + -cp "$xalan/xalan.jar;#{xalan}/xml-apis.jar;#{xalan}/xercesImpl.jar;#{xsl}/extensions/xalan27.jar;#{xslthl_jar}" \ |
| 32 | + -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration \ |
| 33 | + org.apache.xalan.xslt.Process \ |
| 34 | + -in #{input} \ |
| 35 | + -out #{output_chunked} \ |
| 36 | + -xsl #{xsl_chunked} \ |
| 37 | + -param keep.relative.image.uris 0 \ |
| 38 | + -param use.extensions 1 \ |
| 39 | + -param highlight.xslthl.config "file://#{Dir.pwd}/scripts/libs/xslthl/highlighters/xslthl-config.xml" \ |
| 40 | + -param highlight.source 1 |
| 41 | + COMMAND |
| 42 | + |
| 43 | + # Output all-in-one html |
| 44 | + sh <<-COMMAND |
| 45 | + java \ |
| 46 | + -Djava.endorsed.dirs=#{xalan} \ |
| 47 | + -cp "#{xalan}/xalan.jar;#{xalan}/xml-apis.jar;#{xalan}/xercesImpl.jar;#{xsl}/extensions/xalan27.jar;#{xslthl_jar}" \ |
| 48 | + -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration \ |
| 49 | + org.apache.xalan.xslt.Process \ |
| 50 | + -in #{input} \ |
| 51 | + -out #{output_all_in_one} \ |
| 52 | + -xsl #{xsl_all_in_one} \ |
| 53 | + -param keep.relative.image.uris 0 \ |
| 54 | + -param use.extensions 1 \ |
| 55 | + -param highlight.xslthl.config "file://#{Dir.pwd}/scripts/libs/xslthl/highlighters/xslthl-config.xml" \ |
| 56 | + -param highlight.source 1 |
| 57 | + COMMAND |
| 58 | +end |
0 commit comments