Ver Fonte

Updated PDF XSLT for manual

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@15366 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew há 16 anos atrás
pai
commit
d86dff3e2a

+ 10 - 6
documentation/manual/en/Makefile.in

@@ -47,6 +47,7 @@ MANUAL_PRINT1_XML=manual-print1.xml
 MANUAL_PRINT2_XML=manual-print2.xml
 MANUAL_LINT_XML=manual-lint.xml.in
 MODULE=module_specs
+PDF_XSL=pdf-manual.xsl
 XMLFILE=
 
 all:	$(MANUAL_XML) html
@@ -76,22 +77,22 @@ pdf-dir:
 		mkdir pdf; \
 	fi
 
-pdf: pdf-dir $(MANUAL_XML)
+pdf: pdf-dir $(MANUAL_XML) $(PDF_XSL)
 	@echo "Rendering of the PDF manual with $(FOP)..."
 	$(XMLLINT) --xinclude --output _temp_manual.xml $(MANUAL_XML)
-	$(XSLTPROC) --xinclude --output ZendFramework.fo $(DOCBOOK_FO_XSL) _temp_manual.xml
+	$(XSLTPROC) --xinclude --output ZendFramework.fo $(PDF_XSL) _temp_manual.xml
 	"$(FOP)" -fo ZendFramework.fo -pdf pdf/ZendFramework.pdf
 
-pdf-print-volume1: pdf-dir $(MANUAL_PRINT1_XML)
+pdf-print-volume1: pdf-dir $(PDF_XSL) $(MANUAL_PRINT1_XML)
 	@echo "Rendering volume 1 of the PDF manual with $(FOP)..."
 	$(XMLLINT) --xinclude --output _temp_manual_1.xml $(MANUAL_PRINT1_XML)
-	$(XSLTPROC) --xinclude --output ZendFramework.fo $(DOCBOOK_FO_XSL) _temp_manual_1.xml
+	$(XSLTPROC) --xinclude --output ZendFramework.fo $(PDF_XSL) _temp_manual_1.xml
 	"$(FOP)" -fo ZendFramework.fo -pdf pdf/ZendFrameworkVolume1.pdf
 
-pdf-print-volume2: pdf-dir $(MANUAL_PRINT2_XML)
+pdf-print-volume2: pdf-dir $(PDF_XSL) $(MANUAL_PRINT2_XML)
 	@echo "Rendering volume 2 of the PDF manual with $(FOP)..."
 	$(XMLLINT) --xinclude --output _temp_manual_2.xml $(MANUAL_PRINT1_XML)
-	$(XSLTPROC) --xinclude --output ZendFramework.fo $(DOCBOOK_FO_XSL) _temp_manual_2.xml
+	$(XSLTPROC) --xinclude --output ZendFramework.fo $(PDF_XSL) _temp_manual_2.xml
 	"$(FOP)" -fo ZendFramework.fo -pdf pdf/ZendFrameworkVolume2.pdf
 
 $(MANUAL_PRINT1_XML): $(MANUAL_PRINT1_XML).in
@@ -100,6 +101,9 @@ $(MANUAL_PRINT1_XML): $(MANUAL_PRINT1_XML).in
 $(MANUAL_PRINT2_XML): $(MANUAL_PRINT2_XML).in
 	sed -e 's!@DOCBOOK_DTD@!$(DOCBOOK_DTD)!' $< > $@
 
+$(PDF_XSL): $(PDF_XSL).in
+	sed -e 's!@DOCBOOK_FO_XSL@!$(DOCBOOK_FO_XSL)!' $< > $@
+
 # Cleanup
 
 check: $(MANUAL_XML)

+ 122 - 0
documentation/manual/en/pdf-manual.xsl.in

@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:fo="http://www.w3.org/1999/XSL/Format"
+    version="1.0">
+
+<!-- path to original XSL used to do transforms -->
+<xsl:import href="@DOCBOOK_FO_XSL@"/>
+
+<!-- DIRECTIVES FOR CUSTOMIZATION -->
+
+<xsl:param name="fop1.extensions" select="1"></xsl:param>
+
+<!-- Hyphenation -->
+<xsl:template name="set.flow.properties">
+  <xsl:param name="element" select="local-name(.)"/>
+  <xsl:param name="master-reference" select="''"/>
+
+  <xsl:choose>
+    <xsl:when test="starts-with($master-reference, 'index') or
+                    starts-with($master-reference, 'titlepage') or
+                    starts-with($master-reference, 'lot') or  
+                    starts-with($master-reference, 'front')">
+      <xsl:attribute name="hyphenate">false</xsl:attribute>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:attribute name="hyphenate">
+        <xsl:value-of select="$hyphenate"/>
+      </xsl:attribute>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- pages always start on odd -->
+<xsl:template match="chapter">
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:variable name="master-reference">
+    <xsl:call-template name="select.pagemaster"/>
+  </xsl:variable>
+
+  <fo:page-sequence hyphenate="{$hyphenate}"
+      master-reference="{$master-reference}"
+      force-page-count="end-on-even">
+    <xsl:attribute name="language">
+      <xsl:call-template name="l10n.language"/>
+    </xsl:attribute>
+    <xsl:attribute name="format">
+      <xsl:call-template name="page.number.format">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
+    <xsl:attribute name="initial-page-number">
+      <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
+
+    <!--
+    <xsl:attribute name="force-page-count">
+      <xsl:call-template name="force.page.count">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
+    -->
+
+    <xsl:attribute name="hyphenation-character">
+      <xsl:call-template name="gentext">
+        <xsl:with-param name="key" select="'hyphenation-character'"/>
+      </xsl:call-template>
+    </xsl:attribute>
+    <xsl:attribute name="hyphenation-push-character-count">
+      <xsl:call-template name="gentext">
+        <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
+      </xsl:call-template>
+    </xsl:attribute>
+    <xsl:attribute name="hyphenation-remain-character-count">
+      <xsl:call-template name="gentext">
+        <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
+      </xsl:call-template>
+    </xsl:attribute>
+
+    <xsl:apply-templates select="." mode="running.head.mode">
+      <xsl:with-param name="master-reference" select="$master-reference"/>
+    </xsl:apply-templates>
+
+    <xsl:apply-templates select="." mode="running.foot.mode">
+      <xsl:with-param name="master-reference" select="$master-reference"/>
+    </xsl:apply-templates>
+
+    <fo:flow flow-name="xsl-region-body">
+      <xsl:call-template name="set.flow.properties">
+        <xsl:with-param name="element" select="local-name(.)"/>
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+
+      <fo:block id="{$id}"
+                xsl:use-attribute-sets="component.titlepage.properties">
+        <xsl:call-template name="chapter.titlepage"/>
+      </fo:block>
+
+      <xsl:variable name="toc.params">
+        <xsl:call-template name="find.path.params">
+          <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="contains($toc.params, 'toc')">
+        <xsl:call-template name="component.toc">
+          <xsl:with-param name="toc.title.p" 
+                          select="contains($toc.params, 'title')"/>
+        </xsl:call-template>
+        <xsl:call-template name="component.toc.separator"/>
+      </xsl:if>
+      <xsl:apply-templates/>
+    </fo:flow>
+  </fo:page-sequence>
+</xsl:template>
+
+
+</xsl:stylesheet>