[20744] | 1 | <!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [ |
---|
| 2 | <!ENTITY dbstyle PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA DSSSL> |
---|
| 3 | ]> |
---|
| 4 | |
---|
| 5 | <style-sheet> |
---|
| 6 | <style-specification use="docbook"> |
---|
| 7 | <style-specification-body> |
---|
| 8 | |
---|
| 9 | (define gtkdoc-version "") |
---|
| 10 | (define gtkdoc-bookname "") |
---|
| 11 | |
---|
| 12 | ;; These are some customizations to the standard HTML output produced by the |
---|
| 13 | ;; Modular DocBook Stylesheets. |
---|
| 14 | ;; I've copied parts of a few functions from the stylesheets so these should |
---|
| 15 | ;; be checked occasionally to ensure they are up to date. |
---|
| 16 | ;; |
---|
| 17 | ;; The last check was with version 1.40 of the stylesheets. |
---|
| 18 | ;; It will not work with versions < 1.19 since the $shade-verbatim-attr$ |
---|
| 19 | ;; function was added then. Versions 1.19 to 1.39 may be OK, if you're lucky! |
---|
| 20 | |
---|
| 21 | ;;(define %generate-book-toc% #f) |
---|
| 22 | |
---|
| 23 | ;; If a Chapter has role="no-toc" we don't generate a table of contents. |
---|
| 24 | ;; This is useful if a better contents page has been added manually, e.g. for |
---|
| 25 | ;; the GTK+ Widgets & Objects page. (But it is a bit of a hack.) |
---|
| 26 | (define ($generate-chapter-toc$) |
---|
| 27 | (not (equal? (attribute-string (normalize "role") (current-node)) "no-toc"))) |
---|
| 28 | |
---|
| 29 | (define %chapter-autolabel% |
---|
| 30 | ;; Are chapters enumerated? |
---|
| 31 | #f) |
---|
| 32 | |
---|
| 33 | (define %use-id-as-filename% #t) |
---|
| 34 | |
---|
| 35 | (define %html-ext% ".html") |
---|
| 36 | |
---|
| 37 | (define ($user-html-header$ #!optional |
---|
| 38 | (home (empty-node-list)) |
---|
| 39 | (up (empty-node-list)) |
---|
| 40 | (prev (empty-node-list)) |
---|
| 41 | (next (empty-node-list))) |
---|
| 42 | (make sequence |
---|
| 43 | (if (not (string=? gtkdoc-version "")) |
---|
| 44 | (make empty-element gi: "META" |
---|
| 45 | attributes: (list |
---|
| 46 | (list "NAME" "GENERATOR") |
---|
| 47 | (list "CONTENT" (string-append |
---|
| 48 | "GTK-Doc V" |
---|
| 49 | gtkdoc-version |
---|
| 50 | " (SGML mode)")))) |
---|
| 51 | (empty-sosofo)) |
---|
| 52 | (make element gi: "STYLE" |
---|
| 53 | attributes: (list (list "TYPE" "text/css")) |
---|
| 54 | (literal ".synopsis, .classsynopsis { |
---|
| 55 | background: #eeeeee; |
---|
| 56 | border: solid 1px #aaaaaa; |
---|
| 57 | padding: 0.5em; |
---|
| 58 | } |
---|
| 59 | .programlisting { |
---|
| 60 | background: #eeeeff; |
---|
| 61 | border: solid 1px #aaaaff; |
---|
| 62 | padding: 0.5em; |
---|
| 63 | } |
---|
| 64 | .variablelist { |
---|
| 65 | padding: 4px; |
---|
| 66 | margin-left: 3em; |
---|
| 67 | } |
---|
| 68 | .navigation { |
---|
| 69 | background: #ffeeee; |
---|
| 70 | border: solid 1px #ffaaaa; |
---|
| 71 | margin-top: 0.5em; |
---|
| 72 | margin-bottom: 0.5em; |
---|
| 73 | } |
---|
| 74 | .navigation a { |
---|
| 75 | color: #770000; |
---|
| 76 | } |
---|
| 77 | .navigation a:visited { |
---|
| 78 | color: #550000; |
---|
| 79 | } |
---|
| 80 | .navigation .title { |
---|
| 81 | font-size: 200%; |
---|
| 82 | }")))) |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | (mode book-titlepage-recto-mode |
---|
| 86 | (element title |
---|
| 87 | (make element gi: "TABLE" |
---|
| 88 | attributes: (list |
---|
| 89 | (list "CLASS" "navigation") |
---|
| 90 | (list "WIDTH" %gentext-nav-tblwidth%) |
---|
| 91 | (list "CELLPADDING" "2") |
---|
| 92 | (list "CELLSPACING" "0")) |
---|
| 93 | (make element gi: "TR" |
---|
| 94 | (make element gi: "TH" |
---|
| 95 | attributes: (list |
---|
| 96 | (list "ALIGN" "center") |
---|
| 97 | (list "VALIGN" "MIDDLE")) |
---|
| 98 | (make element gi: "P" |
---|
| 99 | attributes: (list (list "CLASS" (gi))) |
---|
| 100 | (process-children-trim) |
---|
| 101 | (make empty-element gi: "A" |
---|
| 102 | attributes: (list (list "NAME" (element-id)))))))))) |
---|
| 103 | |
---|
| 104 | (define (book-titlepage-separator side) |
---|
| 105 | (empty-sosofo)) |
---|
| 106 | |
---|
| 107 | |
---|
| 108 | ;; This overrides the variablelist definition (copied from 1.76, |
---|
| 109 | ;; dblists.dsl). It changes the table background color, cell spacing |
---|
| 110 | ;; and cell padding. |
---|
| 111 | ;; |
---|
| 112 | ;; I have also removed the code to handle the non-table case. |
---|
| 113 | (element variablelist |
---|
| 114 | (make sequence |
---|
| 115 | (if %spacing-paras% |
---|
| 116 | (make element gi: "P" (empty-sosofo)) |
---|
| 117 | (empty-sosofo)) |
---|
| 118 | (para-check) |
---|
| 119 | |
---|
| 120 | (make element gi: "TABLE" |
---|
| 121 | attributes: '(("CLASS" "variablelist") |
---|
| 122 | ("BORDER" "0") |
---|
| 123 | ("CELLSPACING" "0") |
---|
| 124 | ("CELLPADDING" "4")) |
---|
| 125 | (if %html40% |
---|
| 126 | (make element gi: "TBODY" |
---|
| 127 | (with-mode variablelist-table |
---|
| 128 | (process-children))) |
---|
| 129 | (with-mode variablelist-table |
---|
| 130 | (process-children)))) |
---|
| 131 | (para-check 'restart))) |
---|
| 132 | |
---|
| 133 | (mode variablelist-table |
---|
| 134 | (element (variablelist title) |
---|
| 135 | (make element gi: "TR" |
---|
| 136 | attributes: '(("CLASS" "TITLE")) |
---|
| 137 | (make element gi: "TH" |
---|
| 138 | attributes: '(("ALIGN" "LEFT") |
---|
| 139 | ("VALIGN" "TOP") |
---|
| 140 | ("COLSPAN" "2")) |
---|
| 141 | (process-children)))) |
---|
| 142 | |
---|
| 143 | (element varlistentry |
---|
| 144 | (let* ((terms (select-elements (children (current-node)) |
---|
| 145 | (normalize "term"))) |
---|
| 146 | (listitem (select-elements (children (current-node)) |
---|
| 147 | (normalize "listitem")))) |
---|
| 148 | |
---|
| 149 | (make element gi: "TR" |
---|
| 150 | (make element gi: "TD" |
---|
| 151 | attributes: '(("ALIGN" "LEFT") |
---|
| 152 | ("VALIGN" "TOP")) |
---|
| 153 | (make empty-element gi: "A" |
---|
| 154 | attributes: (list |
---|
| 155 | (list "NAME" (element-id)))) |
---|
| 156 | (process-node-list terms)) |
---|
| 157 | (make element gi: "TD" |
---|
| 158 | attributes: '(("ALIGN" "LEFT") |
---|
| 159 | ("VALIGN" "TOP")) |
---|
| 160 | (process-node-list listitem))))) |
---|
| 161 | |
---|
| 162 | (element (varlistentry term) |
---|
| 163 | (make sequence |
---|
| 164 | (if %css-decoration% |
---|
| 165 | (make element gi: "SPAN" |
---|
| 166 | attributes: '(("STYLE" "white-space: nowrap")) |
---|
| 167 | (process-children-trim)) |
---|
| 168 | (make element gi: "NOBR" |
---|
| 169 | (process-children-trim))) |
---|
| 170 | (if (not (last-sibling?)) |
---|
| 171 | (literal ", ") |
---|
| 172 | (literal "")))) |
---|
| 173 | |
---|
| 174 | (element (varlistentry listitem) |
---|
| 175 | (process-children)) |
---|
| 176 | ) |
---|
| 177 | |
---|
| 178 | |
---|
| 179 | ;; This overrides the refsect2 definition (copied from 1.20, dbrfntry.dsl). |
---|
| 180 | ;; It puts a horizontal rule before each function/struct/... description, |
---|
| 181 | ;; except the first one in the refsect1. |
---|
| 182 | (element refsect2 |
---|
| 183 | (make sequence |
---|
| 184 | (if (first-sibling?) |
---|
| 185 | (empty-sosofo) |
---|
| 186 | (make empty-element gi: "HR")) |
---|
| 187 | ($block-container$))) |
---|
| 188 | |
---|
| 189 | ;; Override the book declaration, so that we generate a crossreference |
---|
| 190 | ;; for the book |
---|
| 191 | |
---|
| 192 | (element book |
---|
| 193 | (let* ((bookinfo (select-elements (children (current-node)) (normalize "bookinfo"))) |
---|
| 194 | (ititle (select-elements (children bookinfo) (normalize "title"))) |
---|
| 195 | (title (if (node-list-empty? ititle) |
---|
| 196 | (select-elements (children (current-node)) (normalize "title")) |
---|
| 197 | (node-list-first ititle))) |
---|
| 198 | (nl (titlepage-info-elements (current-node) bookinfo)) |
---|
| 199 | (tsosofo (with-mode head-title-mode |
---|
| 200 | (process-node-list title))) |
---|
| 201 | (dedication (select-elements (children (current-node)) (normalize "dedication")))) |
---|
| 202 | (make sequence |
---|
| 203 | (html-document |
---|
| 204 | tsosofo |
---|
| 205 | (make element gi: "DIV" |
---|
| 206 | attributes: '(("CLASS" "BOOK")) |
---|
| 207 | (if %generate-book-titlepage% |
---|
| 208 | (make sequence |
---|
| 209 | (book-titlepage nl 'recto) |
---|
| 210 | (book-titlepage nl 'verso)) |
---|
| 211 | (empty-sosofo)) |
---|
| 212 | |
---|
| 213 | (if (node-list-empty? dedication) |
---|
| 214 | (empty-sosofo) |
---|
| 215 | (with-mode dedication-page-mode |
---|
| 216 | (process-node-list dedication))) |
---|
| 217 | |
---|
| 218 | (if (not (generate-toc-in-front)) |
---|
| 219 | (process-children) |
---|
| 220 | (empty-sosofo)) |
---|
| 221 | |
---|
| 222 | (if %generate-book-toc% |
---|
| 223 | (build-toc (current-node) (toc-depth (current-node))) |
---|
| 224 | (empty-sosofo)) |
---|
| 225 | |
---|
| 226 | ;; (let loop ((gilist %generate-book-lot-list%)) |
---|
| 227 | ;; (if (null? gilist) |
---|
| 228 | ;; (empty-sosofo) |
---|
| 229 | ;; (if (not (node-list-empty? |
---|
| 230 | ;; (select-elements (descendants (current-node)) |
---|
| 231 | ;; (car gilist)))) |
---|
| 232 | ;; (make sequence |
---|
| 233 | ;; (build-lot (current-node) (car gilist)) |
---|
| 234 | ;; (loop (cdr gilist))) |
---|
| 235 | ;; (loop (cdr gilist))))) |
---|
| 236 | |
---|
| 237 | (if (generate-toc-in-front) |
---|
| 238 | (process-children) |
---|
| 239 | (empty-sosofo)))) |
---|
| 240 | (make entity |
---|
| 241 | system-id: "index.sgml" |
---|
| 242 | (with-mode generate-index-mode |
---|
| 243 | (process-children)))))) |
---|
| 244 | |
---|
| 245 | ;; Mode for generating cross references |
---|
| 246 | |
---|
| 247 | (define (process-child-elements) |
---|
| 248 | (process-node-list |
---|
| 249 | (node-list-map (lambda (snl) |
---|
| 250 | (if (equal? (node-property 'class-name snl) 'element) |
---|
| 251 | snl |
---|
| 252 | (empty-node-list))) |
---|
| 253 | (children (current-node))))) |
---|
| 254 | |
---|
| 255 | (mode generate-index-mode |
---|
| 256 | (element anchor |
---|
| 257 | (if (attribute-string "href" (current-node)) |
---|
| 258 | (empty-sosofo) |
---|
| 259 | (make formatting-instruction data: |
---|
| 260 | (string-append "\less-than-sign;ANCHOR id =\"" |
---|
| 261 | (attribute-string "id" (current-node)) |
---|
| 262 | "\" href=\"" |
---|
| 263 | (if (not (string=? gtkdoc-bookname "")) |
---|
| 264 | (string-append gtkdoc-bookname "/") |
---|
| 265 | "") |
---|
| 266 | (href-to (current-node)) |
---|
| 267 | "\"\greater-than-sign; |
---|
| 268 | ")))) |
---|
| 269 | |
---|
| 270 | ;; We also want to be able to link to complete RefEntry. |
---|
| 271 | (element refentry |
---|
| 272 | (make sequence |
---|
| 273 | (make formatting-instruction data: |
---|
| 274 | (string-append "\less-than-sign;ANCHOR id =\"" |
---|
| 275 | (attribute-string "id" (current-node)) |
---|
| 276 | "\" href=\"" |
---|
| 277 | (if (not (string=? gtkdoc-bookname "")) |
---|
| 278 | (string-append gtkdoc-bookname "/") |
---|
| 279 | "") |
---|
| 280 | (href-to (current-node)) |
---|
| 281 | "\"\greater-than-sign; |
---|
| 282 | ")) |
---|
| 283 | (process-child-elements))) |
---|
| 284 | |
---|
| 285 | (default |
---|
| 286 | (process-child-elements))) |
---|
| 287 | |
---|
| 288 | ;; For hypertext links for which no target is found in the document, we output |
---|
| 289 | ;; our own special tag which we use later to resolve cross-document links. |
---|
| 290 | (element link |
---|
| 291 | (let* ((target (element-with-id (attribute-string (normalize "linkend"))))) |
---|
| 292 | (if (node-list-empty? target) |
---|
| 293 | (make element gi: "GTKDOCLINK" |
---|
| 294 | attributes: (list |
---|
| 295 | (list "HREF" (attribute-string (normalize "linkend")))) |
---|
| 296 | (process-children)) |
---|
| 297 | (make element gi: "A" |
---|
| 298 | attributes: (list |
---|
| 299 | (list "HREF" (href-to target))) |
---|
| 300 | (process-children))))) |
---|
| 301 | |
---|
| 302 | |
---|
| 303 | ;; This overrides default-header-nav-tbl-noff (copied from 1.20, dbnavig.dsl). |
---|
| 304 | ;; I want 'Home' and 'Up' links at the top of each page, and white text on |
---|
| 305 | ;; black. |
---|
| 306 | (define (default-header-nav-tbl-noff elemnode prev next prevsib nextsib) |
---|
| 307 | (let* ((up (parent elemnode)) |
---|
| 308 | (home (nav-home elemnode)) |
---|
| 309 | (show-title? (nav-banner? elemnode)) |
---|
| 310 | (title-sosofo |
---|
| 311 | (make element gi: "TH" |
---|
| 312 | attributes: (list |
---|
| 313 | (list "WIDTH" "100%") |
---|
| 314 | (list "align" "center")) |
---|
| 315 | (if show-title? |
---|
| 316 | (nav-banner elemnode) |
---|
| 317 | (empty-sosofo)))) |
---|
| 318 | (show-banner? (or show-title? |
---|
| 319 | (not (node-list-empty? prev)) |
---|
| 320 | (not (node-list-empty? next)) |
---|
| 321 | (nav-context? elemnode))) |
---|
| 322 | (banner-sosofo |
---|
| 323 | (make element gi: "TR" |
---|
| 324 | attributes: (list |
---|
| 325 | (list "VALIGN" "middle")) |
---|
| 326 | (if (not (node-list-empty? prev)) |
---|
| 327 | (make element gi: "TD" |
---|
| 328 | (make element gi: "A" |
---|
| 329 | attributes: (list |
---|
| 330 | (list "ACCESSKEY" "p") |
---|
| 331 | (list "HREF" |
---|
| 332 | (href-to prev))) |
---|
| 333 | (make empty-element gi: "IMG" |
---|
| 334 | attributes: (list |
---|
| 335 | (list "SRC" "left.png") |
---|
| 336 | (list "WIDTH" "24") |
---|
| 337 | (list "HEIGHT" "24") |
---|
| 338 | (list "BORDER" "0") |
---|
| 339 | (list "ALT" "Prev"))))) |
---|
| 340 | (empty-sosofo)) |
---|
| 341 | (if (nav-up? elemnode) |
---|
| 342 | (make element gi: "TD" |
---|
| 343 | (make element gi: "A" |
---|
| 344 | attributes: (list |
---|
| 345 | (list "ACCESSKEY" "u") |
---|
| 346 | (list "HREF" |
---|
| 347 | (href-to up))) |
---|
| 348 | (make empty-element gi: "IMG" |
---|
| 349 | attributes: (list |
---|
| 350 | (list "SRC" "up.png") |
---|
| 351 | (list "WIDTH" "24") |
---|
| 352 | (list "HEIGHT" "24") |
---|
| 353 | (list "BORDER" "0") |
---|
| 354 | (list "ALT" "Up"))))) |
---|
| 355 | (empty-sosofo)) |
---|
| 356 | (if (nav-home? elemnode) |
---|
| 357 | (make element gi: "TD" |
---|
| 358 | (make element gi: "A" |
---|
| 359 | attributes: (list |
---|
| 360 | (list "ACCESSKEY" "h") |
---|
| 361 | (list "HREF" |
---|
| 362 | (href-to home))) |
---|
| 363 | (make empty-element gi: "IMG" |
---|
| 364 | attributes: (list |
---|
| 365 | (list "SRC" "home.png") |
---|
| 366 | (list "WIDTH" "24") |
---|
| 367 | (list "HEIGHT" "24") |
---|
| 368 | (list "BORDER" "0") |
---|
| 369 | (list "ALT" "Home"))))) |
---|
| 370 | (empty-sosofo)) |
---|
| 371 | title-sosofo |
---|
| 372 | (if (not (node-list-empty? next)) |
---|
| 373 | (make element gi: "TD" |
---|
| 374 | (make element gi: "A" |
---|
| 375 | attributes: (list |
---|
| 376 | (list "ACCESSKEY" "n") |
---|
| 377 | (list "HREF" |
---|
| 378 | (href-to next))) |
---|
| 379 | (make empty-element gi: "IMG" |
---|
| 380 | attributes: (list |
---|
| 381 | (list "SRC" "right.png") |
---|
| 382 | (list "WIDTH" "24") |
---|
| 383 | (list "HEIGHT" "24") |
---|
| 384 | (list "BORDER" "0") |
---|
| 385 | (list "ALT" "Next"))))) |
---|
| 386 | (empty-sosofo))))) |
---|
| 387 | |
---|
| 388 | (if show-banner? |
---|
| 389 | (make element gi: "TABLE" |
---|
| 390 | attributes: (list |
---|
| 391 | (list "WIDTH" %gentext-nav-tblwidth%) |
---|
| 392 | (list "CLASS" "navigation") |
---|
| 393 | (list "SUMMARY" "Navigation header") |
---|
| 394 | (list "CELLPADDING" "2") |
---|
| 395 | (list "CELLSPACING" "2")) |
---|
| 396 | banner-sosofo) |
---|
| 397 | (empty-sosofo)))) |
---|
| 398 | |
---|
| 399 | ;; This overrides default-footer-nav-tbl (copied from 1.20, dbnavig.dsl). |
---|
| 400 | ;; It matches the header above. |
---|
| 401 | (define (default-footer-nav-tbl elemnode prev next prevsib nextsib) |
---|
| 402 | (let* ((show-footer? (or (not (node-list-empty? prev)) |
---|
| 403 | (not (node-list-empty? next)))) |
---|
| 404 | (footer-sosofo |
---|
| 405 | (make element gi: "TR" |
---|
| 406 | attributes: (list |
---|
| 407 | (list "VALIGN" "middle")) |
---|
| 408 | (make element gi: "TD" |
---|
| 409 | attributes: (list |
---|
| 410 | (list "ALIGN" "left")) |
---|
| 411 | (if (not (node-list-empty? prev)) |
---|
| 412 | (make element gi: "A" |
---|
| 413 | attributes: (list |
---|
| 414 | (list "ACCESSKEY" "p") |
---|
| 415 | (list "HREF" (href-to prev))) |
---|
| 416 | (make element gi: "B" |
---|
| 417 | (make entity-ref name: "lt") |
---|
| 418 | (make entity-ref name: "lt") |
---|
| 419 | (make entity-ref name: "lt") |
---|
| 420 | (make entity-ref name: "nbsp") |
---|
| 421 | (element-title-sosofo prev))) |
---|
| 422 | (empty-sosofo))) |
---|
| 423 | (make element gi: "TD" |
---|
| 424 | attributes: (list |
---|
| 425 | (list "ALIGN" "right")) |
---|
| 426 | (if (not (node-list-empty? next)) |
---|
| 427 | (make element gi: "A" |
---|
| 428 | attributes: (list |
---|
| 429 | (list "ACCESSKEY" "n") |
---|
| 430 | (list "HREF" (href-to next))) |
---|
| 431 | (make element gi: "B" |
---|
| 432 | (element-title-sosofo next) |
---|
| 433 | (make entity-ref name: "nbsp") |
---|
| 434 | (make entity-ref name: "gt") |
---|
| 435 | (make entity-ref name: "gt") |
---|
| 436 | (make entity-ref name: "gt"))) |
---|
| 437 | (empty-sosofo)))))) |
---|
| 438 | |
---|
| 439 | (if show-footer? |
---|
| 440 | (make element gi: "TABLE" |
---|
| 441 | attributes: (list |
---|
| 442 | (list "CLASS" "navigation") |
---|
| 443 | (list "WIDTH" %gentext-nav-tblwidth%) |
---|
| 444 | (list "SUMMARY" "Navigation footer") |
---|
| 445 | (list "CELLPADDING" "2") |
---|
| 446 | (list "CELLSPACING" "2")) |
---|
| 447 | footer-sosofo) |
---|
| 448 | (empty-sosofo)))) |
---|
| 449 | |
---|
| 450 | |
---|
| 451 | (define ($section-body$) |
---|
| 452 | (make sequence |
---|
| 453 | (make empty-element gi: "BR" |
---|
| 454 | attributes: (list (list "CLEAR" "all"))) |
---|
| 455 | (make element gi: "DIV" |
---|
| 456 | attributes: (list (list "CLASS" (gi))) |
---|
| 457 | ($section-separator$) |
---|
| 458 | ($section-title$) |
---|
| 459 | (process-children)))) |
---|
| 460 | |
---|
| 461 | </style-specification-body> |
---|
| 462 | </style-specification> |
---|
| 463 | <external-specification id="docbook" document="dbstyle"> |
---|
| 464 | </style-sheet> |
---|