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>
6 <style-specification use="docbook">
7 <style-specification-body>
9 (define gtkdoc-version "")
10 (define gtkdoc-bookname "")
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.
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!
21 ;;(define %generate-book-toc% #f)
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")))
29 (define %chapter-autolabel%
30 ;; Are chapters enumerated?
33 (define %use-id-as-filename% #t)
35 (define %html-ext% ".html")
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)))
43 (if (not (string=? gtkdoc-version ""))
44 (make empty-element gi: "META"
46 (list "NAME" "GENERATOR")
47 (list "CONTENT" (string-append
52 (make element gi: "STYLE"
53 attributes: (list (list "TYPE" "text/css"))
54 (literal ".synopsis, .classsynopsis {
56 border: solid 1px #aaaaaa;
61 border: solid 1px #aaaaff;
70 border: solid 1px #ffaaaa;
77 .navigation a:visited {
85 (mode book-titlepage-recto-mode
87 (make element gi: "TABLE"
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"
96 (list "ALIGN" "center")
97 (list "VALIGN" "MIDDLE"))
99 attributes: (list (list "CLASS" (gi)))
100 (process-children-trim)
101 (make empty-element gi: "A"
102 attributes: (list (list "NAME" (element-id))))))))))
104 (define (book-titlepage-separator side)
108 ;; This overrides the variablelist definition (copied from 1.76,
109 ;; dblists.dsl). It changes the table background color, cell spacing
112 ;; I have also removed the code to handle the non-table case.
113 (element variablelist
116 (make element gi: "P" (empty-sosofo))
120 (make element gi: "TABLE"
121 attributes: '(("CLASS" "variablelist")
126 (make element gi: "TBODY"
127 (with-mode variablelist-table
129 (with-mode variablelist-table
130 (process-children))))
131 (para-check 'restart)))
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")
141 (process-children))))
143 (element varlistentry
144 (let* ((terms (select-elements (children (current-node))
146 (listitem (select-elements (children (current-node))
147 (normalize "listitem"))))
149 (make element gi: "TR"
150 (make element gi: "TD"
151 attributes: '(("ALIGN" "LEFT")
153 (make empty-element gi: "A"
155 (list "NAME" (element-id))))
156 (process-node-list terms))
157 (make element gi: "TD"
158 attributes: '(("ALIGN" "LEFT")
160 (process-node-list listitem)))))
162 (element (varlistentry term)
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?))
174 (element (varlistentry listitem)
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.
186 (make empty-element gi: "HR"))
187 ($block-container$)))
189 ;; Override the book declaration, so that we generate a crossreference
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"))))
205 (make element gi: "DIV"
206 attributes: '(("CLASS" "BOOK"))
207 (if %generate-book-titlepage%
209 (book-titlepage nl 'recto)
210 (book-titlepage nl 'verso))
213 (if (node-list-empty? dedication)
215 (with-mode dedication-page-mode
216 (process-node-list dedication)))
218 (if (not (generate-toc-in-front))
222 (if %generate-book-toc%
223 (build-toc (current-node) (toc-depth (current-node)))
226 ;; (let loop ((gilist %generate-book-lot-list%))
227 ;; (if (null? gilist)
229 ;; (if (not (node-list-empty?
230 ;; (select-elements (descendants (current-node))
233 ;; (build-lot (current-node) (car gilist))
234 ;; (loop (cdr gilist)))
235 ;; (loop (cdr gilist)))))
237 (if (generate-toc-in-front)
241 system-id: "index.sgml"
242 (with-mode generate-index-mode
243 (process-children))))))
245 ;; Mode for generating cross references
247 (define (process-child-elements)
249 (node-list-map (lambda (snl)
250 (if (equal? (node-property 'class-name snl) 'element)
253 (children (current-node)))))
255 (mode generate-index-mode
257 (if (attribute-string "href" (current-node))
259 (make formatting-instruction data:
260 (string-append "\less-than-sign;ANCHOR id =\""
261 (attribute-string "id" (current-node))
263 (if (not (string=? gtkdoc-bookname ""))
264 (string-append gtkdoc-bookname "/")
266 (href-to (current-node))
267 "\"\greater-than-sign;
270 ;; We also want to be able to link to complete RefEntry.
273 (make formatting-instruction data:
274 (string-append "\less-than-sign;ANCHOR id =\""
275 (attribute-string "id" (current-node))
277 (if (not (string=? gtkdoc-bookname ""))
278 (string-append gtkdoc-bookname "/")
280 (href-to (current-node))
281 "\"\greater-than-sign;
283 (process-child-elements)))
286 (process-child-elements)))
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.
291 (let* ((target (element-with-id (attribute-string (normalize "linkend")))))
292 (if (node-list-empty? target)
293 (make element gi: "GTKDOCLINK"
295 (list "HREF" (attribute-string (normalize "linkend"))))
297 (make element gi: "A"
299 (list "HREF" (href-to target)))
300 (process-children)))))
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
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))
311 (make element gi: "TH"
313 (list "WIDTH" "100%")
314 (list "align" "center"))
316 (nav-banner elemnode)
318 (show-banner? (or show-title?
319 (not (node-list-empty? prev))
320 (not (node-list-empty? next))
321 (nav-context? elemnode)))
323 (make element gi: "TR"
325 (list "VALIGN" "middle"))
326 (if (not (node-list-empty? prev))
327 (make element gi: "TD"
328 (make element gi: "A"
330 (list "ACCESSKEY" "p")
333 (make empty-element gi: "IMG"
335 (list "SRC" "left.png")
339 (list "ALT" "Prev")))))
341 (if (nav-up? elemnode)
342 (make element gi: "TD"
343 (make element gi: "A"
345 (list "ACCESSKEY" "u")
348 (make empty-element gi: "IMG"
350 (list "SRC" "up.png")
354 (list "ALT" "Up")))))
356 (if (nav-home? elemnode)
357 (make element gi: "TD"
358 (make element gi: "A"
360 (list "ACCESSKEY" "h")
363 (make empty-element gi: "IMG"
365 (list "SRC" "home.png")
369 (list "ALT" "Home")))))
372 (if (not (node-list-empty? next))
373 (make element gi: "TD"
374 (make element gi: "A"
376 (list "ACCESSKEY" "n")
379 (make empty-element gi: "IMG"
381 (list "SRC" "right.png")
385 (list "ALT" "Next")))))
389 (make element gi: "TABLE"
391 (list "WIDTH" %gentext-nav-tblwidth%)
392 (list "CLASS" "navigation")
393 (list "SUMMARY" "Navigation header")
394 (list "CELLPADDING" "2")
395 (list "CELLSPACING" "2"))
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))))
405 (make element gi: "TR"
407 (list "VALIGN" "middle"))
408 (make element gi: "TD"
410 (list "ALIGN" "left"))
411 (if (not (node-list-empty? prev))
412 (make element gi: "A"
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)))
423 (make element gi: "TD"
425 (list "ALIGN" "right"))
426 (if (not (node-list-empty? next))
427 (make element gi: "A"
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")))
440 (make element gi: "TABLE"
442 (list "CLASS" "navigation")
443 (list "WIDTH" %gentext-nav-tblwidth%)
444 (list "SUMMARY" "Navigation footer")
445 (list "CELLPADDING" "2")
446 (list "CELLSPACING" "2"))
451 (define ($section-body$)
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$)
459 (process-children))))
461 </style-specification-body>
462 </style-specification>
463 <external-specification id="docbook" document="dbstyle">