PageRenderTime 25ms CodeModel.GetById 12ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/release/doc/share/sgml/release.dsl

https://bitbucket.org/freebsd/freebsd-head/
Unknown | 225 lines | 210 code | 15 blank | 0 comment | 0 complexity | f3f828c6e3695c6d54c71f3378e2bfce MD5 | raw file
  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 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; We might have some sect1 level elements where the modification times
 48; are significant.  An example of this is the "What's New" section in
 49; the release notes.  We enable the printing of pubdate entry in
 50; sect1info elements to support this.
 51(element (sect1info pubdate) (process-children))
 52
 53    <![ %output.print; [
 54; Put URLs in footnotes, and put footnotes at the bottom of each page.
 55      (define bop-footnotes #t)
 56      (define %footnote-ulinks% #t)
 57
 58      (define ($paragraph$)
 59	(let  ((arch (attribute-string (normalize "arch")))
 60	       (role (attribute-string (normalize "role")))
 61	       (arch-string (entity-text "arch"))
 62	       (merged-string (entity-text "merged")))
 63	  (if (or (equal? (print-backend) 'tex)
 64		  (equal? (print-backend) #f))
 65	      ;; avoid using country: characteristic because of a JadeTeX bug...
 66	      (make paragraph
 67		first-line-start-indent: (if (is-first-para)
 68					     %para-indent-firstpara%
 69					     %para-indent%)
 70		space-before: %para-sep%
 71		space-after: (if (INLIST?)
 72				 0pt
 73				 %para-sep%)
 74		quadding: %default-quadding%
 75		hyphenate?: %hyphenation%
 76		language: (dsssl-language-code)
 77		(make sequence
 78		  (cond
 79		   ;; If arch= not specified, then print unconditionally.  This clause
 80		   ;; handles the majority of cases.
 81		   ((or (equal? arch #f)
 82			(equal? arch "")
 83			(equal? arch "all"))
 84		    (process-children-trim))
 85		   (else
 86		    (make sequence
 87		      (literal "[")
 88		      (let loop ((prev (car (split-string-to-list arch)))
 89				 (rest (cdr (split-string-to-list arch))))
 90			(make sequence
 91			  (literal prev)
 92			  (if (not (null? rest))
 93			      (make sequence
 94				(literal ", ")
 95				(loop (car rest) (cdr rest)))
 96			      (empty-sosofo))))
 97		      (literal "] ")
 98		      (process-children-trim))))
 99		  (if (and (not (null? role)) (equal? role "merged"))
100		      (literal " [" merged-string "]")
101		      (empty-sosofo))))
102	      (make paragraph
103		first-line-start-indent: (if (is-first-para)
104					     %para-indent-firstpara%
105					     %para-indent%)
106		space-before: %para-sep%
107		space-after: (if (INLIST?)
108				 0pt
109				 %para-sep%)
110		quadding: %default-quadding%
111		hyphenate?: %hyphenation%
112		language: (dsssl-language-code)
113		country: (dsssl-country-code)
114		(make sequence
115		  (cond
116		   ;; If arch= not specified, then print unconditionally.  This clause
117		   ;; handles the majority of cases.
118		   ((or (equal? arch #f)
119			(equal? arch "")
120			(equal? arch "all"))
121		    (process-children-trim))
122		   (else
123		    (make sequence
124		      (literal "[")
125		      (let loop ((prev (car (split-string-to-list arch)))
126				 (rest (cdr (split-string-to-list arch))))
127			(make sequence
128			  (literal prev)
129			  (if (not (null? rest))
130			      (make sequence
131				(literal ", ")
132				(loop (car rest) (cdr rest)))
133			      (empty-sosofo))))
134		      (literal "] ")
135		      (process-children-trim))))
136		  (if (and (not (null? role)) (equal? role "merged"))
137		      (literal " [" merged-string "]")
138		      (empty-sosofo)))))))
139    ]]>
140
141    <![ %output.html; [
142      (define %callout-graphics%
143	;; Use graphics in callouts?
144	#f)
145
146	<!-- Convert " ... " to `` ... '' in the HTML output. -->
147	(element quote
148	  (make sequence
149	    (literal "&#8220;")
150	    (process-children)
151	    (literal "&#8221;")))
152
153        <!-- Specify how to generate the man page link HREF -->
154        (define ($create-refentry-xref-link$ #!optional (n (current-node)))
155          (let* ((r (select-elements (children n) (normalize "refentrytitle")))
156                 (m (select-elements (children n) (normalize "manvolnum")))
157                 (v (attribute-string (normalize "vendor") n))
158                 (u (string-append "&release.man.url;?query="
159                         (data r) "&" "sektion=" (data m))))
160            (case v
161              (("xorg")    (string-append u "&" "manpath=Xorg+&release.manpath.xorg;" ))
162              (("netbsd")  (string-append u "&" "manpath=NetBSD+&release.manpath.netbsd;"))
163              (("ports")   (string-append u "&" "manpath=FreeBSD+&release.manpath.freebsd-ports;"))
164              (else        (string-append u "&" "manpath=FreeBSD+&release.manpath.freebsd;")))))
165
166      ;; $paragraph$ function with arch attribute support.
167      (define ($paragraph$ #!optional (para-wrapper "P"))
168	(let ((footnotes (select-elements (descendants (current-node))
169					  (normalize "footnote")))
170	      (tgroup (have-ancestor? (normalize "tgroup")))
171	      (arch (attribute-string (normalize "arch")))
172	      (role (attribute-string (normalize "role")))
173	      (arch-string (entity-text "arch"))
174	      (merged-string (entity-text "merged")))
175	  (make sequence
176	    (make element gi: para-wrapper
177		  attributes: (append
178			       (if %default-quadding%
179				   (list (list "ALIGN" %default-quadding%))
180				   '()))
181		  (make sequence
182		    (cond
183		     ;; If arch= not specified, then print unconditionally.  This clause
184		     ;; handles the majority of cases.
185		     ((or (equal? arch #f)
186			  (equal? arch "")
187			  (equal? arch "all"))
188		      (process-children))
189		     (else
190		      (sosofo-append
191		       (make sequence
192			 (literal "[")
193			 (let loop ((prev (car (split-string-to-list arch)))
194				    (rest (cdr (split-string-to-list arch))))
195			   (make sequence
196			     (literal prev)
197			     (if (not (null? rest))
198				 (make sequence
199				   (literal ", ")
200				   (loop (car rest) (cdr rest)))
201				 (empty-sosofo))))
202			 (literal "] ")
203			 (process-children)))))
204		    (if (and (not (null? role)) (equal? role "merged"))
205			(literal " [" merged-string "]")
206			(empty-sosofo))
207		    (if (or %footnotes-at-end% tgroup (node-list-empty? footnotes))
208			(empty-sosofo)
209			(make element gi: "BLOCKQUOTE"
210			      attributes: (list
211					   (list "CLASS" "FOOTNOTES"))
212			      (with-mode footnote-mode
213				(process-node-list footnotes)))))))))
214    ]]>
215
216      (define (toc-depth nd)
217        (if (string=? (gi nd) (normalize "book"))
218            3
219            3))
220
221    </style-specification-body>
222  </style-specification>
223
224  <external-specification id="docbook" document="freebsd.dsl">
225</style-sheet>