forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From che...@apache.org
Subject svn commit: rev 9569 - in xml/forrest/trunk: . src/core/context src/core/context/resources/schema/relaxng src/core/context/skins/common/xslt/fo src/core/fresh-site/src/documentation
Date Wed, 17 Mar 2004 13:03:17 GMT
Author: cheche
Date: Wed Mar 17 05:03:16 2004
New Revision: 9569

Modified:
   xml/forrest/trunk/src/core/context/resources/schema/relaxng/skinconf.rnc
   xml/forrest/trunk/src/core/context/sitemap.xmap
   xml/forrest/trunk/src/core/context/skins/common/xslt/fo/document2fo.xsl
   xml/forrest/trunk/src/core/fresh-site/src/documentation/skinconf.xml
   xml/forrest/trunk/status.xml
Log:
[#FOR-112] PDF page size and orientation in skinconf.xml


Modified: xml/forrest/trunk/src/core/context/resources/schema/relaxng/skinconf.rnc
==============================================================================
--- xml/forrest/trunk/src/core/context/resources/schema/relaxng/skinconf.rnc	(original)
+++ xml/forrest/trunk/src/core/context/resources/schema/relaxng/skinconf.rnc	Wed Mar 17 05:03:16
2004
@@ -43,10 +43,11 @@
             element year {text}?,                    # Used in Copyright
             element vendor {text}?,                  # Used in Copyright
             trail?,                                  # 'Breadcrumbs' trail in skins that
support it
-            element toc {attribute level {text}?, attribute location {string}}?, # toc generation
+            element toc {attribute level {text}, attribute location {string}}?, # toc generation
             element headings {attribute type {text}}?, # heading style
             colors?,                                 # colors
             element extra-css {text}?,               # extra css to be included in the CSS
output
+            pdf?,
             credits?
             )*
            }
@@ -67,7 +68,18 @@
                             attribute vlink {text}?,
                             attribute hlink {text}?)}* # each color
            }
-           
+
+pdf      = element pdf {
+             element page {(attribute size{text}, attribute orientation {text})},
+             element margins {
+                attribute double-sided {xsd:boolean},
+                element top {text}?,
+                element bottom {text}?,
+                element inner {text}?,
+                element outer {text}?
+             }
+           }
+
 ## Credits are typically rendered as a set of small clickable images in the
 ## page footer 
 credits = element credits { credit* }

Modified: xml/forrest/trunk/src/core/context/sitemap.xmap
==============================================================================
--- xml/forrest/trunk/src/core/context/sitemap.xmap	(original)
+++ xml/forrest/trunk/src/core/context/sitemap.xmap	Wed Mar 17 05:03:16 2004
@@ -400,18 +400,21 @@
         <map:select type="exists">
           <map:when test="{project:skins-dir}{forrest:skin}/xslt/fo/document2fo.xsl">
             <map:transform src="{project:skins-dir}{forrest:skin}/xslt/fo/document2fo.xsl">
+              <map:parameter name="config-file" value="{project:skinconf}"/>
               <map:parameter name="imagesdir" value="{project:resources.images}/"/>
               <map:parameter name="xmlbasedir" value="{project:content.xdocs}{1}"/>
             </map:transform>
           </map:when>
           <map:when test="{forrest:home}context/skins/{forrest:skin}/xslt/fo/document2fo.xsl">
             <map:transform src="{forrest:home}context/skins/{forrest:skin}/xslt/fo/document2fo.xsl">
+              <map:parameter name="config-file" value="{project:skinconf}"/>
               <map:parameter name="imagesdir" value="{project:resources.images}/"/>
               <map:parameter name="xmlbasedir" value="{project:content.xdocs}{1}"/>
             </map:transform>
           </map:when>
           <map:otherwise>
             <map:transform src="{forrest:home}context/skins/common/xslt/fo/document2fo.xsl">
+              <map:parameter name="config-file" value="{project:skinconf}"/>
               <map:parameter name="imagesdir" value="{project:resources.images}/"/>
               <map:parameter name="xmlbasedir" value="{project:content.xdocs}{1}"/>
             </map:transform>

Modified: xml/forrest/trunk/src/core/context/skins/common/xslt/fo/document2fo.xsl
==============================================================================
--- xml/forrest/trunk/src/core/context/skins/common/xslt/fo/document2fo.xsl	(original)
+++ xml/forrest/trunk/src/core/context/skins/common/xslt/fo/document2fo.xsl	Wed Mar 17 05:03:16
2004
@@ -25,6 +25,39 @@
   <!-- Get the section depth to use when generating the minitoc (default is 2) -->
   <xsl:variable name="toc-max-depth" select="number($config/toc/@level)"/>
 
