In order to modernize our documentation tool chain, I have made a few
tweaks to allow using FOP to build the PDF documentation.  I'd like to
get some testing on different operating systems and versions thereof in
order to learn whether this solution is robust and easily accessible by
users and developers, and also whether the resulting documents are
correct and free of major rendering problems.  I'll add it to the
commitfest for that.  Reviewers should ideally just have to install the
"fop" package that is hopefully supplied by their operating systems and
then run the make targets mentioned in the patch.  I'm aware of a few
potential pitfalls, but I'd rather not mention them yet in order to get
unbiased reports.
>From 8b1be96eed45c7df80ac51292b82b6e3e4200805 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pete...@gmx.net>
Date: Wed, 11 Sep 2013 10:20:27 -0400
Subject: [PATCH] doc: Improve setup for documentation building with FOP

Add a makefile rule for building PDFs with FOP.  Two new build targets
in doc/src/sgml are postgres-A4-fop.pdf and postgres-US-fop.pdf.

Run .fo output through xmllint for reformatting, so that errors are
easier to find.  (The default output has hardly any line breaks, so you
might be looking for an error in column 20000.)

Set some XSLT parameters to optimize for building with FOP.
---
 doc/src/sgml/Makefile          | 18 +++++++++++++++---
 doc/src/sgml/stylesheet-fo.xsl |  9 +++++++++
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index aeade13..69a4237 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -267,12 +267,24 @@ xslthtml-stamp: stylesheet.xsl postgres.xml
 htmlhelp: stylesheet-hh.xsl postgres.xml
 	$(XSLTPROC) $(XSLTPROCFLAGS) $^
 
-%-A4.fo: stylesheet-fo.xsl %.xml
+%-A4.fo.tmp: stylesheet-fo.xsl %.xml
 	$(XSLTPROC) $(XSLTPROCFLAGS) --stringparam paper.type A4 -o $@ $^
 
-%-US.fo: stylesheet-fo.xsl %.xml
+%-US.fo.tmp: stylesheet-fo.xsl %.xml
 	$(XSLTPROC) $(XSLTPROCFLAGS) --stringparam paper.type USletter -o $@ $^
 
+FOP = fop
+XMLLINT = xmllint
+
+# reformat FO output so that locations of errors are easier to find
+%.fo: %.fo.tmp
+	$(XMLLINT) --format --output $@ $^
+
+.SECONDARY: postgres-A4.fo postgres-US.fo
+
+%-fop.pdf: %.fo
+	$(FOP) -fo $< -pdf $@
+
 epub: postgres.epub
 postgres.epub: postgres.xml
 	$(DBTOEPUB) $<
@@ -390,7 +402,7 @@ clean:
 # index
 	rm -f HTML.index $(GENERATED_SGML)
 # XSLT
-	rm -f postgres.xml postgres.xmltmp htmlhelp.hhp toc.hhc index.hhk *.fo
+	rm -f postgres.xml postgres.xmltmp htmlhelp.hhp toc.hhc index.hhk *.fo *.fo.tmp
 # EPUB
 	rm -f postgres.epub
 # Texinfo
diff --git a/doc/src/sgml/stylesheet-fo.xsl b/doc/src/sgml/stylesheet-fo.xsl
index aafc946..a2dc139 100644
--- a/doc/src/sgml/stylesheet-fo.xsl
+++ b/doc/src/sgml/stylesheet-fo.xsl
@@ -6,6 +6,15 @@
 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
 <xsl:include href="stylesheet-common.xsl" />
 
+<xsl:param name="use.extensions" select="1"></xsl:param>
+<xsl:param name="fop1.extensions" select="1"></xsl:param>
+<xsl:param name="tablecolumns.extension" select="0"></xsl:param>
+
+<xsl:attribute-set name="monospace.verbatim.properties"
+                   use-attribute-sets="verbatim.properties monospace.properties">
+  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
+</xsl:attribute-set>
+
 <!-- Change display of some elements -->
 
 <xsl:template match="command">
-- 
1.8.4

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to