1<!-- doc/src/sgml/stylesheet.dsl -->
2<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
3
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">
8
9<![ %output-html; [
10<!ENTITY dbstyle PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA DSSSL>
11]]>
12
13<![ %output-print; [
14<!ENTITY dbstyle PUBLIC "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN" CDATA DSSSL>
15]]>
16
17<![ %output-text; [
18<!ENTITY dbstyle PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA DSSSL>
19]]>
20
21]>
22
23<style-sheet>
24 <style-specification use="docbook">
25  <style-specification-body>
26
27<!-- general customization ......................................... -->
28
29<!-- (applicable to all output formats) -->
30
31(define draft-mode              #f)
32
33;; Don't show manpage volume numbers
34(define %refentry-xref-manvolnum% #f)
35
36;; Don't use graphics for callouts.  (We could probably do that, but
37;; it needs extra work.)
38(define %callout-graphics%      #f)
39
40;; Show comments during the development stage.
41(define %show-comments%         draft-mode)
42
43;; Force a chapter TOC even if it includes only a single entry
44(define %force-chapter-toc% #t)
45
46;; Don't append period if run-in title ends with any of these
47;; characters.  We had to add the colon here.  This is fixed in
48;; stylesheets version 1.71, so it can be removed sometime.
49(define %content-title-end-punct%
50  '(#\. #\! #\? #\:))
51
52;; No automatic punctuation after honorific name parts
53(define %honorific-punctuation% "")
54
55;; Change display of some elements
56(element command ($mono-seq$))
57(element envar ($mono-seq$))
58(element lineannotation ($italic-seq$))
59(element literal ($mono-seq$))
60(element option ($mono-seq$))
61(element parameter ($mono-seq$))
62(element structfield ($mono-seq$))
63(element structname ($mono-seq$))
64(element symbol ($mono-seq$))
65(element token ($mono-seq$))
66(element type ($mono-seq$))
67(element varname ($mono-seq$))
68(element (programlisting emphasis) ($bold-seq$)) ;; to highlight sections of code
69
70;; Special support for Tcl synopses
71(element optional
72  (if (equal? (attribute-string (normalize "role")) "tcl")
73      (make sequence
74        (literal "?")
75        ($charseq$)
76        (literal "?"))
77      (make sequence
78        (literal %arg-choice-opt-open-str%)
79        ($charseq$)
80        (literal %arg-choice-opt-close-str%))))
81
82;; Avoid excessive cross-reference labels
83(define (auto-xref-indirect? target ancestor)
84  (cond
85;   ;; Always add indirect references to another book
86;   ((member (gi ancestor) (book-element-list))
87;    #t)
88   ;; Add indirect references to the section or component a block
89   ;; is in iff chapters aren't autolabelled.  (Otherwise "Figure 1-3"
90   ;; is sufficient)
91   ((and (member (gi target) (block-element-list))
92         (not %chapter-autolabel%))
93    #t)
94   ;; Add indirect references to the component a section is in if
95   ;; the sections are not autolabelled
96   ((and (member (gi target) (section-element-list))
97         (member (gi ancestor) (component-element-list))
98         (not %section-autolabel%))
99    #t)
100   (else #f)))
101
102
103;; Bibliography things
104
105;; Use the titles of bibliography entries in cross-references
106(define biblio-xref-title       #t)
107
108;; Process bibliography entry components in the order shown below, not
109;; in the order they appear in the document.  (I suppose this should
110;; be made to fit some publishing standard.)
111(define %biblioentry-in-entry-order% #f)
112
113(define (biblioentry-inline-elements)
114  (list
115   (normalize "author")
116   (normalize "authorgroup")
117   (normalize "title")
118   (normalize "subtitle")
119   (normalize "volumenum")
120   (normalize "edition")
121   (normalize "othercredit")
122   (normalize "contrib")
123   (normalize "editor")
124   (normalize "publishername")
125   (normalize "confgroup")
126   (normalize "publisher")
127   (normalize "isbn")
128   (normalize "issn")
129   (normalize "pubsnumber")
130   (normalize "date")
131   (normalize "pubdate")
132   (normalize "pagenums")
133   (normalize "bibliomisc")))
134
135(mode biblioentry-inline-mode
136
137  (element confgroup
138    (make sequence
139      (literal "Proc. ")
140      (next-match)))
141
142  (element isbn
143    (make sequence
144      (literal "ISBN ")
145      (process-children)))
146
147  (element issn
148    (make sequence
149      (literal "ISSN ")
150      (process-children))))
151
152
153;; The rules in the default stylesheet for productname format it as a
154;; paragraph.  This may be suitable for productname directly within
155;; *info, but it's nonsense when productname is used inline, as we do.
156(mode book-titlepage-recto-mode
157  (element (para productname) ($charseq$)))
158(mode book-titlepage-verso-mode
159  (element (para productname) ($charseq$)))
160;; Add more here if needed...
161
162
163;; Replace a sequence of whitespace in a string by a single space
164(define (normalize-whitespace str #!optional (whitespace '(#\space #\U-000D)))
165  (let loop ((characters (string->list str))
166             (result '())
167             (prev-was-space #f))
168    (if (null? characters)
169        (list->string (reverse result))
170        (let ((c (car characters))
171              (rest (cdr characters)))
172          (if (member c whitespace)
173              (if prev-was-space
174                  (loop rest result #t)
175                  (loop rest (cons #\space result) #t))
176              (loop rest (cons c result) #f))))))
177
178
179<!-- HTML output customization ..................................... -->
180
181<![ %output-html; [
182
183(define %section-autolabel%     #t)
184(define %label-preface-sections% #f)
185(define %generate-legalnotice-link% #t)
186(define %html-ext%              ".html")
187(define %root-filename%         "index")
188(define %link-mailto-url%       (string-append "mailto: repmgr-list@2ndquadrant.com"))
189(define %use-id-as-filename%    #t)
190(define website-build           #f)
191(define %stylesheet%            (if website-build "/resources/docs.css" "website-docs.css"))
192(define %graphic-default-extension% "gif")
193(define %body-attr%             '())
194(define ($generate-book-lot-list$) '())
195(define use-output-dir          #t)
196(define %output-dir%            "html")
197(define html-index-filename     "../HTML.index")
198
199
200;; Only build HTML.index or the actual HTML output, not both.  Saves a
201;; *lot* of time.  (overrides docbook.dsl)
202(root
203   (if (not html-index)
204       (make sequence
205         (process-children)
206         (with-mode manifest
207           (process-children)))
208       (with-mode htmlindex
209         (process-children))))
210
211
212;; Do not combine first section into chapter chunk.
213(define (chunk-skip-first-element-list) '())
214
215;; Returns the depth of auto TOC that should be made at the nd-level
216(define (toc-depth nd)
217  (cond ((string=? (gi nd) (normalize "book")) 2)
218        ((string=? (gi nd) (normalize "part")) 2)
219        ((string=? (gi nd) (normalize "chapter")) 2)
220        (else 1)))
221
222;; Add character encoding and time of creation into HTML header
223(define %html-header-tags%
224  (list (list "META" '("HTTP-EQUIV" "Content-Type") '("CONTENT" "text/html; charset=ISO-8859-1"))
225        (list "META" '("NAME" "creation") (list "CONTENT" (time->string (time) #t)))))
226
227
228;; Block elements are allowed in PARA in DocBook, but not in P in
229;; HTML.  With %fix-para-wrappers% turned on, the stylesheets attempt
230;; to avoid putting block elements in HTML P tags by outputting
231;; additional end/begin P pairs around them.
232(define %fix-para-wrappers% #t)
233
234;; ...but we need to do some extra work to make the above apply to PRE
235;; as well.  (mostly pasted from dbverb.dsl)
236(define ($verbatim-display$ indent line-numbers?)
237  (let ((content (make element gi: "PRE"
238                       attributes: (list
239                                    (list "CLASS" (gi)))
240                       (if (or indent line-numbers?)
241                           ($verbatim-line-by-line$ indent line-numbers?)
242                           (process-children)))))
243    (if %shade-verbatim%
244        (make element gi: "TABLE"
245              attributes: ($shade-verbatim-attr$)
246              (make element gi: "TR"
247                    (make element gi: "TD"
248                          content)))
249        (make sequence
250          (para-check)
251          content
252          (para-check 'restart)))))
253
254;; ...and for notes.
255(element note
256  (make sequence
257    (para-check)
258    ($admonition$)
259    (para-check 'restart)))
260
261;;; XXX The above is very ugly.  It might be better to run 'tidy' on
262;;; the resulting *.html files.
263
264
265;; Format multiple terms in varlistentry vertically, instead
266;; of comma-separated.
267(element (varlistentry term)
268  (make sequence
269    (process-children-trim)
270    (if (not (last-sibling?))
271        (make empty-element gi: "BR")
272        (empty-sosofo))))
273
274
275;; Customization of header
276;; - make title a link to the home page
277;; - add tool tips to Prev/Next links
278;; - add Up link
279;; (overrides dbnavig.dsl)
280(define (default-header-nav-tbl-noff elemnode prev next prevsib nextsib)
281  (let* ((r1? (nav-banner? elemnode))
282         (r1-sosofo (make element gi: "TR"
283                          (make element gi: "TH"
284                                attributes: (list
285                                             (list "COLSPAN" "4")
286                                             (list "ALIGN" "center")
287                                             (list "VALIGN" "bottom"))
288                                (make element gi: "A"
289                                      attributes: (list
290                                                   (list "HREF" (href-to (nav-home elemnode))))
291                                      (nav-banner elemnode)))))
292         (r2? (or (not (node-list-empty? prev))
293                  (not (node-list-empty? next))
294                  (nav-context? elemnode)))
295         (r2-sosofo (make element gi: "TR"
296                          (make element gi: "TD"
297                                attributes: (list
298                                             (list "WIDTH" "10%")
299                                             (list "ALIGN" "left")
300                                             (list "VALIGN" "top"))
301                                (if (node-list-empty? prev)
302                                    (make entity-ref name: "nbsp")
303                                    (make element gi: "A"
304                                          attributes: (list
305                                                       (list "TITLE" (element-title-string prev))
306                                                       (list "HREF"
307                                                             (href-to
308                                                              prev))
309                                                       (list "ACCESSKEY"
310                                                             "P"))
311                                          (gentext-nav-prev prev))))
312                          (make element gi: "TD"
313                                attributes: (list
314                                             (list "WIDTH" "10%")
315                                             (list "ALIGN" "left")
316                                             (list "VALIGN" "top"))
317                                (if (nav-up? elemnode)
318                                    (nav-up elemnode)
319                                    (nav-home-link elemnode)))
320                          (make element gi: "TD"
321                                attributes: (list
322                                             (list "WIDTH" "60%")
323                                             (list "ALIGN" "center")
324                                             (list "VALIGN" "bottom"))
325                                (nav-context elemnode))
326                          (make element gi: "TD"
327                                attributes: (list
328                                             (list "WIDTH" "20%")
329                                             (list "ALIGN" "right")
330                                             (list "VALIGN" "top"))
331                                (if (node-list-empty? next)
332                                    (make entity-ref name: "nbsp")
333                                    (make element gi: "A"
334                                          attributes: (list
335                                                       (list "TITLE" (element-title-string next))
336                                                       (list "HREF"
337                                                             (href-to
338                                                              next))
339                                                       (list "ACCESSKEY"
340                                                             "N"))
341                                          (gentext-nav-next next)))))))
342    (if (or r1? r2?)
343        (make element gi: "DIV"
344              attributes: '(("CLASS" "NAVHEADER"))
345          (make element gi: "TABLE"
346                attributes: (list
347                             (list "SUMMARY" "Header navigation table")
348                             (list "WIDTH" %gentext-nav-tblwidth%)
349                             (list "BORDER" "0")
350                             (list "CELLPADDING" "0")
351                             (list "CELLSPACING" "0"))
352                (if r1? r1-sosofo (empty-sosofo))
353                (if r2? r2-sosofo (empty-sosofo)))
354          (make empty-element gi: "HR"
355                attributes: (list
356                             (list "ALIGN" "LEFT")
357                             (list "WIDTH" %gentext-nav-tblwidth%))))
358        (empty-sosofo))))
359
360
361;; Put index "quicklinks" (A | B | C | ...) at the top of the bookindex page.
362
363(element index
364  (let ((preamble (node-list-filter-by-not-gi
365                   (children (current-node))
366                   (list (normalize "indexentry"))))
367        (indexdivs  (node-list-filter-by-gi
368                     (children (current-node))
369                     (list (normalize "indexdiv"))))
370        (entries  (node-list-filter-by-gi
371                   (children (current-node))
372                   (list (normalize "indexentry")))))
373    (html-document
374     (with-mode head-title-mode
375       (literal (element-title-string (current-node))))
376     (make element gi: "DIV"
377           attributes: (list (list "CLASS" (gi)))
378           ($component-separator$)
379           ($component-title$)
380           (if (node-list-empty? indexdivs)
381               (empty-sosofo)
382               (make element gi: "P"
383                     attributes: (list (list "CLASS" "INDEXDIV-QUICKLINKS"))
384                     (with-mode indexdiv-quicklinks-mode
385                       (process-node-list indexdivs))))
386           (process-node-list preamble)
387           (if (node-list-empty? entries)
388               (empty-sosofo)
389               (make element gi: "DL"
390                     (process-node-list entries)))))))
391
392
393(mode indexdiv-quicklinks-mode
394  (element indexdiv
395    (make sequence
396      (make element gi: "A"
397            attributes: (list (list "HREF" (href-to (current-node))))
398            (element-title-sosofo))
399      (if (not (last-sibling?))
400          (literal " | ")
401          (literal "")))))
402
403
404;; Changed to strip and normalize index term content (overrides
405;; dbindex.dsl)
406(define (htmlindexterm)
407  (let* ((attr    (gi (current-node)))
408         (content (data (current-node)))
409         (string  (strip (normalize-whitespace content))) ;; changed
410         (sortas  (attribute-string (normalize "sortas"))))
411    (make sequence
412      (make formatting-instruction data: attr)
413      (if sortas
414          (make sequence
415            (make formatting-instruction data: "[")
416            (make formatting-instruction data: sortas)
417            (make formatting-instruction data: "]"))
418          (empty-sosofo))
419      (make formatting-instruction data: " ")
420      (make formatting-instruction data: string)
421      (htmlnewline))))
422
423(define ($html-body-start$)
424        (if website-build
425            (make empty-element gi: "!--#include virtual=\"/resources/docs-header.html\"--")
426            (empty-sosofo)))
427
428(define ($html-body-end$)
429        (if website-build
430            (make empty-element gi: "!--#include virtual=\"/resources/docs-footer.html\"--")
431            (empty-sosofo)))
432
433]]> <!-- %output-html -->
434
435
436<!-- Print output customization .................................... -->
437
438<![ %output-print; [
439
440(define %section-autolabel%     #t)
441(define %default-quadding%      'justify)
442
443;; Don't know how well hyphenation works with other backends.  Might
444;; turn this on if desired.
445(define %hyphenation%
446  (if tex-backend #t #f))
447
448;; Put footnotes at the bottom of the page (rather than end of
449;; section), and put the URLs of links into footnotes.
450;;
451;; bop-footnotes only works with TeX, otherwise it's ignored.  But
452;; when both of these are #t and TeX is used, you need at least
453;; stylesheets 1.73 because otherwise you don't get any footnotes at
454;; all for the links.
455(define bop-footnotes           #t)
456(define %footnote-ulinks%       #t)
457
458(define %refentry-new-page%     #t)
459(define %refentry-keep%         #f)
460
461;; Disabled because of TeX problems
462;; (http://archives.postgresql.org/pgsql-docs/2007-12/msg00056.php)
463(define ($generate-book-lot-list$) '())
464
465;; Indentation of verbatim environments.  (This should really be done
466;; with start-indent in DSSSL.)
467;; Use of indentation in this area exposes a bug in openjade,
468;; http://archives.postgresql.org/pgsql-docs/2006-12/msg00064.php
469;; (define %indent-programlisting-lines% "    ")
470;; (define %indent-screen-lines% "    ")
471;; (define %indent-synopsis-lines% "    ")
472
473
474;; Default graphic format: Jadetex wants eps, pdfjadetex wants pdf.
475;; (Note that pdfjadetex will not accept eps, that's why we need to
476;; create a different .tex file for each.)  What works with RTF?
477
478(define texpdf-output #f) ;; override from command line
479
480(define %graphic-default-extension%
481  (cond (tex-backend (if texpdf-output "pdf" "eps"))
482        (rtf-backend "gif")
483        (else "XXX")))
484
485;; Need to add pdf here so that the above works.  Default setup
486;; doesn't know about PDF.
487(define preferred-mediaobject-extensions
488  (list "eps" "ps" "jpg" "jpeg" "pdf" "png"))
489
490
491;; Don't show links when citing a bibliography entry.  This fouls up
492;; the footnumber counting.  To get the link, one can still look into
493;; the bibliography itself.
494(mode xref-title-mode
495  (element ulink
496    (process-children)))
497
498
499;; Format legalnotice justified and with space between paragraphs.
500(mode book-titlepage-verso-mode
501  (element (legalnotice para)
502    (make paragraph
503      use: book-titlepage-verso-style   ;; alter this if ever it needs to appear elsewhere
504      quadding: %default-quadding%
505      line-spacing: (* 0.8 (inherited-line-spacing))
506      font-size: (* 0.8 (inherited-font-size))
507      space-before: (* 0.8 %para-sep%)
508      space-after: (* 0.8 %para-sep%)
509      first-line-start-indent: (if (is-first-para)
510                                   (* 0.8 %para-indent-firstpara%)
511                                   (* 0.8 %para-indent%))
512      (process-children))))
513
514
515;; Fix spacing problems in variablelists
516
517(element (varlistentry term)
518  (make paragraph
519    space-before: (if (first-sibling?)
520                      %para-sep%
521                      0pt)
522    keep-with-next?: #t
523    (process-children)))
524
525(define %varlistentry-indent% 2em)
526
527(element (varlistentry listitem)
528  (make sequence
529    start-indent: (+ (inherited-start-indent) %varlistentry-indent%)
530    (process-children)))
531
532
533;; Whitespace fixes for itemizedlists and orderedlists
534
535(define (process-listitem-content)
536  (if (absolute-first-sibling?)
537      (make sequence
538        (process-children-trim))
539      (next-match)))
540
541
542;; Default stylesheets format simplelists as tables.  This spells
543;; trouble for Jade.  So we just format them as plain lines.
544
545(define %simplelist-indent% 1em)
546
547(define (my-simplelist-vert members)
548  (make display-group
549    space-before: %para-sep%
550    space-after: %para-sep%
551    start-indent: (+ %simplelist-indent% (inherited-start-indent))
552    (process-children)))
553
554(element simplelist
555  (let ((type (attribute-string (normalize "type")))
556        (cols (if (attribute-string (normalize "columns"))
557                  (if (> (string->number (attribute-string (normalize "columns"))) 0)
558                      (string->number (attribute-string (normalize "columns")))
559                      1)
560                  1))
561        (members (select-elements (children (current-node)) (normalize "member"))))
562    (cond
563       ((equal? type (normalize "inline"))
564        (if (equal? (gi (parent (current-node)))
565                    (normalize "para"))
566            (process-children)
567            (make paragraph
568              space-before: %para-sep%
569              space-after: %para-sep%
570              start-indent: (inherited-start-indent))))
571       ((equal? type (normalize "vert"))
572        (my-simplelist-vert members))
573       ((equal? type (normalize "horiz"))
574        (simplelist-table 'row    cols members)))))
575
576(element member
577  (let ((type (inherited-attribute-string (normalize "type"))))
578    (cond
579     ((equal? type (normalize "inline"))
580      (make sequence
581        (process-children)
582        (if (not (last-sibling?))
583            (literal ", ")
584            (literal ""))))
585      ((equal? type (normalize "vert"))
586       (make paragraph
587         space-before: 0pt
588         space-after: 0pt))
589      ((equal? type (normalize "horiz"))
590       (make paragraph
591         quadding: 'start
592         (process-children))))))
593
594
595;; Jadetex doesn't handle links to the content of tables, so
596;; indexterms that point to table entries will go nowhere.  We fix
597;; this by pointing the index entry to the table itself instead, which
598;; should be equally useful in practice.
599
600(define (find-parent-table nd)
601  (let ((table (ancestor-member nd ($table-element-list$))))
602    (if (node-list-empty? table)
603        nd
604        table)))
605
606;; (The function below overrides the one in print/dbindex.dsl.)
607
608(define (indexentry-link nd)
609  (let* ((id        (attribute-string (normalize "role") nd))
610         (prelim-target (find-indexterm id))
611         (target    (find-parent-table prelim-target))
612         (preferred (not (node-list-empty?
613                          (select-elements (children (current-node))
614                                           (normalize "emphasis")))))
615         (sosofo    (if (node-list-empty? target)
616                        (literal "?")
617                        (make link
618                          destination: (node-list-address target)
619                          (with-mode toc-page-number-mode
620                            (process-node-list target))))))
621    (if preferred
622        (make sequence
623          font-weight: 'bold
624          sosofo)
625        sosofo)))
626
627
628;; By default, the part and reference title pages get wrong page
629;; numbers: The first title page gets roman numerals carried over from
630;; preface/toc -- we want Arabic numerals.  We also need to make sure
631;; that page-number-restart is set of #f explicitly, because otherwise
632;; it will carry over from the previous component, which is not good.
633;;
634;; (This looks worse than it is.  It's copied from print/dbttlpg.dsl
635;; and common/dbcommon.dsl and modified in minor detail.)
636
637(define (first-part?)
638  (let* ((book (ancestor (normalize "book")))
639         (nd   (ancestor-member (current-node)
640                                (append
641                                 (component-element-list)
642                                 (division-element-list))))
643         (bookch (children book)))
644    (let loop ((nl bookch))
645      (if (node-list-empty? nl)
646          #f
647          (if (equal? (gi (node-list-first nl)) (normalize "part"))
648              (if (node-list=? (node-list-first nl) nd)
649                  #t
650                  #f)
651              (loop (node-list-rest nl)))))))
652
653(define (first-reference?)
654  (let* ((book (ancestor (normalize "book")))
655         (nd   (ancestor-member (current-node)
656                                (append
657                                 (component-element-list)
658                                 (division-element-list))))
659         (bookch (children book)))
660    (let loop ((nl bookch))
661      (if (node-list-empty? nl)
662          #f
663          (if (equal? (gi (node-list-first nl)) (normalize "reference"))
664              (if (node-list=? (node-list-first nl) nd)
665                  #t
666                  #f)
667              (loop (node-list-rest nl)))))))
668
669
670(define (part-titlepage elements #!optional (side 'recto))
671  (let ((nodelist (titlepage-nodelist
672                   (if (equal? side 'recto)
673                       (reference-titlepage-recto-elements)
674                       (reference-titlepage-verso-elements))
675                   elements))
676        ;; partintro is a special case...
677        (partintro (node-list-first
678                    (node-list-filter-by-gi elements (list (normalize "partintro"))))))
679    (if (part-titlepage-content? elements side)
680        (make simple-page-sequence
681          page-n-columns: %titlepage-n-columns%
682          ;; Make sure that page number format is correct.
683          page-number-format: ($page-number-format$)
684          ;; Make sure that the page number is set to 1 if this is the
685          ;; first part in the book
686          page-number-restart?: (first-part?)
687          input-whitespace-treatment: 'collapse
688          use: default-text-style
689
690          ;; This hack is required for the RTF backend. If an external-graphic
691          ;; is the first thing on the page, RTF doesn't seem to do the right
692          ;; thing (the graphic winds up on the baseline of the first line
693          ;; of the page, left justified).  This "one point rule" fixes
694          ;; that problem.
695          (make paragraph
696            line-spacing: 1pt
697            (literal ""))
698
699          (let loop ((nl nodelist) (lastnode (empty-node-list)))
700            (if (node-list-empty? nl)
701                (empty-sosofo)
702                (make sequence
703                  (if (or (node-list-empty? lastnode)
704                          (not (equal? (gi (node-list-first nl))
705                                       (gi lastnode))))
706                      (part-titlepage-before (node-list-first nl) side)
707                      (empty-sosofo))
708                  (cond
709                   ((equal? (gi (node-list-first nl)) (normalize "subtitle"))
710                    (part-titlepage-subtitle (node-list-first nl) side))
711                   ((equal? (gi (node-list-first nl)) (normalize "title"))
712                    (part-titlepage-title (node-list-first nl) side))
713                   (else
714                    (part-titlepage-default (node-list-first nl) side)))
715                  (loop (node-list-rest nl) (node-list-first nl)))))
716
717          (if (and %generate-part-toc%
718                   %generate-part-toc-on-titlepage%
719                   (equal? side 'recto))
720              (make display-group
721                (build-toc (current-node)
722                           (toc-depth (current-node))))
723              (empty-sosofo))
724
725          ;; PartIntro is a special case
726          (if (and (equal? side 'recto)
727                   (not (node-list-empty? partintro))
728                   %generate-partintro-on-titlepage%)
729              ($process-partintro$ partintro #f)
730              (empty-sosofo)))
731
732        (empty-sosofo))))
733
734
735(define (reference-titlepage elements #!optional (side 'recto))
736  (let ((nodelist (titlepage-nodelist
737                   (if (equal? side 'recto)
738                       (reference-titlepage-recto-elements)
739                       (reference-titlepage-verso-elements))
740                   elements))
741        ;; partintro is a special case...
742        (partintro (node-list-first
743                    (node-list-filter-by-gi elements (list (normalize "partintro"))))))
744    (if (reference-titlepage-content? elements side)
745        (make simple-page-sequence
746          page-n-columns: %titlepage-n-columns%
747          ;; Make sure that page number format is correct.
748          page-number-format: ($page-number-format$)
749          ;; Make sure that the page number is set to 1 if this is the
750          ;; first part in the book
751          page-number-restart?: (first-reference?)
752          input-whitespace-treatment: 'collapse
753          use: default-text-style
754
755          ;; This hack is required for the RTF backend. If an external-graphic
756          ;; is the first thing on the page, RTF doesn't seem to do the right
757          ;; thing (the graphic winds up on the baseline of the first line
758          ;; of the page, left justified).  This "one point rule" fixes
759          ;; that problem.
760          (make paragraph
761            line-spacing: 1pt
762            (literal ""))
763
764          (let loop ((nl nodelist) (lastnode (empty-node-list)))
765            (if (node-list-empty? nl)
766                (empty-sosofo)
767                (make sequence
768                  (if (or (node-list-empty? lastnode)
769                          (not (equal? (gi (node-list-first nl))
770                                       (gi lastnode))))
771                      (reference-titlepage-before (node-list-first nl) side)
772                      (empty-sosofo))
773                  (cond
774                   ((equal? (gi (node-list-first nl)) (normalize "author"))
775                    (reference-titlepage-author (node-list-first nl) side))
776                   ((equal? (gi (node-list-first nl)) (normalize "authorgroup"))
777                    (reference-titlepage-authorgroup (node-list-first nl) side))
778                   ((equal? (gi (node-list-first nl)) (normalize "corpauthor"))
779                    (reference-titlepage-corpauthor (node-list-first nl) side))
780                   ((equal? (gi (node-list-first nl)) (normalize "editor"))
781                    (reference-titlepage-editor (node-list-first nl) side))
782                   ((equal? (gi (node-list-first nl)) (normalize "subtitle"))
783                    (reference-titlepage-subtitle (node-list-first nl) side))
784                   ((equal? (gi (node-list-first nl)) (normalize "title"))
785                    (reference-titlepage-title (node-list-first nl) side))
786                   (else
787                    (reference-titlepage-default (node-list-first nl) side)))
788                  (loop (node-list-rest nl) (node-list-first nl)))))
789
790          (if (and %generate-reference-toc%
791                   %generate-reference-toc-on-titlepage%
792                   (equal? side 'recto))
793              (make display-group
794                (build-toc (current-node)
795                           (toc-depth (current-node))))
796              (empty-sosofo))
797
798          ;; PartIntro is a special case
799          (if (and (equal? side 'recto)
800                   (not (node-list-empty? partintro))
801                   %generate-partintro-on-titlepage%)
802              ($process-partintro$ partintro #f)
803              (empty-sosofo)))
804
805        (empty-sosofo))))
806
807]]> <!-- %output-print -->
808
809
810<!-- Plain text output customization ............................... -->
811
812<!--
813This is used for making the INSTALL file and others.  We customize the
814HTML stylesheets to be suitable for dumping plain text (via Netscape,
815Lynx, or similar).
816-->
817
818<![ %output-text; [
819
820(define %section-autolabel% #f)
821(define %chapter-autolabel% #f)
822(define $generate-chapter-toc$ (lambda () #f))
823
824;; For text output, produce "ASCII markup" for emphasis and such.
825
826(define ($asterix-seq$ #!optional (sosofo (process-children)))
827  (make sequence
828    (literal "*")
829    sosofo
830    (literal "*")))
831
832(define ($dquote-seq$ #!optional (sosofo (process-children)))
833  (make sequence
834    (literal (gentext-start-quote))
835    sosofo
836    (literal (gentext-end-quote))))
837
838(element (para command) ($dquote-seq$))
839(element (para emphasis) ($asterix-seq$))
840(element (para filename) ($dquote-seq$))
841(element (para option) ($dquote-seq$))
842(element (para replaceable) ($dquote-seq$))
843(element (para userinput) ($dquote-seq$))
844
845]]> <!-- %output-text -->
846
847  </style-specification-body>
848 </style-specification>
849
850 <external-specification id="docbook" document="dbstyle">
851</style-sheet>
852