]> granicus.if.org Git - docbook-dsssl/commitdiff
Cleaning up hardcoded values into parameters and fixing Ruby library to pass them...
authorKeith Fahlgren <abdelazer@users.sourceforge.net>
Tue, 16 Jun 2009 03:41:55 +0000 (03:41 +0000)
committerKeith Fahlgren <abdelazer@users.sourceforge.net>
Tue, 16 Jun 2009 03:41:55 +0000 (03:41 +0000)
xsl/epub/bin/lib/docbook.rb
xsl/epub/docbook.xsl

index ef72ef8740489b0d838a9dd78cd62cede8ded2db..39627d0bd803b9389b75646f2d79ee7bd7dc38d2 100755 (executable)
@@ -68,12 +68,12 @@ module DocBook
       callout_limit =   "--stringparam callout.graphics.number.limit #{CALLOUT_LIMIT}"
       callout_ext =     "--stringparam callout.graphics.extension #{CALLOUT_EXT}" 
       html_stylesheet = "--stringparam html.stylesheet #{File.basename(@css_file)}" if @css_file
-      base =            "--stringparam base.dir #{@oebps_dir}/" 
+      base =            "--stringparam base.dir #{OEBPS_DIR}/" 
       unless @embedded_fonts.empty? 
         font =            "--stringparam epub.embedded.font \"#{File.basename(@embedded_fonts.first)}\"" 
       end  
-      meta =            "--stringparam epub.metainf.dir #{@meta_dir}/" 
-      oebps =           "--stringparam epub.oebps.dir #{@oebps_dir}/" 
+      meta =            "--stringparam epub.metainf.dir #{META_DIR}/" 
+      oebps =           "--stringparam epub.oebps.dir #{OEBPS_DIR}/" 
       options = [chunk_quietly, 
                  callout_path, 
                  callout_limit, 
@@ -85,7 +85,7 @@ module DocBook
                  html_stylesheet,
                 ].join(" ")
       # Double-quote stylesheet & file to help Windows cmd.exe
-      db2epub_cmd = "#{XSLT_PROCESSOR} #{options} \"#{@stylesheet}\" \"#{@collapsed_docbook_file}\""
+      db2epub_cmd = "cd #{@output_dir} && #{XSLT_PROCESSOR} #{options} \"#{@stylesheet}\" \"#{@collapsed_docbook_file}\""
       STDERR.puts db2epub_cmd if $DEBUG
       success = system(db2epub_cmd)
       raise "Could not render as .epub to #{output_file} (#{db2epub_cmd})" unless success
index a1e5ba6ab416b7e1e6be6f926c94b764a01731a5..a11f3ebb8d0d63a22acedb4a3ea01eb7e9bec582 100644 (file)
@@ -41,6 +41,7 @@
   <xsl:param name="epub.opf.filename" select="concat($epub.oebps.dir, 'content.opf')"/> 
   <xsl:param name="epub.cover.filename" select="concat($epub.oebps.dir, 'cover', $html.ext)"/> 
   <xsl:param name="epub.cover.id" select="'cover'"/> 
+  <xsl:param name="epub.cover.html" select="'cover.html'" />
   <xsl:param name="epub.cover.image.id" select="'cover-image'"/> 
   <xsl:param name="epub.cover.linear" select="0" />
   <xsl:param name="epub.ncx.toc.id">ncxtoc</xsl:param>
           <xsl:element namespace="urn:oasis:names:tc:opendocument:xmlns:container" name="rootfiles">
             <xsl:element namespace="urn:oasis:names:tc:opendocument:xmlns:container" name="rootfile">
               <xsl:attribute name="full-path">
-                <!-- TODO: Figure out how to get this to work right with generation but also not be hardcoded -->
-                <xsl:value-of select="'OEBPS/content.opf'"/>
+                <xsl:value-of select="$epub.opf.filename" />
               </xsl:attribute>
               <xsl:attribute name="media-type">
                 <xsl:text>application/oebps-package+xml</xsl:text>
           </xsl:when>
           <xsl:otherwise>
             <xsl:value-of select="$order - 0"/>
