You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by br...@apache.org on 2004/07/12 21:58:54 UTC

svn commit: rev 22850 - in forrest/trunk: . src/core/context src/core/context/resources/schema/dtd src/core/context/resources/stylesheets/aggregates src/core/context/skins/common src/core/context/skins/common/xslt/fo src/core/fresh-site/src/documentation src/documentation

Author: brondsem
Date: Mon Jul 12 12:58:53 2004
New Revision: 22850

Modified:
   forrest/trunk/src/core/context/aggregate.xmap
   forrest/trunk/src/core/context/resources/schema/dtd/skinconfig-v06-2.dtd
   forrest/trunk/src/core/context/resources/stylesheets/aggregates/book2cinclude.xsl
   forrest/trunk/src/core/context/skins/common/skinconf.xsl
   forrest/trunk/src/core/context/skins/common/xslt/fo/document2fo.xsl
   forrest/trunk/src/core/fresh-site/src/documentation/skinconf.xml
   forrest/trunk/src/documentation/skinconf.xml
   forrest/trunk/status.xml
Log:
pdf improvements: no limit to TOC depth; options for showing external links' URLs, for text alignment; page breaks after TOC and each page when aggregate

Modified: forrest/trunk/src/core/context/aggregate.xmap
==============================================================================
--- forrest/trunk/src/core/context/aggregate.xmap	(original)
+++ forrest/trunk/src/core/context/aggregate.xmap	Mon Jul 12 12:58:53 2004
@@ -51,7 +51,7 @@
         <map:transform src="{forrest:stylesheets}/site2book.xsl" />
         <map:transform src="{forrest:stylesheets}/aggregates/book2cinclude.xsl">
           <map:parameter name="ignore" value="{1}"/>
-          <map:parameter name="title" value="{conf:project-name} Documentation"/>
+          <map:parameter name="title" value="{conf:project-name}"/>
         </map:transform>
         <map:transform type="cinclude"/>
         <map:transform src="{forrest:stylesheets}/aggregates/doc2doc-uniqueids.xsl"/>

