瀏覽代碼

Revised pdf/lfs-mixed.xsl and related fixes.

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/new-xsl@8017 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Manuel Canales Esparcia 18 年之前
父節點
當前提交
4b186d2c35
共有 5 個文件被更改,包括 97 次插入98 次删除
  1. 7 0
      lfs-pdf.xsl
  2. 5 0
      pdf/lfs-index.xsl
  3. 83 79
      pdf/lfs-mixed.xsl
  4. 0 18
      pdf/lfs-pagesetup.xsl
  5. 2 1
      xhtml/lfs-index.xsl

+ 7 - 0
lfs-pdf.xsl

@@ -10,6 +10,13 @@
          xsltproc, thus pofiling must be done in two steps (see Makefile) -->
   <xsl:import href="docbook-xsl-snapshot/fo/docbook.xsl"/>
 
+    <!-- Uncomment the next for debugging the raw FO code.
+         Note that FOP will complaints about a lot of paragraph overflows
+         due that verbatim output is also indented.
+         Remember to comment the "rm $(BASEDIR)/lfs-pdf.fo" in
+         the Makefile. -->
+  <!--<xsl:output  encoding="UTF-8" indent="yes" />-->
+
     <!-- Including our others customized templates -->
   <xsl:include href="pdf/lfs-admon.xsl"/>
   <xsl:include href="pdf/lfs-index.xsl"/>

+ 5 - 0
pdf/lfs-index.xsl

@@ -131,4 +131,9 @@
     </xsl:if>
   </xsl:template>
 
+    <!-- indexterm:
+           Dropping unneeded fo:wrapper -->
+    <!-- The original template is in {docbook-xsl}/fo/index.xsl -->
+  <xsl:template match="indexterm"/>
+
 </xsl:stylesheet>

+ 83 - 79
pdf/lfs-mixed.xsl

@@ -4,6 +4,8 @@
                 xmlns:fo="http://www.w3.org/1999/XSL/Format"
                 version="1.0">
 
+   <!-- REVISED -->
+
 
   <!-- This stylesheet contains misc params, attribute sets and templates
        for output formating.
@@ -53,7 +55,7 @@
     <!-- para:
            Skip empty "Home page" in packages.xml.
            Allow forced line breaks inside paragraphs emulating literallayout.
-           Removed vertical space in pakages and patches pages. -->
+           Removed vertical space in vaiablelist. -->
     <!-- The original template is in {docbook-xsl}/fo/block.xsl -->
  <xsl:template match="para">
     <xsl:choose>
@@ -64,7 +66,7 @@
           <xsl:apply-templates/>
         </fo:block>
       </xsl:when>
-      <xsl:when test="ancestor::variablelist/@role = 'materials'">
+      <xsl:when test="ancestor::variablelist">
         <fo:block>
           <xsl:attribute name="space-before.optimum">0.1em</xsl:attribute>
           <xsl:attribute name="space-before.minimum">0em</xsl:attribute>
@@ -101,100 +103,65 @@
     </xsl:attribute>
   </xsl:attribute-set>
 
-    <!-- How is rendered by default a variablelist -->
-  <xsl:param name="variablelist.as.blocks" select="1"/>
-  <xsl:param name="variablelist.max.termlength">32</xsl:param>
 
-    <!-- Adding space before segmentedlist -->
-  <xsl:template match="segmentedlist">
-    <!--<xsl:variable name="presentation">
-      <xsl:call-template name="pi-attribute">
-        <xsl:with-param name="pis"
-                        select="processing-instruction('dbfo')"/>
-        <xsl:with-param name="attribute" select="'list-presentation'"/>
-      </xsl:call-template>
-    </xsl:variable>
-    <xsl:choose>
-      <xsl:when test="$presentation = 'table'">
-        <xsl:apply-templates select="." mode="seglist-table"/>
-      </xsl:when>
-      <xsl:when test="$presentation = 'list'">
-        <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em"
-                space-before.maximum="0.8em">
-          <xsl:apply-templates/>
-        </fo:block>
-      </xsl:when>
-      <xsl:when test="$segmentedlist.as.table != 0">
-        <xsl:apply-templates select="." mode="seglist-table"/>
-      </xsl:when>
-      <xsl:otherwise>-->
-        <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em"
-                space-before.maximum="0.8em">
-          <xsl:apply-templates/>
-        </fo:block>
-      <!--</xsl:otherwise>
-    </xsl:choose>-->
-  </xsl:template>
+  <!-- Lists -->
 
