1 <!DOCTYPE style-sheet PUBLIC
2 "-//James Clark//DTD DSSSL Style Sheet//EN" [
3 <!ENTITY docbook.dsl PUBLIC
4 "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN"
9 <style-specification id="html" use="docbook">
10 <style-specification-body>
12 ;; borrowed from ldp.dsl at http://www.tldp.org/authors/tools/ldp.dsl
14 ;; ------------------------------------------------------------------------
15 ;; ldp.dsl - LDP Customized DSSSL Stylesheet
17 ;; Copyright (C) 2000-2003
19 ;; This program is free software; you can redistribute it and/or modify
20 ;; it under the terms of the GNU General Public License as published by
21 ;; the Free Software Foundation; either version 2 of the License, or
22 ;; (at your option) any later version.
24 ;; This program is distributed in the hope that it will be useful,
25 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
26 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ;; GNU General Public License for more details.
29 ;; You should have received a copy of the GNU General Public License
30 ;; along with this program; if not, write to the Free Software
31 ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 ;; ------------------------------------------------------------------------
35 ;; customize the html stylesheet; parts borrowed from
36 ;; Cygnus at http://sourceware.cygnus.com/ (cygnus-both.dsl)
39 (declare-characteristic preserve-sdata?
40 ;; this is necessary because right now jadetex does not understand
41 ;; symbolic entities, whereas things work well with numeric entities.
42 "UNREGISTERED::James Clark//Characteristic::preserve-sdata?"
45 (declare-flow-object-class element
47 "UNREGISTERED::James Clark//Flow Object Class::element")
50 ;; put the public identifier in each HTML file
51 "-//W3C//DTD HTML 4.0 Transitional//EN")
53 (define %generate-legalnotice-link%
54 ;; put the legal notice in a separate file
57 ;(define %admon-graphics-path%
58 ; ;; use graphics in admonitions, set their
62 ;(define %admon-graphics%
65 (define %funcsynopsis-decoration%
66 ;; make funcsynopsis look pretty
70 ;; when producing HTML files, use this extension
73 (define %generate-book-toc%
74 ;; Should a Table of Contents be produced for books?
77 (define %generate-article-toc%
78 ;; Should a Table of Contents be produced for articles?
81 (define %generate-part-toc%
82 ;; Should a Table of Contents be produced for parts?
85 (define %generate-book-titlepage%
86 ;; produce a title page for books
89 (define %generate-article-titlepage%
90 ;; produce a title page for articles
93 (define (chunk-skip-first-element-list)
94 ;; forces the Table of Contents on separate page
97 (define (list-element-list)
98 ;; fixes bug in Table of Contents generation
101 (define %root-filename%
102 ;; The filename of the root HTML document (e.g, "index").
105 (define %shade-verbatim%
106 ;; verbatim sections will be shaded if t(rue)
109 (define %use-id-as-filename%
110 ;; Use ID attributes as name for component HTML files?
113 (define %graphic-extensions%
114 ;; graphic extensions allowed
115 '("gif" "png" "jpg" "jpeg" "tif" "tiff" "eps" "epsf" ))
117 (define %graphic-default-extension%
120 (define %section-autolabel%
121 ;; For enumerated sections (1.1, 1.1.1, 1.2, etc.)
124 (define (toc-depth nd)
125 ;; more depth (2 levels) to toc; instead of flat hierarchy
129 ;; make role=strong equate to bold for emphasis tag
130 (if (equal? (attribute-string "role") "strong")
131 (make element gi: "STRONG" (process-children))
132 (make element gi: "EM" (process-children))))
134 (define (book-titlepage-recto-elements)
135 ;; elements on a book's titlepage
136 (list (normalize "title")
137 (normalize "subtitle")
138 (normalize "graphic")
139 (normalize "mediaobject")
140 (normalize "corpauthor")
141 (normalize "authorgroup")
143 (normalize "othercredit")
144 (normalize "contrib")
145 (normalize "edition")
146 (normalize "releaseinfo")
147 (normalize "publisher")
149 (normalize "copyright")
150 (normalize "pubdate")
151 (normalize "revhistory")
152 (normalize "abstract")
153 (normalize "legalnotice")))
155 (define (article-titlepage-recto-elements)
156 ;; elements on an article's titlepage
157 (list (normalize "title")
158 (normalize "subtitle")
159 (normalize "authorgroup")
161 (normalize "othercredit")
162 (normalize "releaseinfo")
163 (normalize "copyright")
164 (normalize "pubdate")
165 (normalize "revhistory")
166 (normalize "abstract")
167 (normalize "legalnotice")))
169 (define (process-contrib #!optional (sosofo (process-children)))
170 ;; print out with othercredit information; for translators, etc.
172 (make element gi: "SPAN"
173 attributes: (list (list "CLASS" (gi)))
174 (process-children))))
176 ;(define (process-othercredit #!optional (sosofo (process-children)))
177 ; ;; print out othercredit information; for translators, etc.
178 ; (let ((author-name (author-string))
179 ; (author-contrib (select-elements (children (current-node))
180 ; (normalize "contrib"))))
181 ; (make element gi: "P"
182 ; attributes: (list (list "CLASS" (gi)))
183 ; (make element gi: "B"
184 ; (literal author-name)
186 ; (process-node-list author-contrib))))
188 (mode article-titlepage-recto-mode
189 (element contrib (process-contrib))
190 (element othercredit (process-othercredit))
193 (mode book-titlepage-recto-mode
194 (element contrib (process-contrib))
195 (element othercredit (process-othercredit))
198 (define (article-title nd)
199 (let* ((artchild (children nd))
200 (artheader (select-elements artchild (normalize "artheader")))
201 (artinfo (select-elements artchild (normalize "articleinfo")))
202 (ahdr (if (node-list-empty? artheader)
205 (ahtitles (select-elements (children ahdr)
206 (normalize "title")))
207 (artitles (select-elements artchild (normalize "title")))
208 (titles (if (node-list-empty? artitles)
211 (if (node-list-empty? titles)
213 (node-list-first titles))))
217 ;; do not print subtitle on subsequent pages
218 (element subtitle (empty-sosofo)))
221 ;; Redefinition of $verbatim-display$
222 ;; Origin: dbverb.dsl
223 ;; Different foreground and background colors for verbatim elements
224 ;; Author: Philippe Martin (feloy@free.fr) 2001-04-07
226 (define ($verbatim-display$ indent line-numbers?)
227 (let ((verbatim-element (gi))
228 (content (make element gi: "PRE"
231 (if (or indent line-numbers?)
232 ($verbatim-line-by-line$ indent line-numbers?)
233 (process-children)))))
235 (make element gi: "TABLE"
236 attributes: (shade-verbatim-attr-element verbatim-element)
237 (make element gi: "TR"
238 (make element gi: "TD"
239 (make element gi: "FONT"
241 (list "COLOR" (car (shade-verbatim-element-colors
247 ;; Customize this function
248 ;; to change the foreground and background colors
249 ;; of the different verbatim elements
250 ;; Return (list "foreground color" "background color")
252 (define (shade-verbatim-element-colors element)
254 (("SYNOPSIS") (list "#000000" "#6495ED"))
256 ;; Add your verbatim elements here
258 (else (list "#000000" "#E0E0E0"))))
260 (define (shade-verbatim-attr-element element)
264 ((equal? element (normalize "SCREEN")) "1")
266 (list "BGCOLOR" (car (cdr (shade-verbatim-element-colors element))))
267 (list "WIDTH" ($table-width$))))
269 ;; End of $verbatim-display$ redefinition
272 ;; jf-custom.dsl original
274 (define %admon-graphics-path%
275 ;; use graphics in admonitions, set their
278 (define %admon-graphics%
281 (define %callout-graphics-path%
282 ;; Sets the path, probably relative to the directory where the HTML
283 ;; files are created, to the callout graphics.
286 (define (process-othercredit #!optional (sosofo (process-children)))
287 ;; print out othercredit information; for translators, etc.
288 ;; note: added author-affil by JF.
289 (let ((author-name (author-string))
290 (author-contrib (select-elements (children (current-node))
291 (normalize "contrib")))
292 (author-affil (select-elements (children (current-node))
293 (normalize "affiliation"))))
295 (make element gi: "P"
296 attributes: (list (list "CLASS" (gi)))
297 (make element gi: "B"
298 (literal author-name)
300 (process-node-list author-contrib)
301 (process-node-list author-affil))))
303 (define %show-ulinks%
304 ;; REFENTRY show-ulinks
305 ;; PURP Display URLs after ULinks?
307 ;; If true, the URL of each ULink will appear in parenthesis after
308 ;; the text of the link. If the text of the link and the URL are
309 ;; identical, the parenthetical URL is suppressed.
316 (make element gi: "A"
318 (list "HREF" (attribute-string (normalize "url")))
319 (list "TARGET" "_top"))
320 (if (node-list-empty? (children (current-node)))
321 (literal (attribute-string (normalize "url")))
323 (if (and %show-ulinks%
324 (not (node-list-empty? (children (current-node))))
325 (not (equal? (attribute-string (normalize "url"))
326 (data-of (current-node)))))
329 (literal (attribute-string (normalize "url")))
333 ;; The following is obtained from:
335 ;; > Id: dbbibl.dsl,v 1.23 2000/07/19 18:40:06 nwalsh Exp
337 ;; > This file is part of the Modular DocBook Stylesheet distribution.
339 ;; and modified for Japanese name order convention.
340 ;; (modified by Hiroki Sato <hrs@jp.FreeBSD.org>
342 (define (author-string #!optional (author (current-node)))
343 ;; Return a formatted string representation of the contents of:
345 ;; Handles Honorific, FirstName, SurName, and Lineage.
346 ;; If %author-othername-in-middle% is #t, also OtherName
347 ;; Handles *only* the first of each.
348 ;; Format is "Honorific. FirstName [OtherName] SurName, Lineage"
350 ;; returns (data corpauthor)
352 ; (lang (attribute-string "lang" (select-elements
353 ; author (normalize "author"))))
354 (lang (if (string? author) ($lang$) ($lang$ author)))
355 (h_nl (select-elements
356 (descendants author) (normalize "honorific")))
357 (f_nl (if (equal? lang "ja")
359 (descendants author) (normalize "surname"))
361 (descendants author) (normalize "firstname"))))
362 (o_nl (select-elements
363 (descendants author) (normalize "othername")))
364 (s_nl (if (equal? lang "ja")
366 (descendants author) (normalize "firstname"))
368 (descendants author) (normalize "surname"))))
369 (l_nl (select-elements
370 (descendants author) (normalize "lineage")))
371 (has_h (not (node-list-empty? h_nl)))
372 (has_f (not (node-list-empty? f_nl)))
373 (has_o (and %author-othername-in-middle%
374 (not (node-list-empty? o_nl))))
375 (has_s (not (node-list-empty? s_nl)))
376 (has_l (not (node-list-empty? l_nl))))
377 (if (or (equal? (gi author) (normalize "author"))
378 (equal? (gi author) (normalize "editor"))
379 (equal? (gi author) (normalize "othercredit")))
381 (if has_h (string-append (data-of (node-list-first h_nl))
382 %honorific-punctuation%) "")
383 (if has_f (string-append
385 (data-of (node-list-first f_nl))) "")
386 (if has_o (string-append
387 (if (or has_h has_f) " " "")
388 (data-of (node-list-first o_nl))) "")
389 (if has_s (string-append
390 (if (or has_h has_f has_o) " " "")
391 (data-of (node-list-first s_nl))) "")
392 (if has_l (string-append
393 ", " (data-of (node-list-first l_nl))) ""))
397 ;; Do not link to mail address.
404 (define %gentext-nav-tblwidth% "100%")
406 (define %honorific-punctuation% " / ")
407 (define biblio-number #t)
408 (define %table-rules% #t)
412 ;; What attributes should be hung off of BODY?
414 (list "BGCOLOR" "#FFFFFF")
415 (list "TEXT" "#000000")))
417 </style-specification-body>
418 </style-specification>
420 <external-specification id="docbook" document="docbook.dsl">