3 <!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
4 <!ENTITY % output.html "IGNORE">
5 <!ENTITY % output.print "IGNORE">
6 <!ENTITY % include.historic "IGNORE">
7 <!ENTITY % no.include.historic "IGNORE">
8 <!ENTITY freebsd.dsl PUBLIC "-//FreeBSD//DOCUMENT DocBook Stylesheet//EN" CDATA DSSSL>
9 <!ENTITY % release.ent PUBLIC "-//FreeBSD//ENTITIES Release Specification//EN">
14 <style-specification use="docbook">
15 <style-specification-body>
17 ; Configure behavior of this stylesheet
18 <![ %include.historic; [
19 (define %include-historic% #t)
21 <![ %no.include.historic; [
22 (define %include-historic% #f)
25 ; String manipulation functions
26 (define (split-string-to-list STR)
27 ;; return list of STR separated with char #\ or #\,
29 (let loop ((i (string-delim-index STR)))
30 (cond ((equal? (cdr i) '()) '())
31 (else (cons (substring STR (list-ref i 0) (- (list-ref i 1) 1))
35 (define (string-delim-index STR)
36 ;; return indexes of STR separated with char #\ or #\,
38 (let ((strlen (string-length STR)))
40 (cond ((= i strlen) (cons (+ strlen 1) '()))
41 ((= i 0) (cons i (loop (+ i 1))))
42 ((or (equal? (string-ref STR i) #\ )
43 (equal? (string-ref STR i) #\,)) (cons (+ i 1) (loop (+ i 1))))
44 (else (loop (+ i 1))))))
48 (define (string-list-match? STR STR-LIST)
49 (let loop ((s STR-LIST))
53 ((equal? (car s) #f) #f)
54 ((equal? STR (car s)) #t)
55 (else (loop (cdr s))))))
57 ; Deal with conditional inclusion of text via entities.
59 (let* ((role (attribute-string (normalize "role")))
60 (for-arch (entity-text "arch")))
63 ;; If role=historic, and we're not printing historic things, then
64 ;; don't output this element.
65 ((and (equal? role "historic")
66 (not %include-historic%))
70 (else (next-match)))))
74 (let* ((role (attribute-string (normalize "role")))
75 (for-arch (entity-text "arch")))
78 ;; If role=historic, and we're not printing historic things, then
79 ;; don't output this element.
80 ((and (equal? role "historic")
81 (not %include-historic%))
85 (else (next-match))))))
87 ; We might have some sect1 level elements where the modification times
88 ; are significant. An example of this is the "What's New" section in
89 ; the release notes. We enable the printing of pubdate entry in
90 ; sect1info elements to support this.
91 (element (sect1info pubdate) (process-children))
94 ; Put URLs in footnotes, and put footnotes at the bottom of each page.
95 (define bop-footnotes #t)
96 (define %footnote-ulinks% #t)
99 (let ((arch (attribute-string (normalize "arch")))
100 (role (attribute-string (normalize "role")))
101 (arch-string (entity-text "arch"))
102 (merged-string (entity-text "merged")))
103 (if (or (equal? (print-backend) 'tex)
104 (equal? (print-backend) #f))
105 ;; avoid using country: characteristic because of a JadeTeX bug...
107 first-line-start-indent: (if (is-first-para)
108 %para-indent-firstpara%
110 space-before: %para-sep%
111 space-after: (if (INLIST?)
114 quadding: %default-quadding%
115 hyphenate?: %hyphenation%
116 language: (dsssl-language-code)
119 ;; If arch= not specified, then print unconditionally. This clause
120 ;; handles the majority of cases.
121 ((or (equal? arch #f)
124 (process-children-trim))
128 (let loop ((prev (car (split-string-to-list arch)))
129 (rest (cdr (split-string-to-list arch))))
132 (if (not (null? rest))
135 (loop (car rest) (cdr rest)))
138 (process-children-trim))))
139 (if (and (not (null? role)) (equal? role "merged"))
140 (literal " [" merged-string "]")
143 first-line-start-indent: (if (is-first-para)
144 %para-indent-firstpara%
146 space-before: %para-sep%
147 space-after: (if (INLIST?)
150 quadding: %default-quadding%
151 hyphenate?: %hyphenation%
152 language: (dsssl-language-code)
153 country: (dsssl-country-code)
156 ;; If arch= not specified, then print unconditionally. This clause
157 ;; handles the majority of cases.
158 ((or (equal? arch #f)
161 (process-children-trim))
165 (let loop ((prev (car (split-string-to-list arch)))
166 (rest (cdr (split-string-to-list arch))))
169 (if (not (null? rest))
172 (loop (car rest) (cdr rest)))
175 (process-children-trim))))
176 (if (and (not (null? role)) (equal? role "merged"))
177 (literal " [" merged-string "]")
182 (define %callout-graphics%
183 ;; Use graphics in callouts?
186 <!-- Convert " ... " to `` ... '' in the HTML output. -->
191 (literal "”")))
193 <!-- Specify how to generate the man page link HREF -->
194 (define ($create-refentry-xref-link$ #!optional (n (current-node)))
195 (let* ((r (select-elements (children n) (normalize "refentrytitle")))
196 (m (select-elements (children n) (normalize "manvolnum")))
197 (v (attribute-string (normalize "vendor") n))
198 (u (string-append "&release.man.url;?query="
199 (data r) "&" "sektion=" (data m))))
201 (("xfree86") (string-append u "&" "manpath=XFree86+&release.manpath.xfree86;" ))
202 (("xorg") (string-append u "&" "manpath=Xorg+&release.manpath.xorg;" ))
203 (("netbsd") (string-append u "&" "manpath=NetBSD+&release.manpath.netbsd;"))
204 (("ports") (string-append u "&" "manpath=FreeBSD+&release.manpath.freebsd-ports;"))
205 (else (string-append u "&" "manpath=FreeBSD+&release.manpath.freebsd;")))))
207 ;; $paragraph$ function with arch attribute support.
208 (define ($paragraph$ #!optional (para-wrapper "P"))
209 (let ((footnotes (select-elements (descendants (current-node))
210 (normalize "footnote")))
211 (tgroup (have-ancestor? (normalize "tgroup")))
212 (arch (attribute-string (normalize "arch")))
213 (role (attribute-string (normalize "role")))
214 (arch-string (entity-text "arch"))
215 (merged-string (entity-text "merged")))
217 (make element gi: para-wrapper
219 (if %default-quadding%
220 (list (list "ALIGN" %default-quadding%))
224 ;; If arch= not specified, then print unconditionally. This clause
225 ;; handles the majority of cases.
226 ((or (equal? arch #f)
234 (let loop ((prev (car (split-string-to-list arch)))
235 (rest (cdr (split-string-to-list arch))))
238 (if (not (null? rest))
241 (loop (car rest) (cdr rest)))
244 (process-children)))))
245 (if (and (not (null? role)) (equal? role "merged"))
246 (literal " [" merged-string "]")
248 (if (or %footnotes-at-end% tgroup (node-list-empty? footnotes))
250 (make element gi: "BLOCKQUOTE"
252 (list "CLASS" "FOOTNOTES"))
253 (with-mode footnote-mode
254 (process-node-list footnotes)))))))))
257 (define (toc-depth nd)
258 (if (string=? (gi nd) (normalize "book"))
262 </style-specification-body>
263 </style-specification>
265 <external-specification id="docbook" document="freebsd.dsl">