OSDN Git Service

fix for Linux 3.0
[linuxjf/JF.git] / jf-custom.dsl
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"
5          CDATA dsssl>
6 ]>
7 <style-sheet>
8
9 <style-specification id="html" use="docbook">
10 <style-specification-body> 
11
12 ;; borrowed from ldp.dsl at http://www.tldp.org/authors/tools/ldp.dsl
13
14 ;; ------------------------------------------------------------------------
15 ;; ldp.dsl - LDP Customized DSSSL Stylesheet
16 ;; v1.12, 2003-03-19
17 ;; Copyright (C) 2000-2003
18 ;;
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.
23 ;;
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.
28 ;;
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 ;; ------------------------------------------------------------------------
33
34 <!--
35 ;; customize the html stylesheet; parts borrowed from 
36 ;; Cygnus at http://sourceware.cygnus.com/ (cygnus-both.dsl)
37 -->
38
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?"
43   #f)
44
45 (declare-flow-object-class element
46   ;; for redhat
47   "UNREGISTERED::James Clark//Flow Object Class::element")
48
49 (define %html-pubid%
50   ;; put the public identifier in each HTML file
51   "-//W3C//DTD HTML 4.0 Transitional//EN")
52
53 (define %generate-legalnotice-link%
54   ;; put the legal notice in a separate file
55   #t)
56
57 ;(define %admon-graphics-path%
58 ;  ;; use graphics in admonitions, set their
59 ;  "../images/")
60
61
62 ;(define %admon-graphics%
63 ;  #t)
64
65 (define %funcsynopsis-decoration%
66   ;; make funcsynopsis look pretty
67   #t)
68
69 (define %html-ext%
70   ;; when producing HTML files, use this extension
71   ".html")
72
73 (define %generate-book-toc%
74   ;; Should a Table of Contents be produced for books?
75   #t)
76
77 (define %generate-article-toc% 
78   ;; Should a Table of Contents be produced for articles?
79   #t)
80
81 (define %generate-part-toc%
82   ;; Should a Table of Contents be produced for parts?
83   #t)
84
85 (define %generate-book-titlepage%
86   ;; produce a title page for books
87   #t)
88
89 (define %generate-article-titlepage%
90   ;; produce a title page for articles
91   #t)
92
93 (define (chunk-skip-first-element-list)
94   ;; forces the Table of Contents on separate page
95   '())
96
97 (define (list-element-list)
98   ;; fixes bug in Table of Contents generation
99   '())
100
101 (define %root-filename%
102   ;; The filename of the root HTML document (e.g, "index").
103   "index")
104
105 (define %shade-verbatim%
106   ;; verbatim sections will be shaded if t(rue)
107   #t)
108
109 (define %use-id-as-filename%
110   ;; Use ID attributes as name for component HTML files?
111   #t)
112
113 (define %graphic-extensions%
114   ;; graphic extensions allowed
115   '("gif" "png" "jpg" "jpeg" "tif" "tiff" "eps" "epsf" ))
116
117 (define %graphic-default-extension% 
118   "gif")
119
120 (define %section-autolabel%
121   ;; For enumerated sections (1.1, 1.1.1, 1.2, etc.)
122   #t)
123
124 (define (toc-depth nd)
125   ;; more depth (2 levels) to toc; instead of flat hierarchy
126   2)
127
128 (element emphasis
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))))
133
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")
142         (normalize "author")
143         (normalize "othercredit")
144         (normalize "contrib")
145         (normalize "edition")
146         (normalize "releaseinfo")
147         (normalize "publisher")
148         (normalize "editor")
149         (normalize "copyright")
150         (normalize "pubdate")
151         (normalize "revhistory")
152         (normalize "abstract")
153         (normalize "legalnotice")))
154
155 (define (article-titlepage-recto-elements)
156   ;; elements on an article's titlepage
157   (list (normalize "title")
158         (normalize "subtitle")
159         (normalize "authorgroup")
160         (normalize "author")
161         (normalize "othercredit")
162         (normalize "releaseinfo")
163         (normalize "copyright")
164         (normalize "pubdate")
165         (normalize "revhistory")
166         (normalize "abstract")
167         (normalize "legalnotice")))
168
169 (define (process-contrib #!optional (sosofo (process-children)))
170   ;; print out with othercredit information; for translators, etc.
171   (make sequence
172     (make element gi: "SPAN"
173           attributes: (list (list "CLASS" (gi)))
174           (process-children))))
175
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)
185 ;              (literal " - "))
186 ;         (process-node-list author-contrib))))
187
188 (mode article-titlepage-recto-mode
189   (element contrib (process-contrib))
190   (element othercredit (process-othercredit))
191 )
192
193 (mode book-titlepage-recto-mode
194   (element contrib (process-contrib))
195   (element othercredit (process-othercredit))
196 )
197
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)
203                    artinfo
204                    artheader))
205          (ahtitles  (select-elements (children ahdr)
206                                      (normalize "title")))
207          (artitles  (select-elements artchild (normalize "title")))
208          (titles    (if (node-list-empty? artitles)
209                         ahtitles
210                         artitles)))
211     (if (node-list-empty? titles)
212         ""
213         (node-list-first titles))))
214
215
216 (mode subtitle-mode
217   ;; do not print subtitle on subsequent pages
218   (element subtitle (empty-sosofo)))
219
220
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
225
226 (define ($verbatim-display$ indent line-numbers?)
227   (let ((verbatim-element (gi))
228         (content (make element gi: "PRE"
229                        attributes: (list
230                                     (list "CLASS" (gi)))
231                        (if (or indent line-numbers?)
232                            ($verbatim-line-by-line$ indent line-numbers?)
233                            (process-children)))))
234     (if %shade-verbatim%
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" 
240                                 attributes: (list
241                                              (list "COLOR" (car (shade-verbatim-element-colors
242                                                                  verbatim-element))))
243                                 content))))
244         content)))
245
246 ;;
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")
251 ;;
252 (define (shade-verbatim-element-colors element)
253   (case element
254     (("SYNOPSIS") (list "#000000" "#6495ED"))
255     ;; ...
256     ;; Add your verbatim elements here
257     ;; ...
258     (else (list "#000000" "#E0E0E0"))))
259
260 (define (shade-verbatim-attr-element element)
261   (list
262    (list "BORDER" 
263         (cond
264                 ((equal? element (normalize "SCREEN")) "1")
265                 (else "0")))
266    (list "BGCOLOR" (car (cdr (shade-verbatim-element-colors element))))
267    (list "WIDTH" ($table-width$))))
268
269 ;; End of $verbatim-display$ redefinition
270
271
272 ;; jf-custom.dsl original
273
274 (define %admon-graphics-path%
275   ;; use graphics in admonitions, set their
276   "./")
277
278 (define %admon-graphics%
279   #f)
280
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.
284   "./")
285
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"))))
294
295     (make element gi: "P"
296          attributes: (list (list "CLASS" (gi)))
297          (make element gi: "B"
298               (literal author-name)
299               (literal " - "))
300          (process-node-list author-contrib)
301          (process-node-list author-affil))))
302
303 (define %show-ulinks%
304   ;; REFENTRY show-ulinks
305   ;; PURP Display URLs after ULinks?
306   ;; DESC
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.
310   ;; /DESC
311   ;; AUTHOR N/A
312   ;; /REFENTRY
313   #f)
314
315 (element ulink 
316   (make element gi: "A"
317         attributes: (list
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")))
322             (process-children))
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)))))
327             (make sequence
328               (literal " <")
329               (literal (attribute-string (normalize "url")))
330               (literal ">"))
331             (empty-sosofo))))
332
333 ;; The following is obtained from:
334 ;;
335 ;; &#62; Id: dbbibl.dsl,v 1.23 2000/07/19 18:40:06 nwalsh Exp
336 ;; &#62;
337 ;; &#62; This file is part of the Modular DocBook Stylesheet distribution.
338 ;;
339 ;; and modified for Japanese name order convention.
340 ;; (modified by Hiroki Sato &#60;hrs@jp.FreeBSD.org&#62;
341
342 (define (author-string #!optional (author (current-node)))
343   ;; Return a formatted string representation of the contents of:
344   ;; AUTHOR:
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"
349   ;; CORPAUTHOR:
350   ;;   returns (data corpauthor)
351   (let* (
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")
358                    (select-elements 
359                     (descendants author) (normalize "surname"))
360                    (select-elements 
361                     (descendants author) (normalize "firstname"))))
362          (o_nl (select-elements 
363                 (descendants author) (normalize "othername")))
364          (s_nl (if (equal? lang "ja")
365                    (select-elements 
366                     (descendants author) (normalize "firstname"))
367                    (select-elements 
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")))
380         (string-append
381          (if has_h (string-append (data-of (node-list-first h_nl))
382                                   %honorific-punctuation%) "")
383          (if has_f (string-append
384                     (if has_h " " "")
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))) ""))
394         (data-of author))))
395
396 (element email
397   ;; Do not link to mail address.
398   ($mono-seq$
399    (make sequence 
400      (literal "&#60;")
401      (process-children)
402      (literal "&#62;"))))
403
404 (define %gentext-nav-tblwidth% "100%")
405
406 (define %honorific-punctuation% " / ")
407 (define biblio-number  #t)
408 (define %table-rules% #t)
409
410
411 (define %body-attr% 
412   ;; What attributes should be hung off of BODY?
413   (list
414    (list "BGCOLOR" "#FFFFFF")
415    (list "TEXT" "#000000")))
416
417 </style-specification-body>
418 </style-specification>
419
420 <external-specification id="docbook" document="docbook.dsl">
421
422 </style-sheet>