-    <!-- Left alingnament for itemizedlist -->
-  <xsl:template match="itemizedlist">
-    <xsl:variable name="id">
-      <xsl:call-template name="object.id"/>
-    </xsl:variable>
-    <xsl:variable name="label-width">
-      <xsl:call-template name="dbfo-attribute">
-        <xsl:with-param name="pis"
-                        select="processing-instruction('dbfo')"/>
-        <xsl:with-param name="attribute" select="'label-width'"/>
-      </xsl:call-template>
-    </xsl:variable>
-    <xsl:if test="title">
-      <xsl:apply-templates select="title" mode="list.title.mode"/>
-    </xsl:if>
-    <!-- Preserve order of PIs and comments -->
-    <xsl:apply-templates
-        select="*[not(self::listitem
-                  or self::title
-                  or self::titleabbrev)]
-                |comment()[not(preceding-sibling::listitem)]
-                |processing-instruction()[not(preceding-sibling::listitem)]"/>
-    <fo:list-block id="{$id}" xsl:use-attribute-sets="list.block.spacing"
-                  provisional-label-separation="0.2em" text-align="left">
-      <xsl:attribute name="provisional-distance-between-starts">
-        <xsl:choose>
-          <xsl:when test="$label-width != ''">
-            <xsl:value-of select="$label-width"/>
-          </xsl:when>
-          <xsl:otherwise>1.5em</xsl:otherwise>
-        </xsl:choose>
-      </xsl:attribute>
-      <xsl:apply-templates
-            select="listitem
-                    |comment()[preceding-sibling::listitem]
-                    |processing-instruction()[preceding-sibling::listitem]"/>
-    </fo:list-block>
-  </xsl:template>
+    <!-- What spacing do you want before and after lists? -->
+  <xsl:attribute-set name="list.block.spacing">
+    <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
+    <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
+    <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
+    <xsl:attribute name="space-after.optimum">0.6em</xsl:attribute>
+    <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
+    <xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
+  </xsl:attribute-set>
+
+    <!-- What spacing do you want between list items? -->
+  <xsl:attribute-set name="list.item.spacing">
+    <xsl:attribute name="space-before.optimum">0.4em</xsl:attribute>
+    <xsl:attribute name="space-before.minimum">0.2em</xsl:attribute>
+    <xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
+  </xsl:attribute-set>
+
+    <!-- Properties that apply to each list-block generated by itemizedlist. -->
+  <xsl:attribute-set name="itemizedlist.properties"
+                     use-attribute-sets="list.block.properties">
+    <xsl:attribute name="text-align">left</xsl:attribute>
+  </xsl:attribute-set>
 
-    <!-- Addibg a bullet, and left alignament, for packages and paches list. -->
+    <!-- Format variablelists lists as blocks? 1 = yes, 0 = no
+           Default variablelist format. We override it when necesary
+           using the list-presentation processing instruction. -->
+  <xsl:param name="variablelist.as.blocks" select="1"/>
+
+    <!-- Specifies the longest term in variablelists.
+         Used when list-presentation = list -->
+  <xsl:param name="variablelist.max.termlength">32</xsl:param>
 
+    <!-- varlistentry mode block:
+           Addibg a bullet, left alignament, and @kepp-*.* attributes
+           for packages and paches list. -->
+    <!-- The original template is in {docbook-xsl}/fo/list.xsl -->
   <xsl:template match="varlistentry" mode="vl.as.blocks">
     <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
     <xsl:choose>
       <xsl:when test="ancestor::variablelist/@role = 'materials'">
         <fo:block id="{$id}" xsl:use-attribute-sets="list.item.spacing"
-            keep-together.within-column="always"
-            keep-with-next.within-column="always" text-align="left">
+                  keep-together.within-column="always"
+                  keep-with-next.within-column="always" text-align="left">
           <xsl:text>&#x2022;   </xsl:text>
           <xsl:apply-templates select="term"/>
         </fo:block>
