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