]> CyberLeo.Net >> Repos - FreeBSD/releng/8.2.git/blob - release/doc/share/sgml/release.dsl
Add revision attribute handling. Links are now generated at the end
[FreeBSD/releng/8.2.git] / release / doc / share / sgml / release.dsl
1 <!-- $FreeBSD$ -->
2
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">
10 %release.ent;
11 ]>
12
13 <style-sheet>
14   <style-specification use="docbook">
15     <style-specification-body>
16
17 ; Configure behavior of this stylesheet
18 <![ %include.historic; [
19       (define %include-historic% #t)
20 ]]>
21 <![ %no.include.historic; [
22       (define %include-historic% #f)
23 ]]>
24
25 ; String manipulation functions
26 (define (split-string-to-list STR)
27   ;; return list of STR separated with char #\ or #\,
28   (if (string? STR)
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))
32                           (loop (cdr i))))))
33       '()))
34
35 (define (string-delim-index STR)
36   ;; return indexes of STR separated with char #\ or #\,
37   (if (string? STR)
38       (let ((strlen (string-length STR)))
39         (let loop ((i 0))
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))))))
45       '()
46       ))
47
48 (define (string-list-match? STR STR-LIST)
49   (let loop ((s STR-LIST))
50     (cond
51      ((equal? s #f) #f)
52      ((equal? s '()) #f)
53      ((equal? (car s) #f) #f)
54      ((equal? STR (car s)) #t)
55      (else (loop (cdr s))))))
56
57 ; Deal with conditional inclusion of text via entities.
58 (default
59   (let* ((role (attribute-string (normalize "role")))
60          (for-arch (entity-text "arch")))
61     (cond
62
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%))
67       (empty-sosofo))
68
69      ;; None of the above
70      (else (next-match)))))
71
72 (mode qandatoc
73   (default
74     (let* ((role (attribute-string (normalize "role")))
75            (for-arch (entity-text "arch")))
76       (cond
77
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%))
82         (empty-sosofo))
83
84        ;; None of the above
85        (else (next-match))))))
86
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))
92
93     <![ %output.print; [
94 ; Put URLs in footnotes, and put footnotes at the bottom of each page.
95       (define bop-footnotes #t)
96       (define %footnote-ulinks% #t)
97
98       (define ($paragraph$)
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...
106               (make paragraph
107                 first-line-start-indent: (if (is-first-para)
108                                              %para-indent-firstpara%
109                                              %para-indent%)
110                 space-before: %para-sep%
111                 space-after: (if (INLIST?)
112                                  0pt
113                                  %para-sep%)
114                 quadding: %default-quadding%
115                 hyphenate?: %hyphenation%
116                 language: (dsssl-language-code)
117                 (make sequence
118                   (cond
119                    ;; If arch= not specified, then print unconditionally.  This clause
120                    ;; handles the majority of cases.
121                    ((or (equal? arch #f)
122                         (equal? arch "")
123                         (equal? arch "all"))
124                       (process-children-trim))
125                    (else
126                     (make sequence
127                       (literal "[")
128                       (let loop ((prev (car (split-string-to-list arch)))
129                                  (rest (cdr (split-string-to-list arch))))
130                         (make sequence
131                           (literal prev)
132                           (if (not (null? rest))
133                               (make sequence
134                                 (literal ", ")
135                                 (loop (car rest) (cdr rest)))
136                               (empty-sosofo))))
137                       (literal "] ")
138                       (process-children-trim)))))
139                   (if (and (not (null? role)) (equal? role "merged"))
140                       (literal " [" merged-string "]")
141                       (empty-sosofo))))
142               (make paragraph
143                 first-line-start-indent: (if (is-first-para)
144                                              %para-indent-firstpara%
145                                              %para-indent%)
146                 space-before: %para-sep%
147                 space-after: (if (INLIST?)
148                                  0pt
149                                  %para-sep%)
150                 quadding: %default-quadding%
151                 hyphenate?: %hyphenation%
152                 language: (dsssl-language-code)
153                 country: (dsssl-country-code)
154                 (make sequence
155                   (cond
156                    ;; If arch= not specified, then print unconditionally.  This clause
157                    ;; handles the majority of cases.
158                    ((or (equal? arch #f)
159                         (equal? arch "")
160                         (equal? arch "all"))
161                       (process-children-trim))
162                    (else
163                     (make sequence
164                       (literal "[")
165                       (let loop ((prev (car (split-string-to-list arch)))
166                                  (rest (cdr (split-string-to-list arch))))
167                         (make sequence
168                           (literal prev)
169                           (if (not (null? rest))
170                               (make sequence
171                                 (literal ", ")
172                                 (loop (car rest) (cdr rest)))
173                               (empty-sosofo))))
174                       (literal "] ")
175                       (process-children-trim))))
176                   (if (and (not (null? role)) (equal? role "merged"))
177                       (literal " [" merged-string "]")
178                       (empty-sosofo))))))))
179     ]]>
180
181     <![ %output.html; [
182       (define %callout-graphics%
183         ;; Use graphics in callouts?
184         #f)
185
186         <!-- Convert " ... " to `` ... '' in the HTML output. -->
187         (element quote
188           (make sequence
189             (literal "&#8220;")
190             (process-children)
191             (literal "&#8221;")))
192
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))))
200             (case v
201               (("xorg")    (string-append u "&" "manpath=Xorg+&release.manpath.xorg;" ))
202               (("netbsd")  (string-append u "&" "manpath=NetBSD+&release.manpath.netbsd;"))
203               (("ports")   (string-append u "&" "manpath=FreeBSD+&release.manpath.freebsd-ports;"))
204               (else        (string-append u "&" "manpath=FreeBSD+&release.manpath.freebsd;")))))
205
206       ;; $paragraph$ function with arch attribute support.
207       (define ($paragraph$ #!optional (para-wrapper "P"))
208         (let ((footnotes (select-elements (descendants (current-node))
209                                           (normalize "footnote")))
210               (tgroup (have-ancestor? (normalize "tgroup")))
211               (arch (attribute-string (normalize "arch")))
212               (rev (attribute-string (normalize "revision")))
213               (role (attribute-string (normalize "role")))
214               (arch-string (entity-text "arch"))
215               (merged-string (entity-text "merged")))
216           (make sequence
217             (make element gi: para-wrapper
218                   attributes: (append
219                                (if %default-quadding%
220                                    (list (list "ALIGN" %default-quadding%))
221                                    '()))
222                   (make sequence
223                     (sosofo-append
224                      (if (and (not (equal? arch #f))
225                               (not (equal? arch ""))
226                               (not (equal? arch "all")))
227                          (make sequence
228                            (literal "[")
229                            (let loop ((prev (car (split-string-to-list arch)))
230                                       (rest (cdr (split-string-to-list arch))))
231                              (make sequence
232                                (literal prev)
233                                (if (not (null? rest))
234                                    (make sequence
235                                      (literal ", ")
236                                      (loop (car rest) (cdr rest)))
237                                    (empty-sosofo))))
238                            (literal "] "))
239                          (empty-sosofo))
240                      (process-children)
241                      (if (and (not (equal? rev #f))
242                               (not (equal? rev "")))
243                          (make sequence
244                            (literal "[")
245                            (let loop ((prev (car (split-string-to-list rev)))
246                                       (rest (cdr (split-string-to-list rev))))
247                              (make sequence
248                                (make element gi: "A"
249                                      attributes: (list
250                                                   (list "HREF" (string-append
251                                                                 "http://svn.freebsd.org/viewvc/base?view=revision&#38;revision="
252                                                                 prev))
253                                                   (list "TARGET" "_top"))
254                                      (literal "r")
255                                      (literal prev))
256                                (if (not (null? rest))
257                                    (make sequence
258                                      (literal ", ")
259                                      (loop (car rest) (cdr rest)))
260                                    (empty-sosofo))))
261                            (literal "] "))
262                          (empty-sosofo)))
263                     (if (and (not (null? role)) (equal? role "merged"))
264                         (literal " [" merged-string "]")
265                         (empty-sosofo))
266                     (if (or %footnotes-at-end% tgroup (node-list-empty? footnotes))
267                         (empty-sosofo)
268                         (make element gi: "BLOCKQUOTE"
269                               attributes: (list
270                                            (list "CLASS" "FOOTNOTES"))
271                               (with-mode footnote-mode
272                                 (process-node-list footnotes)))))))))
273     ]]>
274
275       (define (toc-depth nd)
276         (if (string=? (gi nd) (normalize "book"))
277             3
278             3))
279
280     </style-specification-body>
281   </style-specification>
282
283   <external-specification id="docbook" document="freebsd.dsl">
284 </style-sheet>