-        <fo:block margin-left="1.4pc" text-align="left">
+        <fo:block margin-left="1.4pc" text-align="left"
+                  keep-together.within-column="always"
+                  keep-with-previous.within-column="always">
           <xsl:apply-templates select="listitem"/>
         </fo:block>
       </xsl:when>
       <xsl:otherwise>
         <fo:block id="{$id}" xsl:use-attribute-sets="list.item.spacing"
-            keep-together.within-column="always"
-            keep-with-next.within-column="always">
+                  keep-together.within-column="always"
+                  keep-with-next.within-column="always">
           <xsl:apply-templates select="term"/>
         </fo:block>
         <fo:block margin-left="0.25in">
@@ -204,6 +171,43 @@
     </xsl:choose>
   </xsl:template>
 
+    <!-- segmentedlist:
+           Making it an actual FO list to can indent items. -->
+    <!-- The original template is in {docbook-xsl}/fo/list.xsl -->
+  <xsl:template match="segmentedlist">
+    <fo:list-block provisional-distance-between-starts="12em"
+                   provisional-label-separation="1em"
+                   xsl:use-attribute-sets="list.block.spacing">
+      <xsl:apply-templates select="seglistitem/seg"/>
+    </fo:list-block>
+  </xsl:template>
+
+    <!-- seg:
+           Self-made template based on the original seg template
+           found in {docbook-xsl}/fo/list.xsl
+           Making segmentedlist an actual FO list to can indent items. -->
+  <xsl:template match="seglistitem/seg">
+    <xsl:variable name="segnum" select="count(preceding-sibling::seg)+1"/>
+    <xsl:variable name="seglist" select="ancestor::segmentedlist"/>
+    <xsl:variable name="segtitles" select="$seglist/segtitle"/>
+    <fo:list-item xsl:use-attribute-sets="compact.list.item.spacing">
+      <fo:list-item-label end-indent="label-end()" text-align="start">
+        <fo:block>
+          <fo:inline font-weight="bold">
+            <xsl:apply-templates select="$segtitles[$segnum=position()]"
+                                 mode="segtitle-in-seg"/>
+            <xsl:text>:</xsl:text>
+          </fo:inline>
+        </fo:block>
+      </fo:list-item-label>
+      <fo:list-item-body start-indent="body-start()">
+        <fo:block>
+          <xsl:apply-templates/>
+        </fo:block>
+      </fo:list-item-body>
+    </fo:list-item>
+  </xsl:template>
+
 
   <!-- Total packages size calculation -->
 

+ 0 - 18
pdf/lfs-pagesetup.xsl

@@ -80,29 +80,11 @@
   <xsl:param name="page.margin.top" select="'0.375in'"/>
   <xsl:param name="body.start.indent" select="'0.7pc'"/>
   <xsl:param name="title.margin.left">-0.7pc</xsl:param>
-  <xsl:attribute-set name="list.block.spacing">
-    <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
-    <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
-    <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
-    <xsl:attribute name="space-after.optimum">0.6em</xsl:attribute>
-    <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
-    <xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
-  </xsl:attribute-set>
-  <xsl:attribute-set name="list.item.spacing">
-    <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
-    <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
-    <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
-  </xsl:attribute-set>
 
     <!-- Others-->
   <xsl:param name="header.rule" select="0"></xsl:param>
   <xsl:param name="footer.rule" select="0"></xsl:param>
   <xsl:param name="marker.section.level" select="-1"></xsl:param>
-  <xsl:attribute-set name="compact.list.item.spacing">
-    <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
-    <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
-    <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
-  </xsl:attribute-set>
 
     <!-- Dropping a blank page -->
   <xsl:template name="book.titlepage.separator"/>

+ 2 - 1
xhtml/lfs-index.xsl

@@ -260,7 +260,8 @@
     </xsl:choose>
   </xsl:template>
 
-    <!-- Dropping unneeded anchors -->
+    <!-- indexterm:
+           Dropping unneeded anchors -->
     <!-- The original template is in {docbook-xsl}/xhtml/index.xsl -->
   <xsl:template match="indexterm"/>