+  <!-- The page size to be used -->
+  <xsl:variable name="pagesize" 
+                select="string($config/pdf/page/@size)"/>
+
+  <!-- The page orientation ("portrait" or "landscape") -->
+  <xsl:variable name="pageorientation" 
+                select="string($config/pdf/page/@orientation)"/>
+
+  <!-- Double-sided printing toggle -->
+  <xsl:variable name="doublesided"
+                select="string($config/pdf/margins/@double-sided)"/>
+
+  <!-- The top page margin -->
+  <xsl:variable name="topmargin"
+                select="string($config/pdf/margins/top)"/>
+
+  <!-- The bottom page margin -->
+  <xsl:variable name="bottommargin"
+                select="string($config/pdf/margins/bottom)"/>
+
+  <!-- The inner page margin (always the left margin if
+  double-sided printing is off, alternating between left and right if
+  it's on) -->
+  <xsl:variable name="innermargin"
+                select="string($config/pdf/margins/inner)"/>
+
+  <!-- The outer page margin (always the right margin if
+  double-sided printing is off, alternating between right and left if
+  it's on)-->
+  <xsl:variable name="outermargin"
+                select="string($config/pdf/margins/outer)"/>
+  
+
   <xsl:param name="numbersections" select="'true'"/>
 
   <!-- Section depth at which we stop numbering and just indent -->
@@ -34,17 +67,103 @@
   <xsl:include href="pdfoutline.xsl"/>
   <xsl:include href="footerinfo.xsl"/>
 
+
+  <!-- Determine page height for various page sizes (US Letter portrait
+  is the default) -->
+  <!-- FIXME: JJP:would this be better of a file? -->
+  <xsl:variable name="pageheight">
+    <xsl:choose>
+      <xsl:when test="$pageorientation = 'landscape'">
+        <xsl:choose>
+          <xsl:when test="$pagesize = 'a0'">841mm</xsl:when>
+          <xsl:when test="$pagesize = 'a1'">594mm</xsl:when>
+          <xsl:when test="$pagesize = 'a2'">420mm</xsl:when>
+          <xsl:when test="$pagesize = 'a3'">297mm</xsl:when>
+          <xsl:when test="$pagesize = 'a4'">210mm</xsl:when>
+          <xsl:when test="$pagesize = 'a5'">148mm</xsl:when>
+          <xsl:when test="$pagesize = 'executive'">7.25in</xsl:when>
+          <xsl:when test="$pagesize = 'folio'">8.5in</xsl:when>
+          <xsl:when test="$pagesize = 'ledger'">11in</xsl:when>
+          <xsl:when test="$pagesize = 'legal'">8.5in</xsl:when>
+          <xsl:when test="$pagesize = 'letter'">8.5in</xsl:when>
+          <xsl:when test="$pagesize = 'quarto'">8.5in</xsl:when>
+          <xsl:when test="$pagesize = 'tabloid'">11in</xsl:when>
+          <xsl:otherwise>8.5in</xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:choose>
+          <xsl:when test="$pagesize = 'a0'">1189mm</xsl:when>
+          <xsl:when test="$pagesize = 'a1'">841mm</xsl:when>
+          <xsl:when test="$pagesize = 'a2'">594mm</xsl:when>
+          <xsl:when test="$pagesize = 'a3'">420mm</xsl:when>
+          <xsl:when test="$pagesize = 'a4'">297mm</xsl:when>
+          <xsl:when test="$pagesize = 'a5'">210mm</xsl:when>
+          <xsl:when test="$pagesize = 'executive'">10.5in</xsl:when>
+          <xsl:when test="$pagesize = 'folio'">13in</xsl:when>
+          <xsl:when test="$pagesize = 'ledger'">17in</xsl:when>
+          <xsl:when test="$pagesize = 'legal'">14in</xsl:when>
+          <xsl:when test="$pagesize = 'quarto'">10.83in</xsl:when>
+          <xsl:when test="$pagesize = 'tabloid'">17in</xsl:when>
+          <xsl:otherwise>11in</xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <!-- Determine page width for various page sizes (US Letter portrait
+  is the default) -->
+  <xsl:variable name="pagewidth">
+    <xsl:choose>
+      <xsl:when test="$pageorientation = 'landscape'">
+        <xsl:choose>
+          <xsl:when test="$pagesize = 'a0'">1189mm</xsl:when>
+          <xsl:when test="$pagesize = 'a1'">841mm</xsl:when>
+          <xsl:when test="$pagesize = 'a2'">594mm</xsl:when>
+          <xsl:when test="$pagesize = 'a3'">420mm</xsl:when>
+          <xsl:when test="$pagesize = 'a4'">297mm</xsl:when>
+          <xsl:when test="$pagesize = 'a5'">210mm</xsl:when>
+          <xsl:when test="$pagesize = 'executive'">10.5in</xsl:when>
+          <xsl:when test="$pagesize = 'folio'">13in</xsl:when>
+          <xsl:when test="$pagesize = 'ledger'">17in</xsl:when>
+          <xsl:when test="$pagesize = 'legal'">14in</xsl:when>
+          <xsl:when test="$pagesize = 'quarto'">10.83in</xsl:when>
+          <xsl:when test="$pagesize = 'tabloid'">17in</xsl:when>
+          <xsl:otherwise>11in</xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:choose>
+          <xsl:when test="$pagesize = 'a0'">841mm</xsl:when>
+          <xsl:when test="$pagesize = 'a1'">594mm</xsl:when>
+          <xsl:when test="$pagesize = 'a2'">420mm</xsl:when>
+          <xsl:when test="$pagesize = 'a3'">297mm</xsl:when>
+          <xsl:when test="$pagesize = 'a4'">210mm</xsl:when>
+          <xsl:when test="$pagesize = 'a5'">148mm</xsl:when>
+          <xsl:when test="$pagesize = 'executive'">7.25in</xsl:when>
+          <xsl:when test="$pagesize = 'folio'">8.5in</xsl:when>
+          <xsl:when test="$pagesize = 'ledger'">11in</xsl:when>
+          <xsl:when test="$pagesize = 'legal'">8.5in</xsl:when>
+          <xsl:when test="$pagesize = 'letter'">8.5in</xsl:when>
+          <xsl:when test="$pagesize = 'quarto'">8.5in</xsl:when>
+          <xsl:when test="$pagesize = 'tabloid'">11in</xsl:when>
+          <xsl:otherwise>8.5in</xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
   <xsl:template match="/">
     <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
       <fo:layout-master-set>
 
         <fo:simple-page-master master-name="first-page"
-          page-height="11in" 
-          page-width="8.5in"
-          margin-top="1in" 
-          margin-bottom="1in" 
-          margin-left="1.25in" 
-          margin-right="1in">
+          page-height="{$pageheight}" 
+          page-width="{$pagewidth}"
+          margin-top="{$topmargin}" 
+          margin-bottom="{$bottommargin}" 
+          margin-left="{$innermargin}" 
+          margin-right="{$outermargin}">
           <fo:region-body
             margin-top="0.5in"
             margin-bottom=".5in"/>
@@ -55,12 +174,28 @@
         </fo:simple-page-master>
 
         <fo:simple-page-master master-name="even-page"
-          page-height="11in" 
-          page-width="8.5in"
-          margin-top="1in" 
-          margin-bottom="1in" 
-          margin-left="1.25in" 
-          margin-right="1in">
+          page-height="{$pageheight}" 
+          page-width="{$pagewidth}"
+          margin-top="{$topmargin}" 
+          margin-bottom="{$bottommargin}">
+          <xsl:choose>
+            <xsl:when test="$doublesided = 'true'">
+              <xsl:attribute name="margin-left">
+                <xsl:value-of select="$outermargin"/>
+              </xsl:attribute>
+              <xsl:attribute name="margin-right">
+                <xsl:value-of select="$innermargin"/>
+              </xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:attribute name="margin-left">
+                <xsl:value-of select="$innermargin"/>
+              </xsl:attribute>
+              <xsl:attribute name="margin-right">
+                <xsl:value-of select="$outermargin"/>
+              </xsl:attribute>
+            </xsl:otherwise>
+          </xsl:choose>
           <fo:region-before
             region-name="even-header"
             extent="0.5in"
@@ -75,12 +210,12 @@
         </fo:simple-page-master>
 
         <fo:simple-page-master master-name="odd-page"
-          page-height="11in" 
-          page-width="8.5in"
-          margin-top="1in" 
-          margin-bottom="1in" 
-          margin-left="1.25in" 
-          margin-right="1in">
+          page-height="{$pageheight}" 
+          page-width="{$pagewidth}"
+          margin-top="{$topmargin}" 
+          margin-bottom="{$bottommargin}" 
+          margin-left="{$innermargin}" 
+          margin-right="{$outermargin}">
           <fo:region-before
             region-name="odd-header"
             extent="0.5in"
@@ -731,7 +866,7 @@
           <xsl:value-of select="title" />
           <fo:leader leader-pattern="dots" />
           <fo:page-number-citation ref-id="{generate-id(  )}" />
-	</fo:basic-link>
+        </fo:basic-link>
       </fo:inline>
         <xsl:if test="$toc-max-depth > 1">
           <xsl:apply-templates select="section" mode="toc2" /> 

Modified: xml/forrest/trunk/src/core/fresh-site/src/documentation/skinconf.xml
==============================================================================
--- xml/forrest/trunk/src/core/fresh-site/src/documentation/skinconf.xml	(original)
+++ xml/forrest/trunk/src/core/fresh-site/src/documentation/skinconf.xml	Wed Mar 17 05:03:16
2004
@@ -27,7 +27,7 @@
   <!ELEMENT skinconfig (disable-lucene?, disable-search?, disable-print-link?, disable-pdf-link?,
   disable-xml-link?, disable-external-link-image?, disable-compliance-links?, obfuscate-mail-links?,
searchsite-domain?, searchsite-name?,
   project-name, project-description?, project-url, project-logo, group-name?, group-description?,
group-url?, group-logo?,
-  host-url?, host-logo?, favicon-url?, year?, vendor?, trail?, toc?, headings?, colors?,
extra-css?, credits?)*>
+  host-url?, host-logo?, favicon-url?, year?, vendor?, trail?, toc?, headings?, colors?,
extra-css?, pdf?, credits?)*>
   <!ELEMENT credits (credit*)>
   <!ELEMENT credit (name, url, image?, width?, height?)>
   <!-- id uniquely identifies the tool, and role indicates its function -->
@@ -88,6 +88,16 @@
                   vlink CDATA #IMPLIED
                   hlink CDATA #IMPLIED>
   <!ELEMENT extra-css (#PCDATA)>
+  <!ELEMENT page EMPTY>
+  <!ATTLIST page size (a0|a1|a2|a3|a4|a5|executive|folio|legal|ledger|letter|quarto|tabloid)
"letter"
+                 orientation (portrait|landscape) "portrait"> 
+  <!ELEMENT top (#PCDATA)>
+  <!ELEMENT bottom (#PCDATA)>
+  <!ELEMENT inner (#PCDATA)>
+  <!ELEMENT outer (#PCDATA)>
+  <!ELEMENT margins (top?, bottom?, inner?, outer?)>
+  <!ATTLIST margins double-sided (true | false) "false">
+  <!ELEMENT pdf (page, margins?)>
   ]>
 
 <skinconfig>
@@ -275,6 +285,32 @@
   
   <extra-css>
   </extra-css>
+  
+  <!-- Settings specific to PDF output.  -->
+  <pdf>
+    <!--
+       Supported page sizes are a0, a1, a2, a3, a4, a5, executive,
+       folio, legal, ledger, letter, quarto, tabloid (default letter).
+       Supported page orientations are portrait, landscape (default
+       portrait).
+    -->
+    <page size="letter" orientation="portrait"/>
+
+    <!--
+       Margins can be specified for top, bottom, inner, and outer
+       edges. If double-sided="false", the inner edge is always left
+       and the outer is always right. If double-sided="true", the
+       inner edge will be left on odd pages, right on even pages,
+       the outer edge vice versa.
+       Specified below are the default settings.
+    -->
+    <margins double-sided="false">
+      <top>1in</top>
+      <bottom>1in</bottom>
+      <inner>1.25in</inner>
+      <outer>1in</outer>
+    </margins>
+  </pdf>
 
   <!-- Credits are typically rendered as a set of small clickable images in the
   page footer -->

Modified: xml/forrest/trunk/status.xml
==============================================================================
--- xml/forrest/trunk/status.xml	(original)
+++ xml/forrest/trunk/status.xml	Wed Mar 17 05:03:16 2004
@@ -44,6 +44,10 @@
 
   <changes>
     <release version="0.6-dev" date="unreleased">
+      <action dev="JJP" type="add" context="core" 
+        due-to="Florian G. Haas" fixes-bug="FOR-112">
+        Page size and orientation for pdf.
+      </action>
       <action dev="DB" type="update" context="core" due-to="Apache Infrastructure">
         Converted repository from CVS to SVN
       </action>

Mime
View raw message