Initial import from FreeBSD RELENG_4:
[dragonfly.git] / release / doc / share / sgml / release.dsl
1 <!-- $FreeBSD: src/release/doc/share/sgml/release.dsl,v 1.2.2.4 2003/06/11 21:04:44 hrs Exp $ -->
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 freebsd.dsl PUBLIC "-//FreeBSD//DOCUMENT DocBook Stylesheet//EN" CDATA DSSSL>
7 <!ENTITY % release.ent PUBLIC "-//FreeBSD//ENTITIES Release Specification//EN">
8 %release.ent;
9 ]>
10
11 <style-sheet>
12   <style-specification use="docbook">
13     <style-specification-body>
14
15 ; String manipulation functions
16 (define (split-string-to-list STR)
17   ;; return list of STR separated with char #\ or #\,
18   (if (string? STR)
19       (let loop ((i (string-delim-index STR)))
20         (cond ((equal? (cdr i) '()) '())
21               (else (cons (substring STR (list-ref i 0) (- (list-ref i 1) 1))
22                           (loop (cdr i))))))
23       '()))
24
25 (define (string-delim-index STR)
26   ;; return indexes of STR separated with char #\ or #\,
27   (if (string? STR)
28       (let ((strlen (string-length STR)))
29         (let loop ((i 0))
30           (cond ((= i strlen) (cons (+ strlen 1) '()))
31                 ((= i 0)      (cons i (loop (+ i 1))))
32                 ((or (equal? (string-ref STR i) #\ )
33                      (equal? (string-ref STR i) #\,)) (cons (+ i 1) (loop (+ i 1))))
34                 (else (loop (+ i 1))))))
35       '()
36       ))
37
38 (define (string-list-match? STR STR-LIST)
39   (let loop ((s STR-LIST))
40     (cond
41      ((equal? s #f) #f)
42      ((equal? s '()) #f)
43      ((equal? (car s) #f) #f)
44      ((equal? STR (car s)) #t)
45      (else (loop (cdr s))))))
46
47 ; Deal with conditional inclusion of text via entities.
48 (default
49   (let* ((arch (attribute-string (normalize "arch")))
50          (for-arch (entity-text "arch")))
51     (cond
52
53      ; If arch= not specified, then print unconditionally.  This clause
54      ; handles the majority of cases.
55      ((or (equal? arch #f) (equal? arch ""))
56       (next-match))
57
58      ; arch= specified, see if it's equal to "all".  If so, then
59      ; print unconditionally.  Note that this clause could be
60      ; combined with the check to see if arch= wasn't specified
61      ; or was empty; they have the same outcome.
62      ((equal? arch "all")
63       (next-match))
64
65      ; arch= specified.  If we're building for all architectures,
66      ; then print it prepended with the set of architectures to which
67      ; this element applies.
68      ;
69      ; XXX This doesn't work.
70 ;     ((equal? for-arch "all")
71 ;      (sosofo-append (literal "[") (literal arch) (literal "] ")
72 ;                    (process-children)))
73
74      ; arch= specified, so we need to check to see if the specified
75      ; parameter includes the architecture we're building for.
76      ((string-list-match? for-arch (split-string-to-list arch))
77       (next-match))
78
79      ; None of the above
80      (else (empty-sosofo)))))
81
82 ; We might have some sect1 level elements where the modification times
83 ; are significant.  An example of this is the "What's New" section in
84 ; the release notes.  We enable the printing of pubdate entry in
85 ; sect1info elements to support this.
86 (element (sect1info pubdate) (process-children))
87
88     <![ %output.print; [
89 ; Put URLs in footnotes, and put footnotes at the bottom of each page.
90       (define bop-footnotes #t)
91       (define %footnote-ulinks% #t)
92     ]]>
93
94     <![ %output.html; [
95         <!-- Convert " ... " to `` ... '' in the HTML output. -->
96         (element quote
97           (make sequence
98             (literal "``")
99             (process-children)
100             (literal "''")))
101
102         <!-- Specify how to generate the man page link HREF -->
103         (define ($create-refentry-xref-link$ #!optional (n (current-node)))
104           (let* ((r (select-elements (children n) (normalize "refentrytitle")))
105                  (m (select-elements (children n) (normalize "manvolnum")))
106                  (v (attribute-string (normalize "vendor") n))
107                  (u (string-append "http://www.FreeBSD.org/cgi/man.cgi?query="
108                          (data r) "&" "sektion=" (data m))))
109             (case v
110               (("xfree86") (string-append u "&" "manpath=XFree86+&release.manpath.xfree86;" ))
111               (("netbsd")  (string-append u "&" "manpath=NetBSD+&release.manpath.netbsd;"))
112               (("ports")   (string-append u "&" "manpath=FreeBSD+&release.manpath.freebsd-ports;"))
113               (else        (string-append u "&" "manpath=FreeBSD+&release.manpath.freebsd;")))))
114     ]]>
115
116       (define (toc-depth nd)
117         (if (string=? (gi nd) (normalize "book"))
118             3
119             3))
120
121     </style-specification-body>
122   </style-specification>
123
124   <external-specification id="docbook" document="freebsd.dsl">
125 </style-sheet>
126