/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. <!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
  3. <!ENTITY % output.html "IGNORE">
  4. <!ENTITY % output.print "IGNORE">
  5. <!ENTITY freebsd.dsl PUBLIC "-//FreeBSD//DOCUMENT DocBook Stylesheet//EN" CDATA DSSSL>
  6. <!ENTITY % release.ent PUBLIC "-//FreeBSD//ENTITIES Release Specification//EN">
  7. %release.ent;
  8. ]>
  9. <style-sheet>
  10. <style-specification use="docbook">
  11. <style-specification-body>
  12. ; String manipulation functions
  13. (define (split-string-to-list STR)
  14. ;; return list of STR separated with char #\ or #\,
  15. (if (string? STR)
  16. (let loop ((i (string-delim-index STR)))
  17. (cond ((equal? (cdr i) '()) '())
  18. (else (cons (substring STR (list-ref i 0) (- (list-ref i 1) 1))
  19. (loop (cdr i))))))
  20. '()))
  21. (define (string-delim-index STR)
  22. ;; return indexes of STR separated with char #\ or #\,
  23. (if (string? STR)
  24. (let ((strlen (string-length STR)))
  25. (let loop ((i 0))
  26. (cond ((= i strlen) (cons (+ strlen 1) '()))
  27. ((= i 0) (cons i (loop (+ i 1))))
  28. ((or (equal? (string-ref STR i) #\ )
  29. (equal? (string-ref STR i) #\,)) (cons (+ i 1) (loop (+ i 1))))
  30. (else (loop (+ i 1))))))
  31. '()
  32. ))
  33. (define (string-list-match? STR STR-LIST)
  34. (let loop ((s STR-LIST))
  35. (cond
  36. ((equal? s #f) #f)
  37. ((equal? s '()) #f)
  38. ((equal? (car s) #f) #f)
  39. ((equal? STR (car s)) #t)
  40. (else (loop (cdr s))))))
  41. ; We might have some sect1 level elements where the modification times
  42. ; are significant. An example of this is the "What's New" section in
  43. ; the release notes. We enable the printing of pubdate entry in
  44. ; sect1info elements to support this.
  45. (element (sect1info pubdate) (process-children))
  46. <![ %output.print; [
  47. ; Put URLs in footnotes, and put footnotes at the bottom of each page.
  48. (define bop-footnotes #t)
  49. (define %footnote-ulinks% #t)
  50. (define ($paragraph$)
  51. (let ((arch (attribute-string (normalize "arch")))
  52. (role (attribute-string (normalize "role")))
  53. (arch-string (entity-text "arch"))
  54. (merged-string (entity-text "merged")))
  55. (if (or (equal? (print-backend) 'tex)
  56. (equal? (print-backend) #f))
  57. ;; avoid using country: characteristic because of a JadeTeX bug...
  58. (make paragraph
  59. first-line-start-indent: (if (is-first-para)
  60. %para-indent-firstpara%
  61. %para-indent%)
  62. space-before: %para-sep%
  63. space-after: (if (INLIST?)
  64. 0pt
  65. %para-sep%)
  66. quadding: %default-quadding%
  67. hyphenate?: %hyphenation%
  68. language: (dsssl-language-code)
  69. (make sequence
  70. (cond
  71. ;; If arch= not specified, then print unconditionally. This clause
  72. ;; handles the majority of cases.
  73. ((or (equal? arch #f)
  74. (equal? arch "")
  75. (equal? arch "all"))
  76. (process-children-trim))
  77. (else
  78. (make sequence
  79. (literal "[")
  80. (let loop ((prev (car (split-string-to-list arch)))
  81. (rest (cdr (split-string-to-list arch))))
  82. (make sequence
  83. (literal prev)
  84. (if (not (null? rest))
  85. (make sequence
  86. (literal ", ")
  87. (loop (car rest) (cdr rest)))
  88. (empty-sosofo))))
  89. (literal "] ")
  90. (process-children-trim))))
  91. (if (and (not (null? role)) (equal? role "merged"))
  92. (literal " [" merged-string "]")
  93. (empty-sosofo))))
  94. (make paragraph
  95. first-line-start-indent: (if (is-first-para)
  96. %para-indent-firstpara%
  97. %para-indent%)
  98. space-before: %para-sep%
  99. space-after: (if (INLIST?)
  100. 0pt
  101. %para-sep%)
  102. quadding: %default-quadding%
  103. hyphenate?: %hyphenation%
  104. language: (dsssl-language-code)
  105. country: (dsssl-country-code)
  106. (make sequence
  107. (cond
  108. ;; If arch= not specified, then print unconditionally. This clause
  109. ;; handles the majority of cases.
  110. ((or (equal? arch #f)
  111. (equal? arch "")
  112. (equal? arch "all"))
  113. (process-children-trim))
  114. (else
  115. (make sequence
  116. (literal "[")
  117. (let loop ((prev (car (split-string-to-list arch)))
  118. (rest (cdr (split-string-to-list arch))))
  119. (make sequence
  120. (literal prev)
  121. (if (not (null? rest))
  122. (make sequence
  123. (literal ", ")
  124. (loop (car rest) (cdr rest)))
  125. (empty-sosofo))))
  126. (literal "] ")
  127. (process-children-trim))))
  128. (if (and (not (null? role)) (equal? role "merged"))
  129. (literal " [" merged-string "]")
  130. (empty-sosofo)))))))
  131. ]]>
  132. <![ %output.html; [
  133. (define %callout-graphics%
  134. ;; Use graphics in callouts?
  135. #f)
  136. <!-- Convert " ... " to `` ... '' in the HTML output. -->
  137. (element quote
  138. (make sequence
  139. (literal "&#8220;")
  140. (process-children)
  141. (literal "&#8221;")))
  142. <!-- Specify how to generate the man page link HREF -->
  143. (define ($create-refentry-xref-link$ #!optional (n (current-node)))
  144. (let* ((r (select-elements (children n) (normalize "refentrytitle")))
  145. (m (select-elements (children n) (normalize "manvolnum")))
  146. (v (attribute-string (normalize "vendor") n))
  147. (u (string-append "&release.man.url;?query="
  148. (data r) "&" "sektion=" (data m))))
  149. (case v
  150. (("xorg") (string-append u "&" "manpath=Xorg+&release.manpath.xorg;" ))
  151. (("netbsd") (string-append u "&" "manpath=NetBSD+&release.manpath.netbsd;"))
  152. (("ports") (string-append u "&" "manpath=FreeBSD+&release.manpath.freebsd-ports;"))
  153. (else (string-append u "&" "manpath=FreeBSD+&release.manpath.freebsd;")))))
  154. ;; $paragraph$ function with arch attribute support.
  155. (define ($paragraph$ #!optional (para-wrapper "P"))
  156. (let ((footnotes (select-elements (descendants (current-node))
  157. (normalize "footnote")))
  158. (tgroup (have-ancestor? (normalize "tgroup")))
  159. (arch (attribute-string (normalize "arch")))
  160. (role (attribute-string (normalize "role")))
  161. (arch-string (entity-text "arch"))
  162. (merged-string (entity-text "merged")))
  163. (make sequence
  164. (make element gi: para-wrapper
  165. attributes: (append
  166. (if %default-quadding%
  167. (list (list "ALIGN" %default-quadding%))
  168. '()))
  169. (make sequence
  170. (cond
  171. ;; If arch= not specified, then print unconditionally. This clause
  172. ;; handles the majority of cases.
  173. ((or (equal? arch #f)
  174. (equal? arch "")
  175. (equal? arch "all"))
  176. (process-children))
  177. (else
  178. (sosofo-append
  179. (make sequence
  180. (literal "[")
  181. (let loop ((prev (car (split-string-to-list arch)))
  182. (rest (cdr (split-string-to-list arch))))
  183. (make sequence
  184. (literal prev)
  185. (if (not (null? rest))
  186. (make sequence
  187. (literal ", ")
  188. (loop (car rest) (cdr rest)))
  189. (empty-sosofo))))
  190. (literal "] ")
  191. (process-children)))))
  192. (if (and (not (null? role)) (equal? role "merged"))
  193. (literal " [" merged-string "]")
  194. (empty-sosofo))
  195. (if (or %footnotes-at-end% tgroup (node-list-empty? footnotes))
  196. (empty-sosofo)
  197. (make element gi: "BLOCKQUOTE"
  198. attributes: (list
  199. (list "CLASS" "FOOTNOTES"))
  200. (with-mode footnote-mode
  201. (process-node-list footnotes)))))))))
  202. ]]>
  203. (define (toc-depth nd)
  204. (if (string=? (gi nd) (normalize "book"))
  205. 3
  206. 3))
  207. </style-specification-body>
  208. </style-specification>
  209. <external-specification id="docbook" document="freebsd.dsl">
  210. </style-sheet>