瀏覽代碼

Moved pdf sections templates to pagesetup.
Making that only packages installation sect1 begin on a new page.

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/new-xsl@8032 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

Manuel Canales Esparcia 18 年之前
父節點
當前提交
133160de04
共有 4 個文件被更改,包括 38 次插入45 次删除
  1. 1 1
      lfs-common.xsl
  2. 0 1
      lfs-pdf.xsl
  3. 37 1
      pdf/lfs-pagesetup.xsl
  4. 0 42
      pdf/lfs-sections.xsl

+ 1 - 1
lfs-common.xsl

@@ -91,7 +91,7 @@
   </xsl:template>
 
     <!-- sect2 label.markup:
-           Skip numeration for sect2 with empty title -->
+           Skip numeration for sect2 with empty title. -->
     <!-- The original template is in {docbook-xsl}/common/labels.xsl
          It match also sect3, sect4, and sect5, that are unchanged. -->
   <xsl:template match="sect2" mode="label.markup">

+ 0 - 1
lfs-pdf.xsl

@@ -24,7 +24,6 @@
   <xsl:include href="pdf/lfs-index.xsl"/>
   <xsl:include href="pdf/lfs-mixed.xsl"/>
   <xsl:include href="pdf/lfs-pagesetup.xsl"/>
-  <xsl:include href="pdf/lfs-sections.xsl"/>
   <xsl:include href="pdf/lfs-xref.xsl"/>
 
     <!-- Activating FOP-1 extensions. We use FOP-0.93 as the FO procesor. -->

+ 37 - 1
pdf/lfs-pagesetup.xsl

@@ -4,7 +4,8 @@
                 xmlns:fo="http://www.w3.org/1999/XSL/Format"
                 version="1.0">
 
-  <!-- This stylesheet controls page margins, header content and titles size. -->
+  <!-- This stylesheet controls page margins, sections page break,
+       header content and titles size. -->
 
     <!-- The inner page margin. -->
   <xsl:param name="page.margin.inner" select="'0.5in'"/>
@@ -46,6 +47,22 @@
          Be sure that no uneeded fo:marker are generated. -->
   <xsl:param name="marker.section.level" select="-1"></xsl:param>
 
+     <!-- Force sect1 onto a new page -->
+  <xsl:attribute-set name="section.level1.properties">
+    <xsl:attribute name="break-before">
+      <xsl:choose>
+        <!--<xsl:when test="not(. = //*/sect1[1])">
+          <xsl:text>page</xsl:text>
+        </xsl:when>-->
+        <xsl:when test="preceding-sibling::sect1[position()=1]/sect2/@role='package'
+                        or self::sect1/sect2/@role='package'">page</xsl:when>
+        <xsl:otherwise>
+          <xsl:text>auto</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:attribute>
+  </xsl:attribute-set>
+
     <!-- book title:
           Centered the title and removed unused code. -->
     <!-- The original template is in {docbook-xsl}/fo/titlepage.templates.xsl -->
@@ -97,6 +114,25 @@
     </fo:block>
   </xsl:template>
 
+    <!-- sect2 title:
+           Skip sect2.titlepage run when title is empty.
+           Removed unused code. -->
+    <!-- The original template is in {docbook-xsl}/fo/sections.xsl -->
+  <xsl:template match="sect2">
+    <xsl:variable name="id">
+      <xsl:call-template name="object.id"/>
+    </xsl:variable>
+    <fo:block xsl:use-attribute-sets="section.level2.properties">
+      <xsl:attribute name="id">
+        <xsl:value-of select="$id"/>
+      </xsl:attribute>
+      <xsl:if test="not(string-length(title)=0)">
+        <xsl:call-template name="sect2.titlepage"/>
+      </xsl:if>
+      <xsl:apply-templates/>
+    </fo:block>
+  </xsl:template>
+
    <!-- header.table:
           Re-made template to not generate a fo:table in the header,
           allowing a more simple header.content custonization. -->

+ 0 - 42
pdf/lfs-sections.xsl

@@ -1,42 +0,0 @@
-<?xml version='1.0' encoding='ISO-8859-1'?>
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns:fo="http://www.w3.org/1999/XSL/Format"
-                version="1.0">
-
-  <!-- This stylesheet controls how sections are handled -->
-
-     <!-- Force sect1 onto a new page -->
-  <xsl:attribute-set name="section.level1.properties">
-    <xsl:attribute name="break-before">
-      <xsl:choose>
-        <xsl:when test="not(. = //*/sect1[1])">
-          <xsl:text>page</xsl:text>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:text>auto</xsl:text>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:attribute>
-  </xsl:attribute-set>
-
-    <!-- sect2:
-           Skip sect2.titlepage run when title is empty.
-           Removed unused code. -->
-    <!-- The original template is in {docbook-xsl}/fo/sections.xsl -->
-  <xsl:template match="sect2">
-    <xsl:variable name="id">
-      <xsl:call-template name="object.id"/>
-    </xsl:variable>
-    <fo:block xsl:use-attribute-sets="section.level2.properties">
-      <xsl:attribute name="id">
-        <xsl:value-of select="$id"/>
-      </xsl:attribute>
-      <xsl:if test="not(string-length(title)=0)">
-        <xsl:call-template name="sect2.titlepage"/>
-      </xsl:if>
-      <xsl:apply-templates/>
-    </fo:block>
-  </xsl:template>
-
-</xsl:stylesheet>