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 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368
|
;; -*- Scheme -*-
;;
;; $Id: common.dsl.in,v 1.13 2006/01/15 13:55:26 hholzgra Exp $
;;
;; This file contains stylesheet customization common to the HTML
;; and print versions.
;;
;; Stylesheets Localization
(define %default-language% "@LANG@")
(define %root-filename% "index")
(define %use-id-as-filename% #t)
(define %gentext-nav-tblwidth% "100%")
(define %refentry-function% #t)
(define %refentry-generate-name% #f)
(define %funcsynopsis-style% 'ansi)
(define ($legalnotice-link-file$ legalnotice)
(string-append "copyright" %html-ext%))
(define %generate-legalnotice-link% #t)
(define %footnotes-at-end% #t)
(define %force-chapter-toc% #t)
(define newline "\U-000D")
(define %number-programlisting-lines% #f)
(define %linenumber-mod% 1)
(define %shade-verbatim% #t)
(define %prefers-ordinal-label-name-format% @NUMBER_FIRST@)
(define ($generate-book-lot-list$) (list))
;; these are used for unix manpage linking in html-common.dsl
(define %manpage-url-base% "http://www.opengroup.org/onlinepubs/007908799/xsh/")
(define %manpage-url-ext% ".html")
(define (php-code code)
(make processing-instruction
data: (string-append "php " code "?")))
(define quicksort
(quicksort::generic null? car cdr append cons '()))
(define nl-quicksort
(quicksort::generic node-list-empty?
node-list-first
node-list-rest
node-list
node-list
(empty-node-list)))
(define quicksort::generic
(lambda(is-null? first others concat add empty)
(letrec ((collect
;; Collect is an helper function doing the real work
(lambda (pivot ls lgroup rgroup less?)
(if (is-null? ls)
(concat (impl lgroup less?)
(add pivot (impl rgroup less?)))
(if (less? pivot (first ls))
(collect pivot (others ls) lgroup
(add (first ls) rgroup)
less?)
(collect pivot (others ls)
(add (first ls) lgroup)
rgroup
less?)))))
(impl
;; impl first test some trivial sorting case and then call
;; the procedure collect
(lambda (ls less?)
(if (or (is-null? ls) (is-null? (others ls)))
ls
(collect (first ls) (others ls) empty empty less?)))))
;; we return the new defined procedure
impl)))
;; Polish definitions
(define (gentext-pl-nav-next next)
(make sequence (literal "Nast\U-0119;pny")))
(define (book-titlepage-recto-elements)
(list (normalize "title")
(normalize "subtitle")
(normalize "graphic")
(normalize "mediaobject")
(normalize "corpauthor")
(normalize "authorgroup")
(normalize "author")
(normalize "editor")
(normalize "pubdate")
(normalize "copyright")
(normalize "abstract")
(normalize "legalnotice")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
;;;; render function prototypes, esp. with optional arguments
;;;; for new docbook4 methodsynopsis tag and friends
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; helper function generating closing optional brackets
(define (methodsynopsis-generate-closing-optionals nl)
(if (node-list-empty? nl)
(empty-sosofo) ;; empty list -> do nothing
(make sequence ;; process list node
(if (or (and (attribute-string (normalize "choice") (node-list-first nl))
(string=? "opt" (attribute-string (normalize "choice") (node-list-first nl)))
)
(has-default-value (node-list-first nl)))
(literal %arg-choice-opt-close-str%) ;; is optional parameter -> close a bracket
(empty-sosofo)
)
(methodsynopsis-generate-closing-optionals (node-list-rest nl)) ;; process rest of list
)
)
)
(define (is-true-optional nl)
(and (equal? (gi (parent nl)) (normalize "parameter"))
(equal? 0 (string-length (strip (data (preced nl)))))
(equal? 0 (string-length (strip (data (follow nl)))))
)
)
(define (has-true-optional nl)
(is-true-optional
(node-list-first-element
(select-elements
(descendants nl)
(normalize "optional"))
)
)
)
(define (count-true-optionals nl)
(let loop
((result 0)
(nl (select-elements (descendants nl) (normalize "optional")))
)
(if(node-list-empty? nl)
result
(if(is-true-optional(node-list-first nl))
(loop (+ result 1) (node-list-rest nl))
(loop result (node-list-rest nl))
)
)
)
)
(define (has-default-value nl)
(not (node-list-empty? ( select-elements (descendants nl) (normalize "initializer"))))
)
;; render classsynopsis
(element classsynopsis
(make sequence
(literal "class ")
(process-children-trim)
(literal "}")
)
)
(element ooclass (make sequence (process-children)))
(element (ooclass classname)
(make sequence
($bold-seq$
(process-children-trim)
)
(literal " { ")
(linebreak)
)
)
;; render methodsynopsis
(element methodsynopsis
(make sequence
(process-children) ;; render content
(methodsynopsis-generate-closing-optionals (children (current-node))) ;; close optional brackets
(literal " )") ;; close parameter list
(linebreak)
)
)
(element constructorsynopsis
(make sequence
(process-children) ;; render content
(methodsynopsis-generate-closing-optionals (children (current-node))) ;; close optional brackets
(literal " )") ;; close parameter list
(linebreak)
)
)
;; render return type
(element (methodsynopsis type)
(make sequence
(process-children-trim)
(literal " ")
)
)
;; render function name
(element (methodsynopsis methodname)
(make sequence
($bold-seq$
(process-children-trim)
)
(literal " ( ") ;; start parameter list
)
)
(element (constructorsynopsis methodname)
(make sequence
($bold-seq$
(process-children-trim)
)
(literal " ( ") ;; start parameter list
)
)
;; render parameters
(element (methodsynopsis methodparam)
(make sequence
;; special case -> first parameter is optional
(if (equal? (gi (ipreced (current-node))) (normalize "methodparam"))
(empty-sosofo) ;; have prev. parameters -> is not first
(if (or (equal? (attribute-string (normalize "choice")) "opt")
(has-default-value (current-node))
)
(literal %arg-choice-opt-open-str%) ;; generate opening bracket
(empty-sosofo)
)
)
(process-children-trim)
;; have more parameters following me?
(if (equal? (gi (ifollow (current-node))) (normalize "methodparam"))
(make sequence
;; is next parameter optional?
(if (or (equal? (attribute-string (normalize "choice") (ifollow (current-node))) "opt")
(has-default-value (ifollow (current-node)))
)
(make sequence
(literal " ")
(literal %arg-choice-opt-open-str%)
)
(empty-sosofo)
)
;; parameter list separator
(literal ", ")
)
(empty-sosofo)
)
)
)
;; render parameters
(element (constructorsynopsis methodparam)
(make sequence
;; special case -> first parameter is optional
(if (equal? (gi (ipreced (current-node))) (normalize "methodparam"))
(empty-sosofo) ;; have prev. parameters -> is not first
(if (or (equal? (attribute-string (normalize "choice")) "opt")
(has-default-value (current-node))
)
(literal %arg-choice-opt-open-str%) ;; generate opening bracket
(empty-sosofo)
)
)
(process-children-trim)
;; have more parameters following me?
(if (equal? (gi (ifollow (current-node))) (normalize "methodparam"))
(make sequence
;; is next parameter optional?
(if (or (equal? (attribute-string (normalize "choice") (ifollow (current-node))) "opt")
(has-default-value (ifollow (current-node)))
)
(make sequence
(literal " ")
(literal %arg-choice-opt-open-str%)
)
(empty-sosofo)
)
;; parameter list separator
(literal ", ")
)
(empty-sosofo)
)
)
)
;; special "void" return type tag
(element (methodsynopsis void)
(literal "void ")
)
;; render parameter type
(element (methodparam type)
(make sequence
(process-children-trim)
(literal " ")
)
)
;; render parameter name
(element (methodparam parameter)
(make sequence
(if (equal? (attribute-string (normalize "role")) "reference")
(make sequence
(literal "&")
(process-children-trim)
)
(process-children-trim)
)
)
)
;; render default value
(element (methodparam initializer)
(make sequence
(literal "=")
($italic-seq$ (process-children-trim))
)
)
;; render fieldsynopsis
(element fieldsynopsis
(make sequence
(process-children)
(linebreak)
)
)
(element (fieldsynopsis type)
(make sequence
(process-children-trim)
(literal " ")
)
)
(element (fieldsynopsis varname)
(make sequence
(process-children-trim)
)
)
;; render SGML tags
(element sgmltag
(make sequence
($bold-seq$ (literal "<"))
($bold-seq$ (process-children))
($bold-seq$ (literal ">"))
)
)
|