OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: Re: DOCBOOK: 400 setup and configs later...


Yep, I'm also perservering through this.  I may be a bit ahead, I do not 
quite understand everything yet, but I do have a configuration that 
works.  It is documented below.  Other than describing how to install 
tetex and openjade as RPM's, it should be rather generic.

Good luck.

This is a hybrid installation where the programs tetex and openjade are
installed from RPM, and the definitions are installed from their source
the remaining definitions installed from their source.

Refs:
http://www.linuxdoc.org/authors/index.html#resources

1.	INSTALLATION
********************

1.1.	Install Tetex
Installed the latest Redhat version, 1.07-27 rpm.  Openjade uses tetex 
macros.  Installed all the tetex packages.

1.2.	Install Openjade.
Installed the latest Redhat version, 1.3.-17 rpm.

1.3.	Install DocBook DTD's
Got DocBook SGML 3.1 and  DocBook SGML 4.1 from
http://www.oasis-open.org/docbook/sgml/index.shtml

Got DocBook XML 4.1.2 from 
http://www.oasis-open.org/docbook/xml/index.shtml

These arrived as zip archives, Unzipped them into
/usr/local/share/docbook/sgml-3.1/ 
/usr/local/share/docbook/sgml-4.1/
/usr/local/share/docbook/xml-4.1.2/
respectively.  

1.4.	Install DocBook Entity Definitions
Got http://www.linuxdoc.org/authors/tools/entities.tar.gz
and un-tgz'd it repeatedly into each of the above DTD 
directories

1.5.	Install DSSSL Stylesheets.
Got the latest (1.72) style sheets and documentation from:
http://sourceforge.net/projects/docbook/

Un-tgz'd the docs in /usr/share/doc/
Un-tgz'd the style sheets in /usr/local/share/docbook/,
it creates a sub-dir /docbook-dsssl-1.72 in both cases

1.6.	Install the LDP Customizations
Got the lastest from: 
http://www.linuxdoc.org/authors/tools/ldp.dsl
Copied this file into /usr/local/share/docbook/ldp

2.	CONFIGURATION
*********************

2.1  Create the following symlinks
cd /usr/local/share/docbook/
ln -s sgml-4.1 sgml
ln -s xml-4.1.2 xml
ln -s docbook-dsssl-1.72 dsssl
cd sgml-3.1
ln -s docbook.cat catalog
cd ../sgml
ln -s docbook.cat catalog
cd ../xml
ln -s docbook.cat catalog
cd /usr/share/sgml
ln -s openjade-1.3 openjade

2.2	Create the following file:

>>>>>>>>>/usr/local/share/docbook/catalog
CATALOG "/usr/share/sgml/openjade/catalog"
CATALOG "/usr/local/share/docbook/dsssl/catalog"
CATALOG "/usr/local/share/docbook/sgml/catalog"
CATALOG "/usr/local/share/docbook/xml/catalog"
CATALOG "/usr/local/share/docbook/sgml-3.1/catalog"
<<<<<<<</usr/local/share/docbook/catalog

2.3	Add the following env variables to startup file
I use bash, so add the following to /etc/profile
-----------
export JADE_HOME=/usr/share/sgml/openjade
export SGML_SHARE=/usr/local/share/docbook
export SGML_CATALOG_FILES=$SGML_SHARE/catalog
-----------

2.4	Apply the LDP customizations
cd /usr/local/share/docbook/dsssl/html
ln -s ../../ldp/ldp.dsl .
cd ../print
ln -s ../../ldp/ldp.dsl .

Log out and in again for env variables to take effect.

3	Validating and Publishing xml or sgml
*********************************************

To validate sgml
nsgmls -sv -c $SGML_CATALOG_FILES <file>.sgml

To validgate xml
nsgmls -sv -c $SGML_CATALOG_FILES $SGML_SHARE/dsssl/dtds/decls/xml.dcl <file>.sgml

The following script creates a tmp_pub subdirectory,
into which it creates a dvi, tex, single html, 
chapterised html, pdf, ps, and txt files.

>>>>>>>>>>/usr/local/bin/publish
#!/bin/sh

FILE=$1

DSL_PRINT="${SGML_SHARE}/dsssl/print/ldp.dsl#print"
DSL_HTML="${SGML_SHARE}/dsssl/html/ldp.dsl#html"

if [ "`echo $FILE | grep \"\.xml$\"`" != "" ] ; then
	EXT=xml
elif [ "`echo $FILE | grep \"\.sgml$\"`" != "" ] ; then
	EXT=sgml
else
	echo "Usage: publish <filename>.{sgml,xml}"
	exit 1
fi

if [ ! -f $FILE ] ; then
	echo "File: $FILE not found"
	exit 2
fi
BASE=`basename $FILE $EXT`
mkdir ${BASE}output > /dev/null 2>&1
cd ${BASE}output
if [ "$?" != "0" ] ; then
        echo "Cannot mkdir or cd to ${BASE}output"
        exit 3
fi

rm -fr *
mkdir chaps
cd chaps

#openjade -t $EXT -E 0 -d $DSL_DOCBOOK ../../$FILE  
openjade -t $EXT-raw -E 0 -d $DSL_HTML ../../$FILE  
mkdir patch
for f in `\ls *.html` ; do
        sed -e 's,<br/>,<br>,g' $f > patch/$f
