summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdocs/docbook/configure15
-rw-r--r--docs/docbook/scripts/README.ldp_print60
-rw-r--r--docs/docbook/scripts/fix_print_html.lib172
-rwxr-xr-xdocs/docbook/scripts/ldp_print71
-rw-r--r--docs/docbook/stylesheets/ldp.dsl.in256
5 files changed, 568 insertions, 6 deletions
diff --git a/docs/docbook/configure b/docs/docbook/configure
index b2403428a2..23232148ce 100755
--- a/docs/docbook/configure
+++ b/docs/docbook/configure
@@ -777,9 +777,9 @@ fi
SGML_SHARE="/usr/local/share/sgml"
-# Check whether --with-SGML_SHARE or --without-SGML_SHARE was given.
-if test "${with_SGML_SHARE+set}" = set; then
- withval="$with_SGML_SHARE"
+# Check whether --with-sgml-share or --without-sgml-share was given.
+if test "${with_sgml_share+set}" = set; then
+ withval="$with_sgml_share"
case "$withval" in
no) SGML_SHARE=""
;;
@@ -795,7 +795,10 @@ esac
fi
-
+# The Makefile requires docbook2X in the share/sgml directory
+if ! test -f $SGML_SHARE/docbook2X/docbook2man-spec.pl ; then
+ { echo "configure: error: "Unable to find dockbook2X. Make sure it is installed and that the sgml-share path is correct."" 1>&2; exit 1; }
+fi
DOC_BUILD_DATE=`date '+%d-%m-%Y'`
@@ -913,7 +916,7 @@ done
ac_given_srcdir=$srcdir
-trap 'rm -fr `echo "Makefile " | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "Makefile stylesheets/ldp.dsl " | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@@ -994,7 +997,7 @@ EOF
cat >> $CONFIG_STATUS <<EOF
-CONFIG_FILES=\${CONFIG_FILES-"Makefile "}
+CONFIG_FILES=\${CONFIG_FILES-"Makefile stylesheets/ldp.dsl "}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
diff --git a/docs/docbook/scripts/README.ldp_print b/docs/docbook/scripts/README.ldp_print
new file mode 100644
index 0000000000..8d61a85534
--- /dev/null
+++ b/docs/docbook/scripts/README.ldp_print
@@ -0,0 +1,60 @@
+
+######################################################################
+ ldp_print - print tool/script for DocBook SGML/XML documents
+######################################################################
+
+This process/script is used in the production environment for the
+LDP. It relies on the HTMLDOC software package (GPL'ed) which can be
+obtained from the Easy Software Products (c) web site:
+
+ http://www.easysw.com/htmldoc/
+
+This process creates a PDF variant from the single-file HTML
+representation of a DocBook SGML (or XML) instance. The simple
+wrapper script (ldp_print) assumes that the file was created using
+{open}jade in a manner similar to:
+
+ jade -t sgml -i html -V nochunks -d $style $fname > $fname.html
+
+Give the script the filename as an argument. It will then parse the
+file into 'title.html' and 'body.html' and send each to htmldoc (as
+the corresponding title page and body of the document).
+
+
+CAVEATS
+=======
+
+o Assumes perl is in /usr/bin; adjust if necessary
+
+o You may need to specify where the htmldoc executable resides.
+ The script assumes it's within your $PATH.
+
+o If you want Postscript as an output variant, uncomment the
+ appropriate lines (see below).
+
+o Relies on output from a DocBook instance created via DSSSL/{open}jade!
+
+o Cleans up (removes) the intermediate files it creates (but not the
+ PDF or Postscript files, obviously!)
+
+o Works silently; PDF (PostScript) will be created in the same directory
+ as was specified for the input (single-file HTML) file.
+
+o Provided without warranty or support!
+
+o I ran into a problem with htmldoc v1.8.8 which required a source
+ code change (I was getting a core dump from the htmldoc process).
+ Here is the change required:
+
+ htmldoc/ps-pdf.cxx :
+ 3662,3665d3661
+ < /* gjf = 11Oct2000 */
+ < if( temprow == NULL )
+ < break;
+ <
+
+
+====
+gferg (at) sgi.com / Ferg
+11 Jan 2000
+
diff --git a/docs/docbook/scripts/fix_print_html.lib b/docs/docbook/scripts/fix_print_html.lib
new file mode 100644
index 0000000000..e8a9aaa4c7
--- /dev/null
+++ b/docs/docbook/scripts/fix_print_html.lib
@@ -0,0 +1,172 @@
+#
+# fix_print_html.lib
+#
+# Dan Scott / <dan.scott (at) acm.org>
+# Ferg / <gferg (at) sgi.com>
+#
+# Used to prepare single-file HTML variant for PDF/Postscript creation
+# thru htmldoc.
+#
+# log:
+# 16Oct2000 - initial entry <gferg (at) sgi.com>
+# 03Apr2001 - fix for <preface>
+#
+#
+
+sub fix_print_html {
+
+ my($in,$out,$ttl) = @_;
+
+ open(IN_FILE, "< $in") || do {
+ print "fix_print_html: cannot open $in: $!\n";
+ return 0;
+ };
+
+ my($buf,$ttl_buf) = '';
+ my($indx) = -1;
+ my($is_article) = 0;
+ while(<IN_FILE>) {
+
+ if( $indx == 1 ) {
+
+ # ignore everything until we see the chapter or sect
+ #
+ if( $_ =~ /CLASS="CHAP/i || $_ =~ /CLASS="PREF/i ) {
+
+ $buf .= $_;
+ $indx++;
+
+ } elsif( $_ =~ /CLASS="SECT/ || $_ =~ /CLASS="sect/ ) {
+
+ $buf .= $_;
+ $indx++;
+ $is_article = 1;
+
+ } else {
+ next;
+ }
+
+ } elsif( $indx == 0 ) {
+
+ # write out the title page file
+ #
+ if( $_ =~ /CLASS="TOC"/ ) {
+
+ $ttl_buf .= "></DIV>\n</BODY>\n</HTML>\n";
+ $ttl_buf =~ s/<\/H1\n/<\/H1\n><P><BR><BR\n/ms;
+
+ open(TOC_FILE, "> $ttl") || do {
+ print "fix_print_html: cannot open $ttl: $!\n";
+ close(IN_FILE);
+ return 0;
+ };
+ print TOC_FILE $ttl_buf;
+ close(TOC_FILE);
+ $ttl_buf = '';
+ $indx++;
+
+ } else {
+ $ttl_buf .= $_;
+ }
+
+ } elsif( $indx < 0 ) {
+
+ # up to this point, both buffers get the line
+ #
+ if( $_ =~ /CLASS="TITLEPAGE"/ ) {
+
+ $ttl_buf .= $_ . ">\n<P>\n<BR><BR><BR><BR>\n<\/P\n";
+ $indx++;
+
+ } else {
+ $buf .= $_;
+ $ttl_buf .= $_;
+ }
+
+ } else {
+
+ $buf .= $_;
+ }
+ }
+ close(IN_FILE);
+
+ open(OUT_FILE, "> $out") || do {
+ print "fix_print_html: cannot open $out: $!\n";
+ return 0;
+ };
+
+
+ # make these corrections and write out the file
+ #
+
+ $buf =~ s/(\n><LI\n)><P\n(.*?)<\/P\n>/$1$2\n/gms;
+ $buf =~ s/(\n><LI\n><DIV\nCLASS="FORMALPARA"\n)><P\n(.*?)<\/P\n>/$1$2\n/gms;
+ $buf =~ s/(\n><LI\nSTYLE="[^\"]+"\n)><P\n(.*?)<\/P\n>/$1$2\n/gms;
+ if( $is_article == 0 ) {
+ $buf =~ s/(\nCLASS="SECT[TION\d]+"\n>)<H1\n(.*?)<\/H1/$1<H2\n$2<\/H2/gims;
+ $buf =~ s/(\nCLASS="SECT[TION\d]+"\n><HR>)<H1\n(.*?)<\/H1/$1<H2\n$2<\/H2/gims;
+ }
+ $buf =~ s/<H1(\nCLASS="INDEXDIV"\n)(.*?)<\/H1/<H2$1$2<\/H2/gims;
+ if( ($indx = rindex($buf, "<H1\n><A\nNAME=\"DOC-INDEX\"")) > -1 ) {
+ $buf = substr($buf, 0, $indx);
+ $buf .= "\n<\/BODY>\n<\/HTML>\n\n";
+ } elsif( ($indx = rindex($buf, "<H1\n><A\nNAME=\"doc-index\"")) > -1 ) {
+ $buf = substr($buf, 0, $indx);
+ $buf .= "\n<\/BODY>\n<\/HTML>\n\n";
+ }
+ $buf =~ s/\&\#13;//g;
+ $buf =~ s/\&\#60;/\&lt;/g;
+ $buf =~ s/\&\#62;/\&gt;/g;
+ $buf =~ s/\&\#8211;/\-/g;
+ $buf =~ s/WIDTH=\"\d\"//g;
+ $buf =~ s/><[\/]*TBODY//g;
+ $buf =~ s/><[\/]*THEAD//g;
+ $buf =~ s/TYPE=\"1\"\n//gim;
+
+ if( $is_article == 0 ) {
+
+ # for books...decrement the headers by 1 and then re-set the
+ # chapter level only to H1...
+ #
+ my($cnt,$j) = 0;
+ for($cnt=5; $cnt > 0; $cnt--) {
+ $j = $cnt + 1;
+ $buf =~ s/<H${cnt}/<H${j}/g;
+ $buf =~ s/<\/H${cnt}/<\/H${j}/g;
+ }
+
+ my(@l) = split(/\n/, $buf);
+ for( $cnt=0; $cnt < (@l + 0); $cnt++ ) {
+
+ if( $j == 1 ) {
+ if( $l[$cnt] =~ /<DIV/ ) {
+ $j = 0;
+ next;
+ }
+ $l[$cnt] =~ s/<H2/<H1/g;
+ $l[$cnt] =~ s/<\/H2/<\/H1/g;
+ }
+ if( $l[$cnt] =~ /^CLASS=\"CHAP/i
+ ||
+ $l[$cnt] =~ /^CLASS=\"PREF/i ) {
+ $j = 1;
+ }
+ }
+
+ $buf = join("\n", @l);
+
+ }
+ $buf =~ s/><DIV\nCLASS="\w+"\n//gms;
+ $buf =~ s/><\/DIV\n//gms;
+ $buf =~ s/(><LI\n)><P\n(.*?)<\/P\n>(<\/LI\n)/$1$2$3/gms;
+
+ print OUT_FILE $buf;
+ close(OUT_FILE);
+
+ return 1;
+}
+
+# Return true from package include
+#
+1;
+
diff --git a/docs/docbook/scripts/ldp_print b/docs/docbook/scripts/ldp_print
new file mode 100755
index 0000000000..70bb801def
--- /dev/null
+++ b/docs/docbook/scripts/ldp_print
@@ -0,0 +1,71 @@
+#!/usr/bin/perl -w
+#
+# usage: ldp_print <single_file.html>
+#
+# Creates a PDF variant of a single-file HTML representation of a
+# DocBook SGML (or XML) instance. This simple wrapper assumes that
+# the file was created using {open}jade in a manner similar to:
+#
+# jade -t sgml -i html -V nochunks -d $style $fname > $fname.html
+#
+# Give this script the filename as an argument. It will then parse
+# the file into 'title.html' and 'body.html' and send each to
+# htmldoc (as the corresponding title page and body of the document).
+#
+#
+# CAVEATS:
+#
+# Assumes perl is in /usr/bin; adjust if necessary
+#
+# You may need to specify where the htmldoc executable resides.
+# The script assumes it's within your $PATH.
+#
+# If you want Postscript as an output variant, uncomment the
+# appropriate lines (see below).
+#
+# Relies on output from a DocBook instance created via DSSSL/{open}jade!
+#
+# Cleans up (removes) the intermediate files it creates (but not the
+# PDF or Postscript files, obviously!)
+#
+# Works silently; PDF (PostScript) will be created in the same directory
+# as was specified for the input (single-file HTML) file.
+#
+# Provided without warranty or support!
+#
+# gferg@sgi.com / Ferg (used as part of the LDP production env)
+#
+
+use strict;
+push(@INC, "./");
+require 'fix_print_html.lib';
+
+if( $ARGV[0] eq '' || !(-r $ARGV[0]) ) {
+ die "\nusage: ldp_print <single_file.html>\n\n";
+}
+
+my($fname_wo_ext) = $ARGV[0];
+$fname_wo_ext =~ s/\.[\w]+$//;
+
+
+# create new files from single HTML file to use for print
+#
+&fix_print_html($ARGV[0], 'body.html', 'title.html');
+
+my($cmd) = "htmldoc --size universal -t pdf -f ${fname_wo_ext}.pdf " .
+ "--firstpage p1 --titlefile title.html body.html";
+
+# For postscript output; append onto the above cmd string:
+#
+# "; htmldoc --size universal -t ps -f -f ${fname_wo_ext}.ps " .
+# "--firstpage p1 --titlefile title.html body.html";
+#
+system($cmd);
+die "\nldp_print: could not create ${fname_wo_ext}.pdf ($!)\n" if ($?);
+
+# cleanup
+#
+system("rm -f body.html title.html");
+
+exit(0);
+
diff --git a/docs/docbook/stylesheets/ldp.dsl.in b/docs/docbook/stylesheets/ldp.dsl.in
new file mode 100644
index 0000000000..d6e06f4b6d
--- /dev/null
+++ b/docs/docbook/stylesheets/ldp.dsl.in
@@ -0,0 +1,256 @@
+<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
+<!ENTITY % html "IGNORE">
+<![%html;[
+<!ENTITY % print "IGNORE">
+<!ENTITY docbook.dsl SYSTEM "@SGML_SHARE@/dsssl/docbook/html/docbook.dsl" CDATA dsssl>
+]]>
+<!ENTITY % print "INCLUDE">
+<![%print;[
+<!ENTITY docbook.dsl SYSTEM "@SGML_SHARE@/dsssl/docbook/print/docbook.dsl" CDATA dsssl>
+]]>
+]>
+
+<style-sheet>
+
+<style-specification id="print" use="docbook">
+<style-specification-body>
+
+;; ==============================
+;; customize the print stylesheet
+;; ==============================
+
+(declare-characteristic preserve-sdata?
+ ;; this is necessary because right now jadetex does not understand
+ ;; symbolic entities, whereas things work well with numeric entities.
+ "UNREGISTERED::James Clark//Characteristic::preserve-sdata?"
+ #f)
+
+(define %generate-article-toc%
+ ;; Should a Table of Contents be produced for Articles?
+ #t)
+
+(define (toc-depth nd)
+ 2)
+
+(define %generate-article-titlepage-on-separate-page%
+ ;; Should the article title page be on a separate page?
+ #t)
+
+(define %section-autolabel%
+ ;; Are sections enumerated?
+ #t)
+
+(define %footnote-ulinks%
+ ;; Generate footnotes for ULinks?
+ #f)
+
+(define %bop-footnotes%
+ ;; Make "bottom-of-page" footnotes?
+ #f)
+
+(define %body-start-indent%
+ ;; Default indent of body text
+ 0pi)
+
+(define %para-indent-firstpara%
+ ;; First line start-indent for the first paragraph
+ 0pt)
+
+(define %para-indent%
+ ;; First line start-indent for paragraphs (other than the first)
+ 0pt)
+
+(define %block-start-indent%
+ ;; Extra start-indent for block-elements
+ 0pt)
+
+(define formal-object-float
+ ;; Do formal objects float?
+ #t)
+
+(define %hyphenation%
+ ;; Allow automatic hyphenation?
+ #t)
+
+(define %admon-graphics%
+ ;; Use graphics in admonitions?
+ #f)
+
+</style-specification-body>
+</style-specification>
+
+
+<!--
+;; ===================================================
+;; customize the html stylesheet; borrowed from Cygnus
+;; at http://sourceware.cygnus.com/ (cygnus-both.dsl)
+;; ===================================================
+-->
+
+<style-specification id="html" use="docbook">
+<style-specification-body>
+
+(declare-characteristic preserve-sdata?
+ ;; this is necessary because right now jadetex does not understand
+ ;; symbolic entities, whereas things work well with numeric entities.
+ "UNREGISTERED::James Clark//Characteristic::preserve-sdata?"
+ #f)
+
+(define %generate-legalnotice-link%
+ ;; put the legal notice in a separate file
+ #t)
+
+(define %admon-graphics-path%
+ ;; use graphics in admonitions, set their
+ "../images/")
+
+(define %admon-graphics%
+ #f)
+
+(define %funcsynopsis-decoration%
+ ;; make funcsynopsis look pretty
+ #t)
+
+(define %html-ext%
+ ;; when producing HTML files, use this extension
+ ".html")
+
+(define %generate-book-toc%
+ ;; Should a Table of Contents be produced for books?
+ #t)
+
+(define %generate-article-toc%
+ ;; Should a Table of Contents be produced for articles?
+ #t)
+
+(define %generate-part-toc%
+ ;; Should a Table of Contents be produced for parts?
+ #t)
+
+(define %generate-book-titlepage%
+ ;; produce a title page for books
+ #t)
+
+(define %generate-article-titlepage%
+ ;; produce a title page for articles
+ #t)
+
+(define (chunk-skip-first-element-list)
+ ;; forces the Table of Contents on separate page
+ '())
+
+(define (list-element-list)
+ ;; fixes bug in Table of Contents generation
+ '())
+
+(define %root-filename%
+ ;; The filename of the root HTML document (e.g, "index").
+ "index")
+
+(define %shade-verbatim%
+ ;; verbatim sections will be shaded if t(rue)
+ #t)
+
+(define %use-id-as-filename%
+ ;; Use ID attributes as name for component HTML files?
+ #t)
+
+(define %graphic-extensions%
+ ;; graphic extensions allowed
+ '("gif" "png" "jpg" "jpeg" "tif" "tiff" "eps" "epsf" ))
+
+(define %graphic-default-extension%
+ "gif")
+
+(define %section-autolabel%
+ ;; For enumerated sections (1.1, 1.1.1, 1.2, etc.)
+ #t)
+
+(define (toc-depth nd)
+ ;; more depth (2 levels) to toc; instead of flat hierarchy
+ ;; 2)
+ 4)
+
+(element emphasis
+ ;; make role=strong equate to bold for emphasis tag
+ (if (equal? (attribute-string "role") "strong")
+ (make element gi: "STRONG" (process-children))
+ (make element gi: "EM" (process-children))))
+
+(define (book-titlepage-recto-elements)
+ ;; elements on a book's titlepage
+ ;; note: added revhistory to the default list
+ (list (normalize "title")
+ (normalize "subtitle")
+ (normalize "graphic")
+ (normalize "mediaobject")
+ (normalize "corpauthor")
+ (normalize "authorgroup")
+ (normalize "author")
+ (normalize "editor")
+ (normalize "copyright")
+ (normalize "revhistory")
+ (normalize "abstract")
+ (normalize "legalnotice")))
+
+(define (article-titlepage-recto-elements)
+ ;; elements on an article's titlepage
+ ;; note: added othercredit to the default list
+ (list (normalize "title")
+ (normalize "subtitle")
+ (normalize "authorgroup")
+ (normalize "author")
+ (normalize "othercredit")
+ (normalize "releaseinfo")
+ (normalize "copyright")
+ (normalize "pubdate")
+ (normalize "revhistory")
+ (normalize "abstract")))
+
+(mode article-titlepage-recto-mode
+
+ (element contrib
+ ;; print out with othercredit information; for translators, etc.
+ (make sequence
+ (make element gi: "SPAN"
+ attributes: (list (list "CLASS" (gi)))
+ (process-children))))
+
+ (element othercredit
+ ;; print out othercredit information; for translators, etc.
+ (let ((author-name (author-string))
+ (author-contrib (select-elements (children (current-node))
+ (normalize "contrib"))))
+ (make element gi: "P"
+ attributes: (list (list "CLASS" (gi)))
+ (make element gi: "B"
+ (literal author-name)
+ (literal " - "))
+ (process-node-list author-contrib))))
+)
+
+(define (article-title nd)
+ (let* ((artchild (children nd))
+ (artheader (select-elements artchild (normalize "artheader")))
+ (artinfo (select-elements artchild (normalize "articleinfo")))
+ (ahdr (if (node-list-empty? artheader)
+ artinfo
+ artheader))
+ (ahtitles (select-elements (children ahdr)
+ (normalize "title")))
+ (artitles (select-elements artchild (normalize "title")))
+ (titles (if (node-list-empty? artitles)
+ ahtitles
+ artitles)))
+ (if (node-list-empty? titles)
+ ""
+ (node-list-first titles))))
+
+
+</style-specification-body>
+</style-specification>
+
+<external-specification id="docbook" document="docbook.dsl">
+
+</style-sheet>
+