]> granicus.if.org Git - docbook-dsssl/commitdiff
fix bug #108 indexterm before listitem triggers extra blank line snapshot/2018-10-02-184
authorbobstayton <bobs@sagehill.net>
Mon, 1 Oct 2018 23:07:37 +0000 (16:07 -0700)
committerbobstayton <bobs@sagehill.net>
Tue, 2 Oct 2018 22:31:09 +0000 (15:31 -0700)
xsl/fo/admon.xsl
xsl/fo/glossary.xsl
xsl/fo/lists.xsl
xsl/fo/qandaset.xsl

index f443a9af2297b43e9405cfbdb025e846b4ee4dbc..c581b7bc861749cc4d2e5361047d71f825cbcd7c 100644 (file)
                 </xsl:attribute>
               </fo:external-graphic>
             </fo:block>
+            <!-- include leading indexterms in this part to prevent
+                 extra spacing above first para from its space-before -->
+            <xsl:apply-templates mode="leading.indexterms" 
+                                 select="child::d:indexterm[not(preceding-sibling::*)]"/>
           </fo:list-item-label>
           <fo:list-item-body start-indent="body-start()">
             <xsl:if test="$admon.textlabel != 0 or d:title or d:info/d:title">
@@ -90,7 +94,7 @@
               </fo:block>
             </xsl:if>
             <fo:block xsl:use-attribute-sets="admonition.properties">
-              <xsl:apply-templates/>
+              <xsl:apply-templates select="*[not(self::d:indexterm[not(preceding-sibling::*)])]"/>
             </fo:block>
           </fo:list-item-body>
       </fo:list-item>
index 35cf9de9896431e82589e510f64b58e653590a65..9e4cf32dae8e78c3e4ca83bd622ad71b84828325 100644 (file)
@@ -777,6 +777,10 @@ GlossEntry ::=
         </xsl:choose>
         <xsl:apply-templates select="d:indexterm"/>
       </fo:block>
+      <!-- include leading indexterms in glossdef to prevent
+           extra spacing above first para from its space-before -->
+      <xsl:apply-templates mode="leading.indexterms" 
+                           select="d:glossdef/d:indexterm[not(preceding-sibling::*)]"/>
     </fo:list-item-label>
 
     <fo:list-item-body start-indent="body-start()">
@@ -858,7 +862,8 @@ GlossEntry ::=
 </xsl:template>
 
 <xsl:template match="d:glossentry/d:glossdef" mode="glossary.as.list">
-  <xsl:apply-templates select="*[local-name(.) != 'glossseealso']"/>
+  <xsl:apply-templates select="*[local-name(.) != 'glossseealso' and
+                                 not(self::d:indexterm[not(preceding-sibling::*)])]"/>
   <xsl:if test="d:glossseealso">
     <fo:block>
       <xsl:variable name="template">
index 6cabc2668b6c9f19476ab73675e741a6b3e1d971..53274e9c85cf2d778d574ebfd60c6f02ed3bbce2 100644 (file)
           </xsl:with-param>
         </xsl:call-template>
       </fo:block>
+      <!-- include leading indexterms in this part to prevent
+           extra spacing above first para from its space-before -->
+      <xsl:apply-templates mode="leading.indexterms" 
+                           select="child::d:indexterm[not(preceding-sibling::*)]"/>
     </fo:list-item-label>
     <fo:list-item-body start-indent="body-start()">
       <fo:block>
-        <xsl:apply-templates/>
+        <xsl:apply-templates select="*[not(self::d:indexterm[not(preceding-sibling::*)])]"/>
       </fo:block>
     </fo:list-item-body>
   </xsl:variable>
   </xsl:choose>
 </xsl:template>
 
+<!-- process any <indexterms> appearing before other elements in
+     listitem here to prevent empty block that triggers space-before
+     of the first para in the listitem -->
+<xsl:template match="d:indexterm" mode="leading.indexterms">
+  <xsl:apply-templates select="."/>
+</xsl:template>
+
 <xsl:template name="itemizedlist.label.markup">
   <xsl:param name="itemsymbol" select="'disc'"/>
 
       <fo:block>
         <xsl:apply-templates select="." mode="item-number"/>
       </fo:block>
+      <!-- include leading indexterms in this part to prevent
+           extra spacing above first para from its space-before -->
+      <xsl:apply-templates mode="leading.indexterms" 
+                           select="child::d:indexterm[not(preceding-sibling::*)]"/>
     </fo:list-item-label>
     <fo:list-item-body start-indent="body-start()">
       <fo:block>
-        <xsl:apply-templates/>
+        <xsl:apply-templates select="*[not(self::d:indexterm[not(preceding-sibling::*)])]"/>
       </fo:block>
     </fo:list-item-body>
   </xsl:variable>
       <fo:block xsl:use-attribute-sets="variablelist.term.properties">
         <xsl:apply-templates select="d:term"/>
       </fo:block>
+      <!-- include leading indexterms in this part to prevent
+           extra spacing above first para from its space-before -->
+      <xsl:apply-templates mode="leading.indexterms" 
+                           select="d:listitem/d:indexterm[not(preceding-sibling::*)]"/>
     </fo:list-item-label>
     <fo:list-item-body start-indent="body-start()">
       <fo:block>
