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