Date: Wed, 25 Feb 1998 22:00:54 GMT From: Nik Clayton <nik@nothing-going-on.demon.co.uk> To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: docs/5848: [PATCH] Update web.mk to handle SGML files generically Message-ID: <199802252200.WAA12637@nothing-going-on.demon.co.uk>
next in thread | raw e-mail | index | archive | help
>Number: 5848 >Category: docs >Synopsis: [PATCH] Update web.mk to handle SGML files generically >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Feb 25 14:10:02 PST 1998 >Last-Modified: >Originator: Nik Clayton >Organization: N/A >Release: FreeBSD 2.2.5-STABLE i386 >Environment: N/A >Description: The FreeBSD website currently builds the HTML files that make up the site from documents conforming to one of two DTDs, HTML and DocBook. Files conforming to the HTML DTD have a .sgml extension, and files conforming to DocBook have a .docb extension. This struck me as odd for two reasons. 1. It's expandable, but only by adding new extensions, which isn't a particularly clean approach. 2. Both .sgml and .docb files consist of SGML markup. The use of .sgml just for files that conform to the HTML DTD is misleading. The benefit of this approach is that it lets you use make(1) suffix rules to select different processing depending on the file extension. I've used web.mk as the basis for an includeable makefile to drive the generation of my own websites. One of the things I changed was to use .sgml as the extension for all files, and to have the suffix file that converts .sgml to .html select the processing to do based on the document's DTD. The attached patch adds this functionality to web.mk, should anyone find it useful. After applying the patch, all existing .docb files will convert as normal. As will the .sgml files. However, you can then start renaming the existing .docb files to .sgml (and fixing up the appropriate Makefiles) and use .sgml for all new DocBook documents. It also means you can use another SGML DTD (as long as you have a conversion process from the DTD to HTML) without needing to create a new filename extension. Note: Suggestions for how better to determine the DTD of a particular document appreciated. >How-To-Repeat: N/A >Fix: Apply this patch (if this functionality is desired) Index: web.mk =================================================================== RCS file: /usr/local/cvs-reps/FreeBSD/www/data/web.mk,v retrieving revision 1.13 diff -u -r1.13 web.mk --- web.mk 1998/01/18 22:27:31 1.13 +++ web.mk 1998/02/25 21:29:50 @@ -49,21 +49,48 @@ ### # file.sgml --> file.html # -# Runs file.sgml through spam to validate and expand some entity -# references are expanded. file.html is added to the list of -# things to install. +# Examines file.sgml to determine the DTD in use. The DTD determines how +# the file will be converted to HTML. The converted file is added to the +# list of files to install +# +# Source DTD Action +# ------------------------------------------------------------------------ +# HTML Run the file through sgmlnorm to validate and expand +# entity references. +# +# DocBook Run the file through sgmlfmt to create the HTML +# .SUFFIXES: .sgml .html SGMLNORM= sgmlnorm +SGMLFMT= sgmlfmt CATALOG?= /usr/local/share/sgml/html/catalog SGMLNORMFLAGS= -d ${SGMLNORMOPTS} -c ${CATALOG} GENDOCS+= ${DOCS:M*.sgml:S/.sgml$/.html/g} ORPHANS:= ${ORPHANS:N*.sgml} .sgml.html: - ${SGMLNORM} ${SGMLNORMFLAGS} ${.IMPSRC} > ${.TARGET} + @DTD=`grep "<!DOCTYPE" ${.IMPSRC} | perl -ne '/DTD (\w+)/; print $$1;'`; \ + echo "${.IMPSRC} ($$DTD) --> ${.TARGET}"; \ + case $$DTD in \ + HTML) \ + ${SGMLNORM} ${SGMLNORMFLAGS} \ + ${.IMPSRC} > ${.TARGET}; \ + ;; \ + DocBook) \ + ${SGMLFMT} -d docbook -f html ${SGMLOPTS} \ + ${.IMPSRC} \ + ;; \ + *) \ + echo "Don't know how to process $$DTD." \ + ;; \ + esac ### +# +# XXX Legacy target, until all .docb files are renamed to .sgml, and +# the Makefiles updated appropriately. Then this target can be +# removed # file.docb --> file.html # # Generate HTML from docbook >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802252200.WAA12637>