-            <!-- TODO hrm
-            <xsl:value-of select="$order - 1"/>
-            -->
           </xsl:otherwise>
         </xsl:choose>
       </xsl:attribute>
         <xsl:if test="/*/*[cover or contains(name(.), 'info')]//mediaobject[@role='cover' or ancestor::cover]"> 
           <xsl:element namespace="http://www.idpf.org/2007/opf" name="reference">
             <xsl:attribute name="href">
-              <!-- TODO: Figure out how to get this to work right with generation but also not be hardcoded -->
-              <xsl:value-of select="'cover.html'"/>
+              <xsl:value-of select="$epub.cover.html" />
             </xsl:attribute>
             <xsl:attribute name="type">cover</xsl:attribute>
             <xsl:attribute name="title">Cover</xsl:attribute>
         <xsl:if test="contains($toc.params, 'toc')">
           <xsl:element namespace="http://www.idpf.org/2007/opf" name="reference">
             <xsl:attribute name="href">
-              <!-- TODO: Figure out how to get this to work right with generation but also not be hardcoded -->
               <xsl:call-template name="toc-href">
                 <xsl:with-param name="node" select="/*"/>
               </xsl:call-template>
 
   <xsl:template name="opf.manifest">
     <xsl:element namespace="http://www.idpf.org/2007/opf" name="manifest">
-      <!-- TODO: Figure out how to get this to work right with generation but also not be hardcoded -->
       <xsl:element namespace="http://www.idpf.org/2007/opf" name="item">
         <xsl:attribute name="id"> <xsl:value-of select="$epub.ncx.toc.id"/> </xsl:attribute>
         <xsl:attribute name="media-type">application/x-dtbncx+xml</xsl:attribute>
         <xsl:element namespace="http://www.idpf.org/2007/opf" name="item">
           <xsl:attribute name="id"> <xsl:value-of select="$epub.cover.id"/> </xsl:attribute>
           <xsl:attribute name="href"> 
-            <!-- TODO: Figure out how to get this to work right with generation but also not be hardcoded -->
-            <xsl:value-of select="'cover.html'"/>
+            <xsl:value-of select="$epub.cover.html"/>
           </xsl:attribute>
           <xsl:attribute name="media-type">application/xhtml+xml</xsl:attribute>
         </xsl:element>
                 <xsl:value-of select="$epub.embedded.font"/>
                 <xsl:text>)</xsl:text>
               </xsl:message>
-            </xsl:otherwise>
+            </xsl:otherwise>  
             </xsl:choose>
         </xsl:element>
      </xsl:if>
 
   <!-- TODO: Barf (xsl:message terminate=yes) if you find a graphic with no reasonable format or a mediaobject w/o same? [option to not die?] -->
 
-  <!-- TODO: Remove hardcoding -->
   <!-- wish I had XSLT2 ...-->
   <!-- TODO: priority a hack -->
   <xsl:template match="graphic[not(@format)]|
     </xsl:if>
   </xsl:template>
 
-  <!-- TODO: Remove hardcoding -->
   <!-- Note: Selection of the first interesting imagedata is done in the select -->
   <xsl:template match="graphic[@format = 'GIF' or @format = 'GIF87a' or @format = 'GIF89a' or @format = 'JPEG' or @format = 'JPG' or @format = 'PNG' or @format = 'SVG']|
                        inlinegraphic[@format = 'GIF' or @format = 'GIF87a' or @format = 'GIF89a' or @format = 'JPEG' or @format = 'JPG' or @format = 'PNG' or @format = 'SVG']|
   
   <!-- OVERRIDES xhtml-1_1/chunk-common.xsl   -->
   <!-- make a bibliography always a chunk -->
-  <!-- TODO: Confirm that above isn't a mistake -->
   <xsl:template name="chunk"
                 priority="1">       
     <xsl:param name="node" select="."/>