-        <xsl:apply-templates select="d:listitem"/>
+        <xsl:apply-templates select="d:listitem">
+          <xsl:with-param name="vl.as.list" select="1"/>
+        </xsl:apply-templates>
       </fo:block>
     </fo:list-item-body>
   </xsl:variable>
 </xsl:template>
 
 <xsl:template match="d:varlistentry/d:listitem">
-  <xsl:apply-templates/>
+  <xsl:param name="vl.as.list" select="0"/>
+  <xsl:choose>
+    <xsl:when test="$vl.as.list != 0">
+      <xsl:apply-templates select="*[not(self::d:indexterm[not(preceding-sibling::*)])]"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates/>
+    </xsl:otherwise>
+  </xsl:choose>
 </xsl:template>
 
 <!-- ==================================================================== -->
     </xsl:choose>
   </xsl:variable>
 
-  <fo:table id="{$id}" xsl:use-attribute-sets="simplelist.vertical.properties">
+  <fo:table id="{$id}" xsl:use-attribute-sets="normal.para.spacing">
 
     <xsl:choose>
       <xsl:when test="$axf.extensions != 0 or $xep.extensions != 0">
           </xsl:otherwise>
         </xsl:choose>
       </fo:block>
+      <!-- include leading indexterms in this part to prevent
+           extra spacing above first para from its space-before -->
+      <xsl:apply-templates mode="leading.indexterms" 
+                           select="child::d:indexterm[not(preceding-sibling::*)]"/>
     </fo:list-item-label>
     <fo:list-item-body start-indent="body-start()">
       <fo:block>
-        <xsl:apply-templates/>
+        <xsl:apply-templates select="*[not(self::d:indexterm[not(preceding-sibling::*)])]"/>
       </fo:block>
     </fo:list-item-body>
   </fo:list-item>
       <fo:block id="{$id}">
         <xsl:text>&#x2022;</xsl:text>
       </fo:block>
+      <!-- include leading indexterms in this part to prevent
+           extra spacing above first para from its space-before -->
+      <xsl:apply-templates mode="leading.indexterms" 
+                           select="child::d:indexterm[not(preceding-sibling::*)]"/>
     </fo:list-item-label>
     <fo:list-item-body start-indent="body-start()">
       <fo:block>
-        <xsl:apply-templates/>
+        <xsl:apply-templates select="*[not(self::d:indexterm[not(preceding-sibling::*)])]"/>
       </fo:block>
     </fo:list-item-body>
   </fo:list-item>
           <xsl:with-param name="arearefs" select="@arearefs"/>
         </xsl:call-template>
       </fo:block>
+      <!-- include leading indexterms in this part to prevent
+           extra spacing above first para from its space-before -->
+      <xsl:apply-templates mode="leading.indexterms" 
+                           select="child::d:indexterm[not(preceding-sibling::*)]"/>
     </fo:list-item-label>
     <fo:list-item-body start-indent="body-start()">
       <fo:block>
-        <xsl:apply-templates/>
+        <xsl:apply-templates select="*[not(self::d:indexterm[not(preceding-sibling::*)])]"/>
       </fo:block>
     </fo:list-item-body>
   </fo:list-item>
index ab28260693bbcf46588f45986cfcf5885525b749..9cb50d2c19900fe88d28481ad1cd9cb07c9ccacc 100644 (file)
           <fo:block/>
         </xsl:otherwise>
       </xsl:choose>
+      <!-- include leading indexterms in this part to prevent
+           extra spacing above first para from its space-before -->
+      <xsl:apply-templates mode="leading.indexterms" 
+                           select="child::d:indexterm[not(preceding-sibling::*)]"/>
     </fo:list-item-label>
     <fo:list-item-body start-indent="body-start()">
       <xsl:choose>
         <xsl:when test="$deflabel = 'none' and not(d:label)">
           <fo:block font-weight="bold">
-            <xsl:apply-templates select="*[local-name(.)!='label']"/>
+            <xsl:apply-templates select="*[local-name(.)!='label' and
+                                           not(self::d:indexterm[not(preceding-sibling::*)])]"/>
           </fo:block>
         </xsl:when>
         <xsl:otherwise>
-          <xsl:apply-templates select="*[local-name(.)!='label']"/>
+          <xsl:apply-templates select="*[local-name(.)!='label' and
+                                         not(self::d:indexterm[not(preceding-sibling::*)])]"/>
         </xsl:otherwise>
       </xsl:choose>
       <!-- Uncomment this line to get revhistory output in the question -->
           </fo:block>
         </xsl:when>
         <xsl:otherwise>
-          <fo:block/>
+          <fo:block>&#xA0;</fo:block>
         </xsl:otherwise>
       </xsl:choose>
+      <!-- include leading indexterms in this part to prevent
+           extra spacing above first para from its space-before -->
+      <xsl:apply-templates mode="leading.indexterms" 
+                           select="child::d:indexterm[not(preceding-sibling::*)]"/>
     </fo:list-item-label>
     <fo:list-item-body start-indent="body-start()">
-      <xsl:apply-templates select="*[local-name(.)!='label' and local-name(.) != 'qandaentry']"/>
+      <xsl:apply-templates select="*[local-name(.)!='label' and local-name(.) != 'qandaentry' and
+                                     not(self::d:indexterm[not(preceding-sibling::*)])]"/>
       <!-- * handle nested answer/qandaentry instances -->
       <!-- * (bug 1509043 from Daniel Leidert) -->
       <xsl:if test="descendant::d:question">