done
cd ..
openjade -t $EXT -E 0 -V nochunks -V rootchunk= -d $DSL_HTML ../$FILE 
sed -e 's,<br/>,<br>,g' index.html > ${BASE}html

lynx -dump -nolist ${BASE}html > ${BASE}txt

openjade -t rtf -E 0 -d $DSL_PRINT -o ${BASE}rtf ../$FILE  

openjade -t tex -E 0 -d $DSL_PRINT -o ${BASE}tex ../$FILE 

jadetex ${BASE}tex
jadetex ${BASE}tex
jadetex ${BASE}tex
dvips -o ${BASE}ps ${BASE}dvi

pdfjadetex ${BASE}tex
pdfjadetex ${BASE}tex
<<<<<<<</usr/local/bin/publish
 
Execute publish as follows to hide unnecessary warning clutter.

publish harold-config.xml 2>&1 | fgrep -v "DTDDECL catalog entries" | fgrep -v  "omitted tag minimization" | fgrep -v "is not a function name"

4.	CUSTOMIZING LDP.
***********************

I want <screen> and <programlisting> tags to do line numbers, but
the "linenumbering" attribute of these tags do not work.  In my 
case it's okay to permanently have line numbering for these two 
tags.

Add the following to the start of both the print and html sections 
of /usr/local/share/docbook/ldp/ldp.dsl.
------------------------------------------
(define %linenumber-mod% 
  ;; Controls line-number frequency in enumerated environments.
  1)

(define %linenumber-length% 
  ;; Width of line numbers in enumerated environments
  4)

(define %number-programlisting-lines%
  ;; Enumerate lines in a 'ProgramListing'?
  #t)

(define %number-screen-lines%
  ;; Enumerate lines in a 'Screen'?
  #t)
-------------------------------------------

If you do not know what I am talking about, here's the whole
ldp.dsl

>>>>>>>>>>>>>>>>/usr/local/share/docbook/ldp/ldp.dsl

<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY % html "IGNORE">
<![%html;[
<!ENTITY % print "IGNORE">
<!ENTITY docbook.dsl SYSTEM "docbook.dsl" CDATA dsssl>
]]>
<!ENTITY % print "INCLUDE">
<![%print;[
<!ENTITY docbook.dsl SYSTEM "docbook.dsl" CDATA dsssl>
]]>
]>

<style-sheet>

<style-specification id="print" use="docbook">
<style-specification-body> 

;; ==============================
;; customize the print stylesheet
;; ==============================

(define %linenumber-mod% 
  ;; Controls line-number frequency in enumerated environments.
  1)

(define %linenumber-length% 
  ;; Width of line numbers in enumerated environments
  4)

(define %number-programlisting-lines%
  ;; Enumerate lines in a 'ProgramListing'?
  #t)

(define %number-screen-lines%
  ;; Enumerate lines in a 'Screen'?
  #t)

(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> 

(define %linenumber-mod% 
  ;; Controls line-number frequency in enumerated environments.
  1)

(define %linenumber-length% 
  ;; Width of line numbers in enumerated environments
  4)

(define %number-programlisting-lines%
  ;; Enumerate lines in a 'ProgramListing'?
  #t)

(define %number-screen-lines%
  ;; Enumerate lines in a 'Screen'?
  #t)

(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%
  #t)

(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))))


;; Redefinition of $verbatim-display$
;; Origin: dbverb.dsl
;; Different foreground and background colors for verbatim elements
;; Author: Philippe Martin (feloy@free.fr) 2001-04-07

(define ($verbatim-display$ indent line-numbers?)
  (let ((verbatim-element (gi))
        (content (make element gi: "PRE"
                       attributes: (list
                                    (list "CLASS" (gi)))
                       (if (or indent line-numbers?)
                           ($verbatim-line-by-line$ indent line-numbers?)
                           (process-children)))))
    (if %shade-verbatim%
        (make element gi: "TABLE"
              attributes: (shade-verbatim-attr-element verbatim-element)
              (make element gi: "TR"
                    (make element gi: "TD"
                          (make element gi: "FONT" 
                                attributes: (list
                                             (list "COLOR" (car (shade-verbatim-element-colors
                                                                 verbatim-element))))
                                content))))
        content)))

;;
;; Customize this function
;; to change the foreground and background colors
;; of the different verbatim elements
;; Return (list "foreground color" "background color")
;;
(define (shade-verbatim-element-colors element)
  (case element
    (("SYNOPSIS") (list "#000000" "#6495ED"))
    ;; ...
    ;; Add your verbatim elements here
    ;; ...
    (else (list "#000000" "#E0E0E0"))))

(define (shade-verbatim-attr-element element)
  (list
   (list "BORDER" 
	(cond
		((equal? element (normalize "SCREEN")) "1")
		(else "0")))
   (list "BGCOLOR" (car (cdr (shade-verbatim-element-colors element))))
   (list "WIDTH" ($table-width$))))

;; End of $verbatim-display$ redefinition

</style-specification-body>
</style-specification>

<external-specification id="docbook" document="docbook.dsl">

</style-sheet>

<<<<<<<<<<<<<<<<<<</usr/local/share/docbook/ldp/ldp.dsl



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC