#!/bin/sh # # $Id$ # # This script tries to encapsulate all the tasks that are necessary to # convert the FreeBSD handbook to a (minimal) DocBook markup. # # Requirements: # # 1. From the Ports collection # # textproc/docbook - DTD # textproc/jade - Jade, nsgmls # textproc/sgmlformat - instant, LinuxDoc -> DocBook transpec # # 2. A current version of the handbook (obviously) # # 3. entity-cdata.pl, to convert entities into references to their own # names and back again # # It's not possible to convert each individual file to DocBook. Instead, # we have to convert the whole thing to DocBook, giving one large file. # We can then split this file out into seperate components. # # Problems with this approach: # # Comments are nuked. We probably need to go back through the LinuxDoc # files looking for comments, and adding them back in as appropriate. # # ------------------------------------------------------------------------ # Variable definitions # Full path and filename of entity-cdata.pl EC=/home/nik/bin/entity-cdata.pl # Full path to a copy of the handbook HANDBOOK=/home/nik/cvs/doc/handbook # Flags to pass to nsgmls NSGMLS_FLAGS='-c /usr/local/share/sgml/linuxdoc/catalog' INSTANT_FLAGS='-t /usr/local/share/sgml/transpec/linuxdoc-docbook.ts' # ------------------------------------------------------------------------ # STEP # # Go to the directory containing the handbook cd $HANDBOOK # ------------------------------------------------------------------------ # STEP # # Neutralise the entity definitions in the appropriate SGML files. # $EC handbook.sgml > temp; mv temp handbook.sgml $EC -m authors.sgml > temp; mv temp authors.sgml $EC -m lists.sgml > temp; mv temp lists.sgml # ------------------------------------------------------------------------ # STEP # # Use the LinuxDoc -> DocBook transpec to convert nsgmls $NSGMLS_FLAGS handbook.sgml | instant $INSTANT_FLAGS | sed -e 's/-entity-/\&/g' > handbook-db.sgml # ------------------------------------------------------------------------ # STEP # # Reactivate the entities in the file # # XXX Another way to do this would be to remove the files and 'cvs update' $EC -r handbook.sgml > temp; mv temp handbook.sgml $EC -r -m authors.sgml > temp; mv temp authors.sgml $EC -r -m lists.sgml > temp; mv temp lists.sgml