# A-A-P recipe for generating HTML files from the DocBook documentation. # # To use this recipe you will need the XML docbook tools at the very least. # To generate exec.txt, the text version, you will need 'links" or "lynx". # To generate exec.pdf you need "htmldoc". # # Where to get these tools is documented in the README file. # USER SERVICABLE PARTS: # Set these to the directories where your # XML docbook files and XSL stylesheets reside (there should be a # docbook/ directory under each of these). XMLdir = /usr/local/share/xml XSLdir = /usr/local/share/xsl # List of the edited files. There is no list of HTML files, since these are # generated and their names depend on the sgml files. DocSource = exec.sgml `glob("tutor*.sgml")` `glob("user*.sgml")` `glob("ref*.sgml")` license.sgml _top.DocDistFiles = $DocSource version.sgml aap.mod # Clean up the HTML files through "aap clean". # Also clean up the xsl files. CLEANFILES += `sufreplace(".sgml", ".html", DocSource)` index.html user.html tutorial.html reference.html appendix.html chunk.xsl onechunk.xsl exec.html exec.txt exec.pdf # NO USER SERVICABLE PARTS BELOW (maybe) # Only produce HTML when no target specified. all: index.html html {virtual} {comment = Build all HTML files} : exec.html index.html txt {virtual} {comment = Build the text version of the docs} : exec.txt pdf {virtual} {comment = Make a PDF from the big HTML file} : exec.pdf # Build the "small files" HTML version, with one file for every chapter. index.html {signfile = mysign} : $_top.DocDistFiles chunk.xsl # generate the separate HTML files :sys SGML_CATALOG_FILES=$XMLdir/docbook/4.2/docbook.cat xsltproc --catalogs chunk.xsl exec.sgml # Build the "big" HTML file containing everything. exec.html {signfile = mysign} : $_top.DocDistFiles onechunk.xsl # generate the single big HTML file. Our onechunk.xsl # uses docbook.xsl, which prints to stdout, not to a file. :sys SGML_CATALOG_FILES=$XMLdir/docbook/4.2/docbook.cat xsltproc --catalogs onechunk.xsl exec.sgml > exec.html # Convert big HTML file to text as best we can exec.txt { signfile = mysign } : exec.html # Convert the single HTML file to plain text. # Works well with older versions of links, but newer versions don't support # -dump! Fall back to Lynx then. @try: :sys links -dump exec.html >exec.txt @except: :print "links" doesn't work, now trying to use "lynx"... :sys lynx -dump -nolist exec.html >exec.txt # Convert big HTML file to PDF exec.pdf {signfile = mysign} : exec.html @try: :sys htmldoc -f exec.pdf exec.html @except: :pass # Generate the version.sgml file, containing the date and version numbers version.sgml {signfile = mysign} : $DocSource :print Generating $-target :syseval ../aap --version | :assign vers :print $vers | :eval re.sub('.* version ', '', stdin) | :eval re.sub(';.*\\s*', '', stdin) | :assign aapversion :print $vers | :eval re.sub('.* released ', '', stdin) | :assign builddate :print >! $target $lt!-- vim: set ft=dtd: :print >> $target THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. :print >> $target --$gt :print >> $target $lt!ENTITY builddate "$builddate"$gt :print >> $target $lt!ENTITY aapversion "$aapversion"$gt # Create the chunk.xsl stylesheet, which contains a path # to the XSL standard stylesheets (which is set by XSLdir, # so it might be different from what the distributed stylesheets say). chunk.xsl : :do makexsl chunk onechunk.xsl : :do makexsl docbook # Action to generate a simple xsl file. $source is the name of the xsl # docbook file to import. :action makexsl default :print >! $target $(lt)xsl:stylesheet :print >> $target xmlns:xsl="http://www.w3.org/1999/XSL/Transform" :print >> $target version="1.0"$(gt) :print >> $target $(lt)xsl:import href="$XSLdir/docbook/html/$(source).xsl"/$(gt) :print >> $target $(lt)xsl:include href="aap.xsl"/$(gt) :print >> $target $(lt)/xsl:stylesheet$(gt) :print Created $target # vim: set sw=4 sts=4: