jtaylor 02/03/24 11:41:17
Modified: src/dvsl/xdocs pdf.dvsl
Log:
This now takes an xdocs/project.xml and builds a single .fo, loading any
documents specified in the menu. Still a ton to do here. There is a serious
problem with the order in which things get serialized, so that links and other
inline elements are always at the beginning of paragraphs.
To run this I added a target like this to build-docs.xml, but I'm not sure I
understand how that file is organized so I didn't want to commit my changes:
<target
name="docs:pdf"
depends="init"
description="o Generate pdf project documentation xdoc sources">
<taskdef name="dvsl" classname="org.apache.tools.dvsl.DVSLTask">
<classpath>
<path refid="maven-classpath"/>
</classpath>
</taskdef>
<mkdir dir="${docs.dest}"/>
<dvsl
basedir="${docs.src}"
destdir="${docs.dest}/"
force="true"
toolboxfile="${maven.home}/stylesheets/toolbox.props"
in="${docs.src}/project.xml"
out="${docs.dest}/project.fo"
style="${maven.home}/stylesheets/pdf.dvsl">
<tool name="toolbox.string.basePath" value="${docs.src}"/>
<!-- Need to add the maven jar to load the toolbox -->
<classpath>
<path refid="maven-classpath"/>
</classpath>
</dvsl>
</target>
Revision Changes Path
1.3 +93 -11 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pdf.dvsl 23 Mar 2002 06:01:51 -0000 1.2
+++ pdf.dvsl 24 Mar 2002 19:41:16 -0000 1.3
@@ -1,7 +1,7 @@
## ----------------------------------------------------- define some attributes
#set( $mono = "Courier" )
-#set( $sans = "Helvetics" )
+#set( $sans = "Helvetica" )
#set( $serif = "Times Roman" )
#set( $margin = "1in" )
@@ -11,9 +11,9 @@
## ------------------------------------------- match cases for various elements
-#match( "document" )
+#match( "project" )
<?xml version="1.0" encoding="utf-8"?>
- <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!-- defines the layout master -->
<fo:layout-master-set>
<fo:simple-page-master
@@ -27,8 +27,30 @@
</fo:simple-page-master>
</fo:layout-master-set>
- <!-- starts actual layout -->
- <fo:page-sequence master-reference="main">
+ $context.applyTemplates()
+
+</fo:root>
+#end
+
+#match( "project/body/menu" )
+
+ $context.applyTemplates()
+
+#end
+
+#match( "project/body/menu/item" )
+
+ #set( $file = $context.toolbox.strings.replace( $attrib.href, ".html",
".xml" ) )
+
+ #set( $document =
$node.selectSingleNode("document('${context.toolbox.basePath}/${file}')/document" ) )
+
+ $context.applyTemplates( $document )
+
+#end
+
+#match( "document" )
+
+ <fo:page-sequence master-reference="main">
<!-- header -->
<fo:static-content flow-name="xsl-region-after">
@@ -42,20 +64,19 @@
</fo:block>
</fo:static-content>
- $context.applyTemplates( "body" )
+ $context.applyTemplates()
</fo:page-sequence>
- </fo:root>
#end
-#match( "properties")
+#match( "document/properties")
## Do nothing, properties should not be copied
#end
-#match( "body" )
+#match( "document/body" )
<fo:flow flow-name="xsl-region-body">
@@ -109,6 +130,65 @@
#end
+#match( "table" )
+
+ <fo:block
+ font-size="10pt" font-family="$sans" color="black"
+ border-style="solid" border-width="thin" border-color="gray"
+ padding=".5em"
+ background-color="yellow"
+ $normalParaSpacing>
+ WARNING: Table in source document at this location was not generated,
tables
+ are not yet supported.
+ </fo:block>
+
+#end
+
+#match( "ul" )
+ <fo:list-block>
+ $context.applyTemplates()
+ </fo:list-block>
+#end
+
+#match( "ul/li" )
+
+ <fo:list-item>
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block><fo:character character="•"/></fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body start-indent="body-start()">
+ <fo:block> $context.applyTemplates() </fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+
+#end
+
+#match( "ol" )
+ <fo:list-block>
+ $context.applyTemplates()
+ </fo:list-block>
+#end
+
+#match( "ol/li" )
+
+ <fo:list-item>
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block>$node.valueOf( "count()" )</fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body start-indent="body-start()">
+ <fo:block> $context.applyTemplates() </fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+
+#end
+
+#match( "glossary" )
+
+ ## This forces the glossary to be ignored. It should be transformed to an
+ ## xdoc before processing.
+
+#end
+
<!-- Inline font modifiers -->
#match( "strong|b" )
@@ -126,8 +206,10 @@
<!-- Image link -->
#match ( "a[@href]" )
- <fo:basic-link external-destination="$attrib.href">
- $context.applyTemplates()
+ <fo:basic-link external-destination="$toolbox.htmlescape.getText( $attrib.href
)">
+ <fo:inline color="blue" text-decoration="underline">
+ $context.applyTemplates()
+ </fo:inline>
</fo:basic-link>
#end
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>