You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jt...@apache.org on 2002/03/23 07:01:51 UTC
cvs commit: jakarta-turbine-maven/src/dvsl/xdocs pdf.dvsl
jtaylor 02/03/22 22:01:51
Modified: src/dvsl/xdocs pdf.dvsl
Log:
Changes which allow this stylesheet to actually turb xdocs into PDF. Still a
lot to do here (some of the inlines and links don't work properly, need to
get titles and footers and project data and such in). The biggest problem
is that we are making heavy use of tables in many of the generated docs, and
transforming them into a form that FOP can handle is... challenging. If anyone
else wants to take a look at that DIG IN! It works now so at least we have a
place to start.
Revision Changes Path
1.2 +105 -93 jakarta-turbine-maven/src/dvsl/xdocs/pdf.dvsl
Index: pdf.dvsl
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/dvsl/xdocs/pdf.dvsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- pdf.dvsl 11 Mar 2002 20:20:38 -0000 1.1
+++ pdf.dvsl 23 Mar 2002 06:01:51 -0000 1.2
@@ -1,124 +1,136 @@
-#document()
+## ----------------------------------------------------- define some attributes
-<!-- Make a Section header bar -->
-#match ( makeSectionHeader $value )
- #if ( $value.getAttributeValue("name") )
- #set ( $titleName = $value.getAttributeValue("name") )
- #else
- #set ( $titleName = "" )
- #end
- <fo:block
- font-size="14pt"
- font-family="sans-serif"
- line-height="24pt"
- space-after.optimum="15pt"
- background-color="blue"
- color="white"
- text-align="start"
- padding-top="3pt">
- $titleName
- </fo:block>
-#end
+#set( $mono = "Courier" )
+#set( $sans = "Helvetics" )
+#set( $serif = "Times Roman" )
-<!-- Make a Paragraph -->
-#match ( makeParagraph $value )
- <fo:block
- font-size="12pt"
- space-after.optimum="15pt"
- font-family="sans-serif"
- background-color="white"
- color="black"
- text-align="start"
- padding-top="3pt">
- $xmlout.outputString($value)
- </fo:block>
-#end
+#set( $margin = "1in" )
-<!-- Make a Source Code block -->
-#match ( makeSrc $value )
- <fo:block
- font-size="12pt"
- space-after.optimum="15pt"
- font-family="sans-serif"
- background-color="white"
- color="gray"
- text-align="start"
- padding-top="3pt">
- $escape.getText($value.getText())
- </fo:block>
-#end
-
-<!-- Make an image link -->
-#match ( makeLink $value )
- <fo:block font-size="12pt"
- space-after.optimum="15pt"
- font-family="sans-serif"
- background-color="white"
- color="gray"
- text-align="start"
- padding-top="3pt">
- <fo:basic-link external-destination="http://test">
- TO DO
- </fo:basic-link>
- </fo:block>
-#end
+#set( $normalParaSpacing = 'space-before.optimum="1em" space-before.minimum="0.8em" space-before.maximum="1.2em"' )
+#set( $headerSpacing = 'space-before.minimum="1em" space-before.optimum="1.5em" space-before.maximum="2em"' )
-#match (document)
+## ------------------------------------------- match cases for various elements
+
+#match( "document" )
<?xml version="1.0" encoding="utf-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!-- defines the layout master -->
<fo:layout-master-set>
<fo:simple-page-master
- master-name="Velocity"
- page-height="8.5in"
- page-width="11in"
- margin-top="0.25in"
- margin-bottom="0.25in"
- margin-left="0.5in"
- margin-right="0.5in">
- <fo:region-before extent="0.25in"/>
- <fo:region-body margin-top="0.25in"/>
- </fo:simple-page-master>
- </fo:layout-master-set>
+ master-name="main"
+ margin-top="$margin"
+ margin-bottom="$margin"
+ margin-left="$margin"
+ margin-right="$margin">
+ <fo:region-body margin-bottom="0.25in"/>
+ <fo:region-after extent="0.25in"/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
<!-- starts actual layout -->
- <fo:page-sequence master-name="Velocity">
+ <fo:page-sequence master-reference="main">
<!-- header -->
- <fo:static-content flow-name="xsl-region-before">
+ <fo:static-content flow-name="xsl-region-after">
<fo:block
text-align="end"
- font-size="10pt"
- font-family="serif"
+ font-size="8pt"
+ font-family="$serif"
color="black"
padding-right="3pt">
- $root.getChild("properties").getChild("title").getText() pg <fo:page-number/>
+ $!root.getChild("properties").getChild("title").getText() page <fo:page-number/>
</fo:block>
</fo:static-content>
- <fo:flow flow-name="xsl-region-body">
-
- #set ($allSections = $xpath.applyTo("body/section", $root))
+ $context.applyTemplates( "body" )
- <!-- Walk through the sections -->
- #foreach ( $section in $allSections )
- #makeSectionHeader($section)
- #foreach ( $item in $section.getChildren() )
- #if ( $item.getName().equals("p") )
- #makeParagraph($item)
- #elseif ( $item.getName().equals("source") )
- #makeSrc($item)
- #end
- #end
- #end
- </fo:flow>
</fo:page-sequence>
</fo:root>
+
+#end
+
+#match( "properties")
+
+ ## Do nothing, properties should not be copied
+
+#end
+
+#match( "body" )
+
+ <fo:flow flow-name="xsl-region-body">
+
+ $context.applyTemplates()
+
+ </fo:flow>
+
#end
+// ------------------------------------------------------------------- sections
+
+#match( "section" )
+
+ <fo:block font-size="14pt" font-family="$serif" color="blue" $headerSpacing>
+ $attrib.name
+ </fo:block>
+ $context.applyTemplates()
+#end
+#match( "subsection" )
+ <fo:block font-size="12pt" font-family="$serif" color="blue" $headerSpacing>
+ $attrib.name
+ </fo:block>
+ $context.applyTemplates()
+#end
+
+// --------------------------------------------------------------------- blocks
+
+#match ( "p" )
+
+ <fo:block font-size="10pt" font-family="$serif" color="black" $normalParaSpacing>
+
+ $context.applyTemplates()
+
+ </fo:block>
+
+#end
+
+#match( "source" )
+
+ <fo:block wrap-option="no-wrap"
+ white-space-collapse='false'
+ font-size="10pt" font-family="$mono" color="gray"
+ border-style="dotted" border-width="thin" border-color="gray"
+ $normalParaSpacing>$toolbox.htmlescape.getText( $node.value() )</fo:block>
+
+#end
+
+<!-- Inline font modifiers -->
+
+#match( "strong|b" )
+ <fo:inline font-weight="bold">
+ $context.applyTemplates()
+ </fo:inline>
+#end
+
+#match( "emph|i" )
+ <fo:inline font-style="italic">
+ $context.applyTemplates()
+ </fo:inline>
+#end
+
+<!-- Image link -->
+
+#match ( "a[@href]" )
+ <fo:basic-link external-destination="$attrib.href">
+ $context.applyTemplates()
+ </fo:basic-link>
+#end
+
+#match( "text()" )
+ $node.value()
+#end
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>