# $Source$ # $Author: xmldoc $ # $Date: 2007-03-05 06:28:18 +0000 (Mon, 05 Mar 2007) $ # $Revision: 6666 $ # vim: number # # ----------------------------------------------------------------- # ** Makefile.combine -- combine source files ** # ----------------------------------------------------------------- # # This file is part of the DocBook Project XSL Stylesheet # distribution. # # See http://docbook.sourceforge.net/release/xsl/current/ # for copyright and other information. # # This makefile creates "wrapper" files that combine sets of # individual DocBook source files. The purpose of combining the # files is to speed up processing time. By default it puts 20 # files into each wrapper. Use CHUNKSIZE to configure the number # of files per wrapper. # # Currently, this makefile has only a "man" target and is mainly # intended to speed up processing of large numbers of individual # refentry instances. # What file extension do you use for DocBook source files? DOCBOOK_FILE_EXTENSION = .xml SOURCE_FILES_DBK = $(wildcard *$(DOCBOOK_FILE_EXTENSION)) MAKEFILE_DOCBOOK = Makefile.DocBook XSLTPROC=xsltproc XSLTPROC_FLAGS= SED=sed SED_FLAGS=-i CHUNKSIZE ?= 20 WRAPPER_ELEMENT = reference WRAPPER_TITLE=Combined contents COMBINE_XSL = <?xml version="1.0"?> \ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \ xmlns:exsl="http://exslt.org/common" \ xmlns:xi="http://www.w3.org/2001/XInclude" \ exclude-result-prefixes="exsl xi" \ extension-element-prefixes="exsl" \ version="1.0"> \ <xsl:param name="files"/> \ <xsl:param name="chunk.size"/> \ <xsl:template match="/"> \ <xsl:call-template name="make.file"/> \ </xsl:template> \ \ <xsl:template name="make.file"> \ <xsl:param name="count" select="1"/> \ <xsl:param name="current.files" select="concat(normalize-space($$files), ^^ ^^)"/> \ <xsl:param name="more.files" \ select="concat(normalize-space(substring-after($$current.files, ^^ ^^)),^^ ^^)"/> \ <xsl:param name="file.number" select="1"/> \ <xsl:param name="filename" select="concat(^^./build/^^,$$file.number,^^.xml^^)"/> \ \ <xsl:choose> \ <xsl:when test="$$more.files = ^^ ^^"/> \ <xsl:when test="$$count mod $$chunk.size = 0"> \ <xsl:variable name="fileset" select="concat($$current.files, ^^ ^^, \ substring-before($$more.files, ^^ ^^))"/> \ <exsl:document href="{$$filename}" \ method="xml" \ encoding="UTF-8" \ indent="yes" \ omit-xml-declaration="yes" \ media-type="" \ standalone="no"> \ <$(WRAPPER_ELEMENT)> \ <title>$(WRAPPER_TITLE)</title> \ <xsl:call-template name="make.xinclude"> \ <xsl:with-param name="file"> \ <xsl:choose> \ <xsl:when test="contains($$fileset, ^^ ^^)"> \ <xsl:value-of \ select="normalize-space(substring-before($$fileset, ^^ ^^))"/> \ </xsl:when> \ <xsl:otherwise> \ <xsl:value-of select="$$fileset"/> \ </xsl:otherwise> \ </xsl:choose> \ </xsl:with-param> \ <xsl:with-param \ name="remaining.files" \ select="concat(normalize-space(substring-after($$fileset, ^^ ^^)),^^ ^^)"/> \ </xsl:call-template> \ </$(WRAPPER_ELEMENT)> \ </exsl:document> \ <xsl:call-template name="make.file"> \ <xsl:with-param name="count" select="1"/> \ <xsl:with-param name="current.files" \ select="$$more.files"/> \ <xsl:with-param name="file.number" select="number($$file.number) + 1"/> \ <xsl:with-param name="filename" select="concat(^^./build/^^,$$file.number,^^.xml^^)"/> \ </xsl:call-template> \ </xsl:when> \ <xsl:otherwise> \ <xsl:call-template name="make.file"> \ <xsl:with-param name="count" select="$$count + 1"/> \ <xsl:with-param name="current.files"> \ <xsl:choose> \ <xsl:when test="$$count = 1 and $$file.number = 1"> \ <xsl:value-of \ select="concat(substring-before($$current.files, ^^ ^^), \ ^^ ^^, \ substring-before($$more.files, ^^ ^^))"/> \ </xsl:when> \ <xsl:when test="$$count = 1"> \ <xsl:value-of \ select="substring-before($$more.files, ^^ ^^)"/> \ </xsl:when> \ <xsl:otherwise> \ <xsl:value-of \ select="concat($$current.files, ^^ ^^, \ substring-before($$more.files, ^^ ^^))"/> \ </xsl:otherwise> \ </xsl:choose> \ </xsl:with-param> \ <xsl:with-param name="more.files" \ select="substring-after($$more.files, ^^ ^^)"/> \ <xsl:with-param name="file.number" select="$$file.number"/> \ </xsl:call-template> \ </xsl:otherwise> \ </xsl:choose> \ </xsl:template> \ \ <xsl:template name="make.xinclude"> \ <xsl:param name="file"/> \ <xsl:param name="remaining.files"/> \ <xsl:param name="count" select="1"/> \ <xsl:if test="not($$file = ^^^^)"> \ <xi:include href="../{$$file}"/> \ <xsl:call-template name="make.xinclude"> \ <xsl:with-param \ name="file" \ select="substring-before($$remaining.files, ^^ ^^)"/> \ <xsl:with-param \ name="remaining.files" \ select="substring-after($$remaining.files, ^^ ^^)"/> \ <xsl:with-param name="count" select="$$count + 1"/> \ </xsl:call-template> \ </xsl:if> \ </xsl:template> \ \ </xsl:stylesheet> all: man man: build/man build/Makefile: if [ ! -d build ]; then mkdir build; fi cp $(MAKEFILE_DOCBOOK) $@ combine.xsl: Makefile @echo '$(COMBINE_XSL)' > $@ $(SED) $(SED_FLAGS) "s/\^\^/'/g" $@ build/1.xml: combine.xsl $(XSLTPROC) $(XSLTPROC_FLAGS) \ --stringparam files "$(SOURCE_FILES_DBK)" \ --stringparam chunk.size $(CHUNKSIZE) \ $< $< build/man: build/Makefile build/1.xml time $(MAKE) -C build man \ MAN_PARAMS="--stringparam man.output.quietly 1 \ --stringparam refentry.meta.get.quietly 1 \ --stringparam man.charmap.enabled 0" debug: clean: $(RM) -r build
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 12728 | eedwards |
Upgrade ANT doc build infrastructure to assemble PDFs: - remove non-namespaced DocBook source and add namespaced DocBook source. - add Apache FOP 1.1 - copy fonts, images, XSL into _build, establishing new asset structure. The original structure remains until all guides using it can be upgraded, and several other issues can be resolved. - updated build.xml to allow for per-target build properties. - upgraded the P4SAG to use the new infrastructure. - tweaked admonition presentation in PDFs to remove admonition graphics, and resemble closely the presentation used in the new HTML layout, including the same colors. With these changes, building PDFs involves using a shell, navigating into the guide's directory (just P4SAG for now), and executing "ant pdf". Issues still to be resolved: - PDF generation encounters several warnings about missing fonts (bold versions of Symbol and ZapfDingbats), and a couple of locations where the page content exceeds the defined content area. - Due to issues within Apache FOP, PDF generation emits a substantial amount of output that is not easily suppressed without losing important warning information. - Apache FOP's interface to ANT does not expose a way to set the font base directory. The current configuration does work under Mac OSX, but further testing on Windows will need to be done to determine if the relative paths defined continue to work. The workaround is for Windows users to customize the fop-config.xml to provide absolute system paths to the required fonts. - HTML generation needs further browser testing, and exhibits broken navigation on iOS browsers within the TOC sidebar. - A number of PDF and HTML presentation tweaks still need to be made, for example: sidebars, gui* DocBook tags, whitespace, section separation, etc. |