summaryrefslogtreecommitdiffstats
path: root/release/doc/share/sgml/release.dsl
blob: 66e9ae24a412fa111cf0fc814f40f06c906c1688 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<!-- $FreeBSD$ -->

<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY % output.html		"IGNORE">
<!ENTITY % output.print 	"IGNORE">
<!ENTITY freebsd.dsl PUBLIC "-//FreeBSD//DOCUMENT DocBook Stylesheet//EN" CDATA DSSSL>
<!ENTITY % release.ent PUBLIC "-//FreeBSD//ENTITIES Release Specification//EN">
%release.ent;
]>

<style-sheet>
  <style-specification use="docbook">
    <style-specification-body>

; String manipulation functions
(define (split-string-to-list STR)
  ;; return list of STR separated with char #\ or #\,
  (if (string? STR)
      (let loop ((i (string-delim-index STR)))
        (cond ((equal? (cdr i) '()) '())
              (else (cons (substring STR (list-ref i 0) (- (list-ref i 1) 1))
                          (loop (cdr i))))))
      '()))

(define (string-delim-index STR)
  ;; return indexes of STR separated with char #\ or #\,
  (if (string? STR)
      (let ((strlen (string-length STR)))
        (let loop ((i 0))
          (cond ((= i strlen) (cons (+ strlen 1) '()))
                ((= i 0)      (cons i (loop (+ i 1))))
                ((or (equal? (string-ref STR i) #\ )
                     (equal? (string-ref STR i) #\,)) (cons (+ i 1) (loop (+ i 1))))
                (else (loop (+ i 1))))))
      '()
      ))

(define (string-list-match? STR STR-LIST)
  (let loop ((s STR-LIST))
    (cond
     ((equal? s #f) #f)
     ((equal? s '()) #f)
     ((equal? (car s) #f) #f)
     ((equal? STR (car s)) #t)
     (else (loop (cdr s))))))

; We might have some sect1 level elements where the modification times
; are significant.  An example of this is the "What's New" section in
; the release notes.  We enable the printing of pubdate entry in
; sect1info elements to support this.
(element (sect1info pubdate) (process-children))

    <![ %output.print; [
; Put URLs in footnotes, and put footnotes at the bottom of each page.
      (define bop-footnotes #t)
      (define %footnote-ulinks% #t)

      (define ($paragraph$)
	(let  ((arch (attribute-string (normalize "arch")))
	       (role (attribute-string (normalize "role")))
	       (arch-string (entity-text "arch"))
	       (merged-string (entity-text "merged")))
	  (if (or (equal? (print-backend) 'tex)
		  (equal? (print-backend) #f))
	      ;; avoid using country: characteristic because of a JadeTeX bug...
	      (make paragraph
		first-line-start-indent: (if (is-first-para)
					     %para-indent-firstpara%
					     %para-indent%)
		space-before: %para-sep%
		space-after: (if (INLIST?)
				 0pt
				 %para-sep%)
		quadding: %default-quadding%
		hyphenate?: %hyphenation%
		language: (dsssl-language-code)
		(make sequence
		  (cond
		   ;; If arch= not specified, then print unconditionally.  This clause
		   ;; handles the majority of cases.
		   ((or (equal? arch #f)
			(equal? arch "")
			(equal? arch "all"))
		    (process-children-trim))
		   (else
		    (make sequence
		      (literal "[")
		      (let loop ((prev (car (split-string-to-list arch)))
				 (rest (cdr (split-string-to-list arch))))
			(make sequence
			  (literal prev)
			  (if (not (null? rest))
			      (make sequence
				(literal ", ")
				(loop (car rest) (cdr rest)))
			      (empty-sosofo))))
		      (literal "] ")
		      (process-children-trim))))
		  (if (and (not (null? role)) (equal? role "merged"))
		      (literal " [" merged-string "]")
		      (empty-sosofo))))
	      (make paragraph
		first-line-start-indent: (if (is-first-para)
					     %para-indent-firstpara%
					     %para-indent%)
		space-before: %para-sep%
		space-after: (if (INLIST?)
				 0pt
				 %para-sep%)
		quadding: %default-quadding%
		hyphenate?: %hyphenation%
		language: (dsssl-language-code)
		country: (dsssl-country-code)
		(make sequence
		  (cond
		   ;; If arch= not specified, then print unconditionally.  This clause
		   ;; handles the majority of cases.
		   ((or (equal? arch #f)
			(equal? arch "")
			(equal? arch "all"))
		    (process-children-trim))
		   (else
		    (make sequence
		      (literal "[")
		      (let loop ((prev (car (split-string-to-list arch)))
				 (rest (cdr (split-string-to-list arch))))
			(make sequence
			  (literal prev)
			  (if (not (null? rest))
			      (make sequence
				(literal ", ")
				(loop (car rest) (cdr rest)))
			      (empty-sosofo))))
		      (literal "] ")
		      (process-children-trim))))
		  (if (and (not (null? role)) (equal? role "merged"))
		      (literal " [" merged-string "]")
		      (empty-sosofo)))))))
    ]]>

    <![ %output.html; [
      (define %callout-graphics%
	;; Use graphics in callouts?
	#f)

	<!-- Convert " ... " to `` ... '' in the HTML output. -->
	(element quote
	  (make sequence
	    (literal "&#8220;")
	    (process-children)
	    (literal "&#8221;")))

        <!-- Specify how to generate the man page link HREF -->
        (define ($create-refentry-xref-link$ #!optional (n (current-node)))
          (let* ((r (select-elements (children n) (normalize "refentrytitle")))
                 (m (select-elements (children n) (normalize "manvolnum")))
                 (v (attribute-string (normalize "vendor") n))
                 (u (string-append "&release.man.url;?query="
                         (data r) "&" "sektion=" (data m))))
            (case v
              (("xorg")    (string-append u "&" "manpath=Xorg+&release.manpath.xorg;" ))
              (("netbsd")  (string-append u "&" "manpath=NetBSD+&release.manpath.netbsd;"))
              (("ports")   (string-append u "&" "manpath=FreeBSD+&release.manpath.freebsd-ports;"))
              (else        (string-append u "&" "manpath=FreeBSD+&release.manpath.freebsd;")))))

      ;; $paragraph$ function with arch attribute support.
      (define ($paragraph$ #!optional (para-wrapper "P"))
	(let ((footnotes (select-elements (descendants (current-node))
					  (normalize "footnote")))
	      (tgroup (have-ancestor? (normalize "tgroup")))
	      (arch (attribute-string (normalize "arch")))
	      (role (attribute-string (normalize "role")))
	      (arch-string (entity-text "arch"))
	      (merged-string (entity-text "merged")))
	  (make sequence
	    (make element gi: para-wrapper
		  attributes: (append
			       (if %default-quadding%
				   (list (list "ALIGN" %default-quadding%))
				   '()))
		  (make sequence
		    (cond
		     ;; If arch= not specified, then print unconditionally.  This clause
		     ;; handles the majority of cases.
		     ((or (equal? arch #f)
			  (equal? arch "")
			  (equal? arch "all"))
		      (process-children))
		     (else
		      (sosofo-append
		       (make sequence
			 (literal "[")
			 (let loop ((prev (car (split-string-to-list arch)))
				    (rest (cdr (split-string-to-list arch))))
			   (make sequence
			     (literal prev)
			     (if (not (null? rest))
				 (make sequence
				   (literal ", ")
				   (loop (car rest) (cdr rest)))
				 (empty-sosofo))))
			 (literal "] ")
			 (process-children)))))
		    (if (and (not (null? role)) (equal? role "merged"))
			(literal " [" merged-string "]")
			(empty-sosofo))
		    (if (or %footnotes-at-end% tgroup (node-list-empty? footnotes))
			(empty-sosofo)
			(make element gi: "BLOCKQUOTE"
			      attributes: (list
					   (list "CLASS" "FOOTNOTES"))
			      (with-mode footnote-mode
				(process-node-list footnotes)))))))))
    ]]>

      (define (toc-depth nd)
        (if (string=? (gi nd) (normalize "book"))
            3
            3))

    </style-specification-body>
  </style-specification>

  <external-specification id="docbook" document="freebsd.dsl">
</style-sheet>
OpenPOWER on IntegriCloud