Modified: forrest/trunk/src/core/context/resources/schema/dtd/skinconfig-v06-2.dtd
==============================================================================
--- forrest/trunk/src/core/context/resources/schema/dtd/skinconfig-v06-2.dtd	(original)
+++ forrest/trunk/src/core/context/resources/schema/dtd/skinconfig-v06-2.dtd	Mon Jul 12 12:58:53 2004
@@ -106,14 +106,16 @@
                   hlink  CDATA #IMPLIED
                   current CDATA #IMPLIED>
   <!ELEMENT extra-css (#PCDATA)>
-  <!ELEMENT pdf (page, margins?)>
+  <!ELEMENT pdf (page, margins?, show-external-urls?)>
   <!ELEMENT page EMPTY>
   <!ATTLIST page size (a0|a1|a2|a3|a4|a5|executive|folio|legal|ledger|letter|quarto|tabloid) "letter"
-            orientation (portrait|landscape) "portrait">
+            orientation (portrait|landscape) "portrait"
+            text-align (left|right|justify) "left">
 
   <!ELEMENT margins (top?, bottom?, inner?, outer?)>
   <!ATTLIST margins double-sided (true | false) "false">
   <!ELEMENT top (#PCDATA)>
   <!ELEMENT bottom (#PCDATA)>
   <!ELEMENT inner (#PCDATA)>
-  <!ELEMENT outer (#PCDATA)>
+  <!ELEMENT outer (#PCDATA)>
+  <!ELEMENT show-external-urls (#PCDATA)>

Modified: forrest/trunk/src/core/context/resources/stylesheets/aggregates/book2cinclude.xsl
==============================================================================
--- forrest/trunk/src/core/context/resources/stylesheets/aggregates/book2cinclude.xsl	(original)
+++ forrest/trunk/src/core/context/resources/stylesheets/aggregates/book2cinclude.xsl	Mon Jul 12 12:58:53 2004
@@ -66,7 +66,7 @@
   </xsl:template>
 
   <xsl:template match="menu-item">
-    <section>
+    <section class="page">
       <xsl:attribute name="id">
         <xsl:text></xsl:text><xsl:value-of select="@href"/>
       </xsl:attribute>

Modified: forrest/trunk/src/core/context/skins/common/skinconf.xsl
==============================================================================
--- forrest/trunk/src/core/context/skins/common/skinconf.xsl	(original)
+++ forrest/trunk/src/core/context/skins/common/skinconf.xsl	Mon Jul 12 12:58:53 2004
@@ -88,6 +88,11 @@
      <xsl:if test="not(trail)">
         <toc level="2" location="page"/>
      </xsl:if>
+     
+    <xsl:if test="not(pdf/show-external-urls)">
+        <pdf><show-external-urls>true</show-external-urls></pdf>
+    </xsl:if>
+
 
 <!--
   <xsl:if test="not(colors)">

Modified: forrest/trunk/src/core/context/skins/common/xslt/fo/document2fo.xsl
==============================================================================
--- forrest/trunk/src/core/context/skins/common/xslt/fo/document2fo.xsl	(original)
+++ forrest/trunk/src/core/context/skins/common/xslt/fo/document2fo.xsl	Mon Jul 12 12:58:53 2004
@@ -19,6 +19,12 @@
                 xmlns:fo="http://www.w3.org/1999/XSL/Format"
                 version="1.0">
 
+  <!-- left, justify, right -->
+  <xsl:variable name="text-align" select="string(//skinconfig/pdf/page/@text-align)"/> 
+  
+  <!-- print URL of external links -->
+  <xsl:variable name="show-external-urls" select="//skinconfig/pdf/show-external-urls"/>
+  
   <!-- Get the section depth to use when generating the minitoc (default is 2) -->
   <xsl:variable name="toc-max-depth" select="number(//skinconfig/toc/@max-depth)"/>
 
@@ -54,8 +60,10 @@
   <xsl:variable name="outermargin"
                 select="string(//skinconfig/pdf/margins/outer)"/>
 
-
   <xsl:param name="numbersections" select="'true'"/>
+  
+  <!-- page breaks after TOC and each page if an aggregate document -->
+  <xsl:variable name="page-break-top-sections" select="'true'"/>
 
   <!-- Section depth at which we stop numbering and just indent -->
   <xsl:param name="numbering-max-depth" select="'3'"/>
@@ -260,10 +268,14 @@
         text-align="center">
         <xsl:apply-templates select="footer"/>
       </fo:block>
+      <!-- don't list page number on first page if it's contents is just the TOC -->
+      <xsl:if test="not($toc-max-depth > 0 and $page-break-top-sections)">
       <fo:block
         text-align="start">
+          <!-- insert i18n stuff here -->
         Page <fo:page-number/>
       </fo:block>
+      </xsl:if>
       <xsl:call-template name="info"/>
     </fo:static-content>
 
@@ -284,6 +296,7 @@
       </fo:block>
       <fo:block
         text-align="end">
+        <!-- insert i18n stuff here -->
         Page <fo:page-number/>
       </fo:block>
       <xsl:call-template name="info"/>
@@ -306,6 +319,7 @@
       </fo:block>
       <fo:block
         text-align="start">
+        <!-- insert i18n stuff here -->
         Page <fo:page-number/>
       </fo:block>
       <xsl:call-template name="info"/>
@@ -323,7 +337,7 @@
       </fo:block>
 
       <fo:block
-        text-align="justify"
+        text-align="{$text-align}"
         padding-before="18pt"
         padding-after="18pt">
         <xsl:apply-templates/>
@@ -355,6 +369,7 @@
       border-bottom="0.25pt solid"
       padding-before="6pt"
       padding-after="6pt">
+      <!-- insert i18n stuff here -->
       NOTICE: <xsl:apply-templates/>
     </fo:block>
   </xsl:template>
@@ -409,6 +424,10 @@
       <xsl:with-param name="level" select="number($level)+1"/>
     </xsl:apply-templates>
 
+    <!-- if marked as a 'page', and we're breaking on pages, and were not the last node -->
+    <xsl:if test="@class='page' and $page-break-top-sections and not(following-sibling::node())">
+        <fo:block break-after="page"/>
+    </xsl:if>
   </xsl:template>
 
   <xsl:template match="title">
@@ -431,6 +450,7 @@
       space-before="20pt"
       font-weight="bold"
       font-size="9pt">
+      <!-- insert i18n stuff here -->
       by
       <xsl:for-each select="person">
         <xsl:value-of select="@name"/>
@@ -622,6 +642,7 @@
       background-color="#A0C9F5">
       <xsl:choose>
         <xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
+        <!-- insert i18n stuff here -->
         <xsl:otherwise>Note: </xsl:otherwise>
       </xsl:choose><xsl:value-of select="title"/>
     </fo:block>
@@ -658,6 +679,7 @@
       border-end-style="solid"
       border-color="#C6C650"
       background-color="#C6C650">
+      <!-- insert i18n stuff here -->
       FIXME (<xsl:value-of select="@author"/>): <xsl:value-of select="title"/>
     </fo:block>
     <fo:block
@@ -682,12 +704,15 @@
   <xsl:template match="link">
     <xsl:choose>
       <xsl:when test="starts-with(@href, '#')">
-    <fo:basic-link color="blue" text-decoration="underline" internal-destination="{substring(@href,2)}">
-      <xsl:apply-templates/>
-    </fo:basic-link>
+        <fo:basic-link color="blue" text-decoration="underline" internal-destination="{substring(@href,2)}">
+          <xsl:apply-templates/>
+        </fo:basic-link>
       </xsl:when>
       <xsl:otherwise>
-    <fo:basic-link color="blue" text-decoration="underline" external-destination="{@href}"><xsl:apply-templates/></fo:basic-link>
+        <fo:basic-link color="blue" text-decoration="underline" external-destination="{@href}"><xsl:apply-templates/></fo:basic-link>
+        <xsl:if test="$show-external-urls and @href != string(.)">
+          (<xsl:value-of select="@href"/>)
+        </xsl:if>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
@@ -776,6 +801,7 @@
       <fo:block
         text-align="center"
         font-weight="bold">
+        <!-- insert i18n stuff here -->
         Table
         <xsl:text> </xsl:text>
         <xsl:number count="table" level="multiple"/>
@@ -850,6 +876,9 @@
       </fo:block>
       <fo:block font-family="sans" font-size="12pt" space-after="5pt"
       space-before="0pt" text-align="justify" width="7.5in">
+          <xsl:if test="$page-break-top-sections">
+            <xsl:attribute name="break-after">page</xsl:attribute>
+          </xsl:if>
           <xsl:apply-templates select="section" mode="toc" />
       </fo:block>
     </xsl:if>
@@ -857,35 +886,38 @@
   </xsl:template>
 
   <xsl:template match="section" mode="toc">
-    <fo:block space-before="5pt" text-align-last="justify">
+    <xsl:param name="depth" select="'1'"/>
+    <fo:block space-before="5pt" text-align-last="justify" start-indent=".5em" text-indent=".5em">
       <fo:inline>
-        <fo:basic-link internal-destination="{generate-id( )}">
+        <xsl:variable name="id">
+          <xsl:choose>
+            <xsl:when test="normalize-space(@id)!=''">
+              <xsl:value-of select="@id"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="generate-id()"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <fo:basic-link internal-destination="{$id}">
+          <xsl:value-of select="substring('&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;', 0, 2 * $depth - 1)" />
+          <fo:inline font-size="10pt">
           <xsl:number count="section" format="1.1.1.1.1.1.1" level="multiple" />
-          <xsl:text>. </xsl:text>
+          </fo:inline>
+          <xsl:text> </xsl:text>
           <xsl:value-of select="title" />
           <fo:leader leader-pattern="dots" />
-          <fo:page-number-citation ref-id="{generate-id(  )}" />
+          <fo:page-number-citation ref-id="{$id}" />
         </fo:basic-link>
       </fo:inline>
-        <xsl:if test="$toc-max-depth > 1">
-          <xsl:apply-templates select="section" mode="toc2" />
+        <xsl:if test="$toc-max-depth > $depth">
+          <xsl:apply-templates select="section" mode="toc">
+            <xsl:with-param name="depth" select="$depth + 1"/>
+          </xsl:apply-templates>
         </xsl:if>
     </fo:block>
   </xsl:template>
 
-  <xsl:template match="section" mode="toc2">
-    <fo:block start-indent=".5em" text-align-last="justify" text-indent=".5em">
-      <fo:inline padding-start="1em">
-        <fo:basic-link internal-destination="{generate-id( )}">
-          <xsl:number count="section" format="1.1.1.1.1.1.1" level="multiple" />
-          <xsl:text>. </xsl:text>
-          <xsl:value-of select="title" />
-          <fo:leader leader-pattern="dots" />
-          <fo:page-number-citation ref-id="{generate-id(  )}" />
-        </fo:basic-link>
-      </fo:inline>
-    </fo:block>
-  </xsl:template>
 
 <!-- ====================================================================== -->
 <!-- Local Extensions section -->

Modified: forrest/trunk/src/core/fresh-site/src/documentation/skinconf.xml
==============================================================================
--- forrest/trunk/src/core/fresh-site/src/documentation/skinconf.xml	(original)
+++ forrest/trunk/src/core/fresh-site/src/documentation/skinconf.xml	Mon Jul 12 12:58:53 2004
@@ -256,6 +256,7 @@
        folio, legal, ledger, letter, quarto, tabloid (default letter).
        Supported page orientations are portrait, landscape (default
        portrait).
+       Supported text alignments are left, right, justify (default left).
     -->
     <page size="letter" orientation="portrait"/>
 
@@ -273,6 +274,11 @@
       <inner>1.25in</inner>
       <outer>1in</outer>
     </margins>
+
+    <!--
+      Print the URL text next to all links going outside the file
+    -->
+    <show-external-urls>false</show-external-urls>
   </pdf>
 
   <!-- Credits are typically rendered as a set of small clickable images in the

Modified: forrest/trunk/src/documentation/skinconf.xml
==============================================================================
--- forrest/trunk/src/documentation/skinconf.xml	(original)
+++ forrest/trunk/src/documentation/skinconf.xml	Mon Jul 12 12:58:53 2004
@@ -213,8 +213,9 @@
        folio, legal, ledger, letter, quarto, tabloid (default letter).
        Supported page orientations are portrait, landscape (default
        portrait).
+       Supported text alignments are left, right, justify (default left).
     -->
-    <page size="letter" orientation="portrait"/>
+    <page size="letter" orientation="portrait" text-align="left"/>
 
     <!--
        Margins can be specified for top, bottom, inner, and outer
@@ -230,6 +231,11 @@
       <inner>1.25in</inner>
       <outer>1in</outer>
     </margins>
+    
+    <!--
+      Print the URL text next to all links going outside the file
+    -->
+    <show-external-urls>false</show-external-urls>
   </pdf>
 
   <!-- Credits are typically rendered as a set of small clickable images in the

Modified: forrest/trunk/status.xml
==============================================================================
--- forrest/trunk/status.xml	(original)
+++ forrest/trunk/status.xml	Mon Jul 12 12:58:53 2004
@@ -49,6 +49,9 @@
         Added new document to facilitate
         <link href="site:upgrading_06">upgrading to v0.6</link>
       </action>
+      <action dev="DB" type="update" context="code">
+        Improve look of PDF pages.
+      </action>
       <action dev="DB" type="fix" context="code" fixes-bug="FOR-138">
         PDF pages recieve skinconf properly (through the skinconf pipeline).
       </action>