2 <!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
4 <!-- must turn on one of these with -i on the jade command line -->
5 <!ENTITY % output-html "IGNORE">
6 <!ENTITY % output-print "IGNORE">
7 <!ENTITY % output-text "IGNORE">
10 <!ENTITY dbstyle PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA DSSSL>
14 <!ENTITY dbstyle PUBLIC "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN" CDATA DSSSL>
18 <!ENTITY dbstyle PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA DSSSL>
24 <style-specification use="docbook">
25 <style-specification-body>
27 <!-- general customization ......................................... -->
29 <!-- (applicable to all output formats) -->
31 (define draft-mode #f)
33 (define pgsql-docs-list "pgsql-docs@postgresql.org")
35 ;; Don't show manpage volume numbers
36 (define %refentry-xref-manvolnum% #f)
38 ;; Don't use graphics for callouts. (We could probably do that, but
39 ;; it needs extra work.)
40 (define %callout-graphics% #f)
42 ;; Show comments during the development stage.
43 (define %show-comments% draft-mode)
45 ;; Don't append period if run-in title ends with any of these
46 ;; characters. We had to add the colon here. This is fixed in
47 ;; stylesheets version 1.71, so it can be removed sometime.
48 (define %content-title-end-punct%
51 ;; No automatic punctuation after honorific name parts
52 (define %honorific-punctuation% "")
54 ;; Change display of some elements
55 (element command ($mono-seq$))
56 (element envar ($mono-seq$))
57 (element lineannotation ($italic-seq$))
58 (element literal ($mono-seq$))
59 (element option ($mono-seq$))
60 (element parameter ($mono-seq$))
61 (element structfield ($mono-seq$))
62 (element structname ($mono-seq$))
63 (element symbol ($mono-seq$))
64 (element token ($mono-seq$))
65 (element type ($mono-seq$))
66 (element varname ($mono-seq$))
67 (element (programlisting emphasis) ($bold-seq$)) ;; to highlight sections of code
69 ;; Special support for Tcl synopses
71 (if (equal? (attribute-string (normalize "role")) "tcl")
77 (literal %arg-choice-opt-open-str%)
79 (literal %arg-choice-opt-close-str%))))
81 ;; Avoid excessive cross-reference labels
82 (define (auto-xref-indirect? target ancestor)
84 ; ;; Always add indirect references to another book
85 ; ((member (gi ancestor) (book-element-list))
87 ;; Add indirect references to the section or component a block
88 ;; is in iff chapters aren't autolabelled. (Otherwise "Figure 1-3"
90 ((and (member (gi target) (block-element-list))
91 (not %chapter-autolabel%))
93 ;; Add indirect references to the component a section is in if
94 ;; the sections are not autolabelled
95 ((and (member (gi target) (section-element-list))
96 (member (gi ancestor) (component-element-list))
97 (not %section-autolabel%))
102 ;; Bibliography things
104 ;; Use the titles of bibliography entries in cross-references
105 (define biblio-xref-title #t)
107 ;; Process bibliography entry components in the order shown below, not
108 ;; in the order they appear in the document. (I suppose this should
109 ;; be made to fit some publishing standard.)
110 (define %biblioentry-in-entry-order% #f)
112 (define (biblioentry-inline-elements)
115 (normalize "authorgroup")
117 (normalize "subtitle")
118 (normalize "volumenum")
119 (normalize "edition")
120 (normalize "othercredit")
121 (normalize "contrib")
123 (normalize "publishername")
124 (normalize "confgroup")
125 (normalize "publisher")
128 (normalize "pubsnumber")
130 (normalize "pubdate")
131 (normalize "pagenums")
132 (normalize "bibliomisc")))
134 (mode biblioentry-inline-mode
149 (process-children))))
152 ;; The rules in the default stylesheet for productname format it as a
153 ;; paragraph. This may be suitable for productname directly within
154 ;; *info, but it's nonsense when productname is used inline, as we do.
155 (mode set-titlepage-recto-mode
156 (element (para productname) ($charseq$)))
157 (mode set-titlepage-verso-mode
158 (element (para productname) ($charseq$)))
159 (mode book-titlepage-recto-mode
160 (element (para productname) ($charseq$)))
161 (mode book-titlepage-verso-mode
162 (element (para productname) ($charseq$)))
163 ;; Add more here if needed...
166 <!-- HTML output customization ..................................... -->
170 (define %section-autolabel% #t)
171 (define %label-preface-sections% #f)
172 (define %generate-legalnotice-link% #t)
173 (define %html-ext% ".html")
174 (define %root-filename% "index")
175 (define %link-mailto-url% (string-append "mailto:" pgsql-docs-list))
176 (define %use-id-as-filename% #t)
177 (define %stylesheet% "stylesheet.css")
178 (define %graphic-default-extension% "gif")
179 (define %gentext-nav-use-ff% #t)
180 (define %body-attr% '())
181 (define ($generate-book-lot-list$) '())
183 ;; Do not combine first section into chapter chunk.
184 (define (chunk-skip-first-element-list) '())
186 ;; Returns the depth of auto TOC that should be made at the nd-level
187 (define (toc-depth nd)
188 (cond ((string=? (gi nd) (normalize "book")) 2)
189 ((string=? (gi nd) (normalize "set")) 2)
190 ((string=? (gi nd) (normalize "part")) 2)
191 ((string=? (gi nd) (normalize "chapter")) 2)
194 ;; Put a horizontal line in the set TOC (just like the book TOC looks)
195 (define (set-titlepage-separator side)
196 (if (equal? side 'recto)
197 (make empty-element gi: "HR")
200 ;; Add character encoding and time of creation into HTML header
201 (define %html-header-tags%
202 (list (list "META" '("HTTP-EQUIV" "Content-Type") '("CONTENT" "text/html; charset=ISO-8859-1"))
203 (list "META" '("NAME" "creation") (list "CONTENT" (time->string (time) #t)))))
206 (define html-index #t)
209 ;; Block elements are allowed in PARA in DocBook, but not in P in
210 ;; HTML. With %fix-para-wrappers% turned on, the stylesheets attempt
211 ;; to avoid putting block elements in HTML P tags by outputting
212 ;; additional end/begin P pairs around them.
213 (define %fix-para-wrappers% #t)
215 ;; ...but we need to do some extra work to make the above apply to PRE
216 ;; as well. (mostly pasted from dbverb.dsl)
217 (define ($verbatim-display$ indent line-numbers?)
218 (let ((content (make element gi: "PRE"
221 (if (or indent line-numbers?)
222 ($verbatim-line-by-line$ indent line-numbers?)
223 (process-children)))))
225 (make element gi: "TABLE"
226 attributes: ($shade-verbatim-attr$)
227 (make element gi: "TR"
228 (make element gi: "TD"
233 (para-check 'restart)))))
240 (para-check 'restart)))
242 ;;; XXX The above is very ugly. It might be better to run 'tidy' on
243 ;;; the resulting *.html files.
246 ;; Format multiple terms in varlistentry vertically, instead
247 ;; of comma-separated.
248 (element (varlistentry term)
250 (process-children-trim)
251 (if (not (last-sibling?))
252 (make empty-element gi: "BR")
255 ]]> <!-- %output-html -->
258 <!-- Print output customization .................................... -->
262 (define %section-autolabel% #t)
263 (define %default-quadding% 'justify)
265 ;; Don't know how well hyphenation works with other backends. Might
266 ;; turn this on if desired.
267 (define %hyphenation%
268 (if tex-backend #t #f))
270 ;; Put footnotes at the bottom of the page (rather than end of
271 ;; section), and put the URLs of links into footnotes.
273 ;; bop-footnotes only works with TeX, otherwise it's ignored. But
274 ;; when both of these are #t and TeX is used, you need at least
275 ;; stylesheets 1.73 because otherwise you don't get any footnotes at
276 ;; all for the links.
277 (define bop-footnotes #t)
278 (define %footnote-ulinks% #t)
280 (define %refentry-new-page% #t)
281 (define %refentry-keep% #f)
283 ;; Disabled because of TeX problems
284 ;; (http://archives.postgresql.org/pgsql-docs/2007-12/msg00056.php)
285 (define ($generate-book-lot-list$) '())
287 ;; Indentation of verbatim environments. (This should really be done
288 ;; with start-indent in DSSSL.)
289 ;; Use of indentation in this area exposes a bug in openjade,
290 ;; http://archives.postgresql.org/pgsql-docs/2006-12/msg00064.php
291 ;; (define %indent-programlisting-lines% " ")
292 ;; (define %indent-screen-lines% " ")
293 ;; (define %indent-synopsis-lines% " ")
296 ;; Default graphic format: Jadetex wants eps, pdfjadetex wants pdf.
297 ;; (Note that pdfjadetex will not accept eps, that's why we need to
298 ;; create a different .tex file for each.) What works with RTF?
300 (define texpdf-output #f) ;; override from command line
302 (define %graphic-default-extension%
303 (cond (tex-backend (if texpdf-output "pdf" "eps"))
307 ;; Need to add pdf here so that the above works. Default setup
308 ;; doesn't know about PDF.
309 (define preferred-mediaobject-extensions
310 (list "eps" "ps" "jpg" "jpeg" "pdf" "png"))
313 ;; Don't show links when citing a bibliography entry. This fouls up
314 ;; the footnumber counting. To get the link, one can still look into
315 ;; the bibliography itself.
316 (mode xref-title-mode
321 ;; Format legalnotice justified and with space between paragraphs.
322 (mode book-titlepage-verso-mode
323 (element (legalnotice para)
325 use: book-titlepage-verso-style ;; alter this if ever it needs to appear elsewhere
326 quadding: %default-quadding%
327 line-spacing: (* 0.8 (inherited-line-spacing))
328 font-size: (* 0.8 (inherited-font-size))
329 space-before: (* 0.8 %para-sep%)
330 space-after: (* 0.8 %para-sep%)
331 first-line-start-indent: (if (is-first-para)
332 (* 0.8 %para-indent-firstpara%)
333 (* 0.8 %para-indent%))
334 (process-children))))
337 ;; Fix spacing problems in variablelists
339 (element (varlistentry term)
341 space-before: (if (first-sibling?)
347 (define %varlistentry-indent% 2em)
349 (element (varlistentry listitem)
351 start-indent: (+ (inherited-start-indent) %varlistentry-indent%)
355 ;; Whitespace fixes for itemizedlists and orderedlists
357 (define (process-listitem-content)
358 (if (absolute-first-sibling?)
360 (process-children-trim))
364 ;; Default stylesheets format simplelists as tables. This spells
365 ;; trouble for Jade. So we just format them as plain lines.
367 (define %simplelist-indent% 1em)
369 (define (my-simplelist-vert members)
371 space-before: %para-sep%
372 space-after: %para-sep%
373 start-indent: (+ %simplelist-indent% (inherited-start-indent))
377 (let ((type (attribute-string (normalize "type")))
378 (cols (if (attribute-string (normalize "columns"))
379 (if (> (string->number (attribute-string (normalize "columns"))) 0)
380 (string->number (attribute-string (normalize "columns")))
383 (members (select-elements (children (current-node)) (normalize "member"))))
385 ((equal? type (normalize "inline"))
386 (if (equal? (gi (parent (current-node)))
390 space-before: %para-sep%
391 space-after: %para-sep%
392 start-indent: (inherited-start-indent))))
393 ((equal? type (normalize "vert"))
394 (my-simplelist-vert members))
395 ((equal? type (normalize "horiz"))
396 (simplelist-table 'row cols members)))))
399 (let ((type (inherited-attribute-string (normalize "type"))))
401 ((equal? type (normalize "inline"))
404 (if (not (last-sibling?))
407 ((equal? type (normalize "vert"))
411 ((equal? type (normalize "horiz"))
414 (process-children))))))
417 ;; Jadetex doesn't handle links to the content of tables, so
418 ;; indexterms that point to table entries will go nowhere. We fix
419 ;; this by pointing the index entry to the table itself instead, which
420 ;; should be equally useful in practice.
422 (define (find-parent-table nd)
423 (let ((table (ancestor-member nd ($table-element-list$))))
424 (if (node-list-empty? table)
428 ;; (The function below overrides the one in print/dbindex.dsl.)
430 (define (indexentry-link nd)
431 (let* ((id (attribute-string (normalize "role") nd))
432 (prelim-target (find-indexterm id))
433 (target (find-parent-table prelim-target))
434 (preferred (not (node-list-empty?
435 (select-elements (children (current-node))
436 (normalize "emphasis")))))
437 (sosofo (if (node-list-empty? target)
440 destination: (node-list-address target)
441 (with-mode toc-page-number-mode
442 (process-node-list target))))))
450 ;; By default, the part and reference title pages get wrong page
451 ;; numbers: The first title page gets roman numerals carried over from
452 ;; preface/toc -- we want arabic numerals. We also need to make sure
453 ;; that page-number-restart is set of #f explicitly, because otherwise
454 ;; it will carry over from the previous component, which is not good.
456 ;; (This looks worse than it is. It's copied from print/dbttlpg.dsl
457 ;; and common/dbcommon.dsl and modified in minor detail.)
459 (define (first-part?)
460 (let* ((book (ancestor (normalize "book")))
461 (nd (ancestor-member (current-node)
463 (component-element-list)
464 (division-element-list))))
465 (bookch (children book)))
466 (let loop ((nl bookch))
467 (if (node-list-empty? nl)
469 (if (equal? (gi (node-list-first nl)) (normalize "part"))
470 (if (node-list=? (node-list-first nl) nd)
473 (loop (node-list-rest nl)))))))
475 (define (first-reference?)
476 (let* ((book (ancestor (normalize "book")))
477 (nd (ancestor-member (current-node)
479 (component-element-list)
480 (division-element-list))))
481 (bookch (children book)))
482 (let loop ((nl bookch))
483 (if (node-list-empty? nl)
485 (if (equal? (gi (node-list-first nl)) (normalize "reference"))
486 (if (node-list=? (node-list-first nl) nd)
489 (loop (node-list-rest nl)))))))
492 (define (part-titlepage elements #!optional (side 'recto))
493 (let ((nodelist (titlepage-nodelist
494 (if (equal? side 'recto)
495 (reference-titlepage-recto-elements)
496 (reference-titlepage-verso-elements))
498 ;; partintro is a special case...
499 (partintro (node-list-first
500 (node-list-filter-by-gi elements (list (normalize "partintro"))))))
501 (if (part-titlepage-content? elements side)
502 (make simple-page-sequence
503 page-n-columns: %titlepage-n-columns%
504 ;; Make sure that page number format is correct.
505 page-number-format: ($page-number-format$)
506 ;; Make sure that the page number is set to 1 if this is the
507 ;; first part in the book
508 page-number-restart?: (first-part?)
509 input-whitespace-treatment: 'collapse
510 use: default-text-style
512 ;; This hack is required for the RTF backend. If an external-graphic
513 ;; is the first thing on the page, RTF doesn't seem to do the right
514 ;; thing (the graphic winds up on the baseline of the first line
515 ;; of the page, left justified). This "one point rule" fixes
521 (let loop ((nl nodelist) (lastnode (empty-node-list)))
522 (if (node-list-empty? nl)
525 (if (or (node-list-empty? lastnode)
526 (not (equal? (gi (node-list-first nl))
528 (part-titlepage-before (node-list-first nl) side)
531 ((equal? (gi (node-list-first nl)) (normalize "subtitle"))
532 (part-titlepage-subtitle (node-list-first nl) side))
533 ((equal? (gi (node-list-first nl)) (normalize "title"))
534 (part-titlepage-title (node-list-first nl) side))
536 (part-titlepage-default (node-list-first nl) side)))
537 (loop (node-list-rest nl) (node-list-first nl)))))
539 (if (and %generate-part-toc%
540 %generate-part-toc-on-titlepage%
541 (equal? side 'recto))
543 (build-toc (current-node)
544 (toc-depth (current-node))))
547 ;; PartIntro is a special case
548 (if (and (equal? side 'recto)
549 (not (node-list-empty? partintro))
550 %generate-partintro-on-titlepage%)
551 ($process-partintro$ partintro #f)
557 (define (reference-titlepage elements #!optional (side 'recto))
558 (let ((nodelist (titlepage-nodelist
559 (if (equal? side 'recto)
560 (reference-titlepage-recto-elements)
561 (reference-titlepage-verso-elements))
563 ;; partintro is a special case...
564 (partintro (node-list-first
565 (node-list-filter-by-gi elements (list (normalize "partintro"))))))
566 (if (reference-titlepage-content? elements side)
567 (make simple-page-sequence
568 page-n-columns: %titlepage-n-columns%
569 ;; Make sure that page number format is correct.
570 page-number-format: ($page-number-format$)
571 ;; Make sure that the page number is set to 1 if this is the
572 ;; first part in the book
573 page-number-restart?: (first-reference?)
574 input-whitespace-treatment: 'collapse
575 use: default-text-style
577 ;; This hack is required for the RTF backend. If an external-graphic
578 ;; is the first thing on the page, RTF doesn't seem to do the right
579 ;; thing (the graphic winds up on the baseline of the first line
580 ;; of the page, left justified). This "one point rule" fixes
586 (let loop ((nl nodelist) (lastnode (empty-node-list)))
587 (if (node-list-empty? nl)
590 (if (or (node-list-empty? lastnode)
591 (not (equal? (gi (node-list-first nl))
593 (reference-titlepage-before (node-list-first nl) side)
596 ((equal? (gi (node-list-first nl)) (normalize "author"))
597 (reference-titlepage-author (node-list-first nl) side))
598 ((equal? (gi (node-list-first nl)) (normalize "authorgroup"))
599 (reference-titlepage-authorgroup (node-list-first nl) side))
600 ((equal? (gi (node-list-first nl)) (normalize "corpauthor"))
601 (reference-titlepage-corpauthor (node-list-first nl) side))
602 ((equal? (gi (node-list-first nl)) (normalize "editor"))
603 (reference-titlepage-editor (node-list-first nl) side))
604 ((equal? (gi (node-list-first nl)) (normalize "subtitle"))
605 (reference-titlepage-subtitle (node-list-first nl) side))
606 ((equal? (gi (node-list-first nl)) (normalize "title"))
607 (reference-titlepage-title (node-list-first nl) side))
609 (reference-titlepage-default (node-list-first nl) side)))
610 (loop (node-list-rest nl) (node-list-first nl)))))
612 (if (and %generate-reference-toc%
613 %generate-reference-toc-on-titlepage%
614 (equal? side 'recto))
616 (build-toc (current-node)
617 (toc-depth (current-node))))
620 ;; PartIntro is a special case
621 (if (and (equal? side 'recto)
622 (not (node-list-empty? partintro))
623 %generate-partintro-on-titlepage%)
624 ($process-partintro$ partintro #f)
629 ]]> <!-- %output-print -->
632 <!-- Plain text output customization ............................... -->
635 This is used for making the INSTALL file and others. We customize the
636 HTML stylesheets to be suitable for dumping plain text (via Netscape,
642 (define %section-autolabel% #f)
643 (define %chapter-autolabel% #f)
644 (define $generate-chapter-toc$ (lambda () #f))
646 ;; For text output, produce "ASCII markup" for emphasis and such.
648 (define ($asterix-seq$ #!optional (sosofo (process-children)))
654 (define ($dquote-seq$ #!optional (sosofo (process-children)))
656 (literal (gentext-start-quote))
658 (literal (gentext-end-quote))))
660 (element (para command) ($dquote-seq$))
661 (element (para emphasis) ($asterix-seq$))
662 (element (para filename) ($dquote-seq$))
663 (element (para option) ($dquote-seq$))
664 (element (para replaceable) ($dquote-seq$))
665 (element (para userinput) ($dquote-seq$))
667 ]]> <!-- %output-text -->
669 </style-specification-body>
670 </style-specification>
672 <external-specification id="docbook" document="dbstyle">