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 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777
|
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!-- HTML by default -->
<!ENTITY % html "INCLUDE">
<!ENTITY % print "IGNORE">
<![%print;[
<!ENTITY % html "IGNORE">
<!ENTITY docbook.dsl PUBLIC
"-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN" CDATA DSSSL>
]]>
<![%html;[
<!ENTITY docbook.dsl PUBLIC
"-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA DSSSL>
]]>
]>
<style-sheet>
<!-- HTML tweaking starts here -->
<style-specification id="html" use="docbook">
<style-specification-body>
(define %albert-version% "0.4.9")
(define %css-decoration%
;; Enable CSS decoration of elements
#t)
(define %stylesheet%
;; Name of the stylesheet to use
"albert.css")
(define $generate-chapter-toc$
;; Should a Chapter Table of Contents be produced?
(lambda ()
#f))
(define %always-format-variablelist-as-table%
;; Always format VariableLists as tables?
#t)
(define %chapter-autolabel%
;; Are chapters enumerated?
#f)
(define %gentext-nav-use-tables%
;; Use tables to build the navigation headers and footers?
#t)
(define %root-filename%
;; Name for the root HTML document
"index")
(define %use-id-as-filename%
;; Use ID attributes as name for component HTML files?
#t)
(define %html-ext%
;; Default extension for HTML output files
".html")
(define %shade-verbatim%
;; Should verbatim environments be shaded?
#t)
(define %section-autolabel%
;; Are sections enumerated?
#f)
;; no horisontal ruler to separate
(define (book-titlepage-separator side)
(empty-sosofo))
(define %spacing-paras%
;; Should extraneous "P" tags be output to force the correct vertical
;; spacing around things like tables. This is ugly because different
;; browsers do different things. Turning this one can also create
;; illegal HTML.
#f)
;; Important:
;; here we turn off the default navigation (recommended)
(define %header-navigation% #f)
(define %footer-navigation% #f)
(define %generate-legalnotice-link%
;; Should the legalnotice be included in a separate file that
;; is linked to, if so go for #t, if you want it included verbatim
;; on the titlepage, go for #f Default is to put it in a
;; separate file, as it would allow using full licences.
#t)
;; Important
(define %albert-header-navigation%
;; will we use albert navigation in the header? (recommended)
#t)
(define %albert-footer-navigation%
;; will we use albert navigation in the header? (recommended)
#t)
(define %albert-text-navigation%
;; Will the little text-line saying what is next, prev, and up be used?
#t)
(define %albert-navigation-ruler%
;; Use a ruler to separate navigation areas from the rest of the text
#f)
(define %albert-navigation-iconpath%
;; "Defines the url/path to the icons, can be relative
"icons/")
(define %albert-use-icons-for-export-status%
;; If true, uses icons to show export-status
#t)
;;; ====== Code =========
(define (albert-nav-up? node)
(nav-up? node)) ;; already in nwalsh
(define (albert-nav-up elemnode nav-style)
(let* ((up (parent elemnode))
(up-href (inherited-dbhtml-value elemnode "up-href"))
(uplink? (not (or (node-list-empty? up)
(node-list=? up (sgml-root-element)))))
(href (if up-href
up-href
(if uplink?
(href-to up)
#f))))
(cond ((equal? nav-style 'image)
(make element gi: "a"
attributes: (list
(list "href" href)
(list "title" (element-title-string up))
(list "accesskey" "U"))
(make element gi: "img"
attributes: (list
(list "src" (string-append %albert-navigation-iconpath%
"gnome_up.png"))
(list "border" "0"))
(empty-sosofo))))
((equal? nav-style 'text)
(make sequence
(make element gi: "b"
attributes: (list
(list "class" "navlabel"))
(literal "Up:"))
(literal " ")
(make element gi: "a"
attributes: (list
(list "class" "sectref")
(list "href" href))
(element-title-sosofo up))))
(else
(empty-sosofo))
)))
(define (albert-nav-prev? node)
(not (node-list-empty? node)))
(define (albert-nav-prev node nav-style)
(cond ((equal? nav-style 'image)
(make element gi: "a"
attributes: (list
(list "href" (href-to node))
(list "title" (element-title-string node))
(list "accesskey" "p"))
(make element gi: "img"
attributes: (list
(list "src" (string-append %albert-navigation-iconpath%
"gnome_left.png"))
(list "border" "0"))
(empty-sosofo))
))
((equal? nav-style 'text)
(make sequence
(make element gi: "b"
attributes: (list
(list "class" "navlabel"))
(literal "Previous:"))
(literal " ")
(make element gi: "a"
attributes: (list
(list "class" "sectref")
(list "href" (href-to node)))
(element-title-sosofo node))
))
(else
(empty-sosofo))
))
(define (albert-nav-next? node)
(not (node-list-empty? node)))
(define (albert-nav-next node nav-style)
(cond ((equal? nav-style 'image)
(make element gi: "a"
attributes: (list
(list "href" (href-to node))
(list "title" (element-title-string node))
(list "accesskey" "N"))
(make element gi: "img"
attributes: (list
(list "src" (string-append %albert-navigation-iconpath%
"gnome_right.png"))
(list "border" "0"))
(empty-sosofo))))
((equal? nav-style 'text)
(make sequence
(make element gi: "b"
attributes: (list
(list "class" "navlabel"))
(literal "Next:"))
(literal " ")
(make element gi: "a"
attributes: (list
(list "class" "sectref")
(list "href" (href-to node)))
(element-title-sosofo node))
))
(else
(empty-sosofo))))
(define ($user-header-navigation$ #!optional
(prev (empty-node-list))
(next (empty-node-list))
(prevm (empty-node-list))
(nextm (empty-node-list)))
(if %albert-header-navigation%
(albert-navigation 'header prev next prevm nextm)
(empty-sosofo)))
(define ($user-footer-navigation$ #!optional
(prev (empty-node-list))
(next (empty-node-list))
(prevm (empty-node-list))
(nextm (empty-node-list)))
(if %albert-footer-navigation%
(albert-navigation 'footer prev next prevm nextm)
(empty-sosofo)))
(define (albert-get-book-element cur-node)
(if (equal? (gi cur-node) (normalize "book"))
cur-node
(albert-get-book-element (parent cur-node))))
(define (albert-get-book-title cur-node)
(element-title-string (albert-get-book-element cur-node)))
(define (albert-get-pubdate cur-node)
(let* ((bookinfo (select-elements (children (albert-get-book-element cur-node)) "bookinfo"))
(pubdate (select-elements (children bookinfo) "pubdate")))
(process-node-list pubdate)))
(define (albert-navigation-image nav-style prev next prevm nextm)
(make element gi: "table"
attributes: (list
(list "align" "center")
(list "width" "100%")
(list "cellpadding" "0")
(list "cellspacing" "2"))
(make element gi: "tr"
(make sequence
(make element gi: "td"
(if (albert-nav-prev? prev)
(albert-nav-prev prev 'image)
(make entity-ref name: "nbsp")))
(make element gi: "td"
(if (albert-nav-up? (current-node))
(albert-nav-up (current-node) 'image)
(make entity-ref name: "nbsp")))
(make element gi: "td"
(if (albert-nav-next? next)
(albert-nav-next next 'image)
(make entity-ref name: "nbsp")))
(make element gi: "td"
attributes: (list
(list "align" "center")
(list "width" "100%"))
(make element gi: "p"
(make sequence
;;(literal %albert-doc-header%)
(literal (albert-get-book-title (current-node)))
)))
(make element gi: "td"
(make element gi: "a"
attributes: (list
(list "title" "Table of Contents")
(list "href" "index.html")
(list "accesskey" "H"))
(make element gi: "img"
attributes: (list
(list "src" (string-append %albert-navigation-iconpath%
"gnome_home.png"))
(list "border" "0"))
(empty-sosofo))
;;(gentext-nav-next next)
))
(make element gi: "td"
(make element gi: "a"
attributes: (list
(list "title" "Global Index")
(list "href" "globalindex.html")
(list "accesskey" "I"))
(make element gi: "img"
attributes: (list
(list "src" (string-append %albert-navigation-iconpath%
"gnome_index.png"))
(list "border" "0"))
(empty-sosofo))
;;(gentext-nav-next next)
))
))
))
(define (albert-navigation-text nav-style prev next prevm nextm)
(make sequence
(if (albert-nav-prev? prev)
(albert-nav-prev prev 'text)
(empty-sosofo))
(literal " ")
(if (albert-nav-up? (current-node))
(albert-nav-up (current-node) 'text)
(empty-sosofo))
(literal " ")
(if (albert-nav-next? next)
(albert-nav-next next 'text)
(empty-sosofo))))
(define (albert-navigation nav-style prev next prevm nextm)
(make element gi: "div"
attributes: (list
(list "class" "navigation"))
(cond ((equal? nav-style 'header)
(make sequence
(albert-navigation-image nav-style prev next prevm nextm)
(cond (%albert-text-navigation%
(albert-navigation-text nav-style prev next prevm nextm))
(else
(empty-sosofo)))
(if %albert-navigation-ruler%
(make element gi: "hr"
attributes: '(("class" "navigationruler")
("align" "center")
("width" "80%"))
(empty-sosofo))
(empty-sosofo))
))
((equal? nav-style 'footer)
(make sequence
(if %albert-navigation-ruler%
(make element gi: "hr"
attributes: '(("align" "center")
("width" "80%"))
(empty-sosofo))
(empty-sosofo))
(cond (%albert-text-navigation%
(albert-navigation-text nav-style prev next prevm nextm))
(else
(empty-sosofo)))
(albert-navigation-image nav-style prev next prevm nextm)
))
(else
(empty-sosofo)))
))
;; Albert: this one makes a small note at the bottom that the page was generated by Albert
;; You can also define $html-body-start$, $html-body-content-start$, $html-body-content-end$
(define ($html-body-end$)
(make sequence
(make element gi: "p"
attributes: (list
(list "class" "bottom")
(list "align" "left"))
(make sequence
(literal "This documentation was generated ")
(albert-get-pubdate (current-node))
(literal " from the original sources by ")
(make element gi: "a"
attributes: (list (list "href" "http://albert.sourceforge.net/"))
(make sequence (literal "Albert")))
(literal " v.")
(literal %albert-version%)
(literal ".")
))))
;; I want to change this so that for programlisting we use a blue background,
;; but for example or informalexample we use green.
(define $shade-verbatim-attr$
;; Attributes used to create a shaded verbatim environment.
(lambda ()
(if (or (equal? (gi (parent (current-node)))
(normalize "example"))
(equal? (gi (parent (current-node)))
(normalize "informalexample")))
(list
(list "class" (gi (parent (current-node))))
(list "border" "0")
(list "bgcolor" "#d8f8d8")
(list "width" "100%")
(list "cellpadding" "6"))
(list
(list "class" (gi (parent (current-node))))
(list "border" "0")
(list "bgcolor" "#aaddaa") ;;"#D6E8FF")
(list "width" "100%")
(list "cellpadding" "6"))
)
)
)
;; These are some customizations to the standard HTML output produced by the
;; Modular DocBook Stylesheets.
;; They have been adopted from gtk-doc 0.3
;; Albert: do I want this?
;; This overrides the tgroup definition (copied from 1.20, dbtable.dsl).
;; It changes the table background color, cell spacing and cell padding.
;; remove later=
(element tgroup
(let* ((wrapper (parent (current-node)))
(frameattr (attribute-string (normalize "frame") wrapper))
(pgwide (attribute-string (normalize "pgwide") wrapper))
(footnotes (select-elements (descendants (current-node))
(normalize "footnote")))
(border (if (equal? frameattr (normalize "none"))
'(("border" "0"))
'(("border" "1"))))
(roleattr (attribute-string (normalize "role") wrapper))
;; FIXME: I thought that I should use normalize ("params") etc. here,
;; but that doesn't work. Anyone know why?
(bgcolor (cond ((equal? roleattr "params")
'(("bgcolor" "#ffd0d0")))
((equal? roleattr "classfacts")
'(("bgcolor" "#cdba96")))
((equal? roleattr "struct")
'(("bgcolor" "#fff0d0")))
((equal? roleattr "enum")
'(("bgcolor" "#f0f0d0")))
(else
'(("bgcolor" "#ffffff")))))
(width (if (equal? pgwide "1")
(list (list "width" ($table-width$)))
'()))
(head (select-elements (children (current-node)) (normalize "thead")))
(body (select-elements (children (current-node)) (normalize "tbody")))
(feet (select-elements (children (current-node)) (normalize "tfoot"))))
(make element gi: "table"
attributes: (append
border
width
bgcolor
'(("cellspacing" "0"))
'(("cellpadding" "4"))
(if %cals-table-class%
(list (list "class" %cals-table-class%))
'()))
(process-node-list head)
(process-node-list body)
(process-node-list feet)
(make-table-endnotes))))
;; Albert: Tweaked this one slightly, dunno what the GTKDOCLINK is for anymore
;; For hypertext links for which no target is found in the document, we output
;; our own special tag which we use later to resolve cross-document links.
;; needs tweaking
(element link
(let* ((target (element-with-id (attribute-string (normalize "linkend"))))
(hovertext (attribute-string (normalize "hovertext"))))
(if (node-list-empty? target)
(process-children)
(make element gi: "a"
attributes: (append
(list (list "href" (href-to target)))
(if hovertext
(list (list "title" hovertext))
'()))
(process-children)))))
(element ulink
(let ((attrs (list
(list "href" (attribute-string (normalize "url")))
(list "target" "_top")
(if (equal? "clhs" (attribute-string (normalize "type")))
(list "class" "hyperspec")
(list "class" "other"))
(list "title" (if (equal? "clhs" (attribute-string (normalize "type")))
"Hyperspec Entry, package COMMON-LISP"
(attribute-string (normalize "url")))))))
(make element gi: "a"
attributes: attrs
(if (node-list-empty? (children (current-node)))
(literal (attribute-string (normalize "url")))
(process-children)))))
;; Albert: I think we want this one, but I'm not sure it is 100% correct
;; hackish, we want our special ones in green
(element (refsect1 title)
(let ((the-class (attribute-string (normalize "class"))))
(if (equal? the-class "contenttitle")
(make element gi: "h2"
attributes: (list
(list "class" (attribute-string (normalize "class"))))
(process-children))
;; default in the included stylesheets
($lowtitle$ 2))))
;; Returns code for export-status icon, or an emptysosofo if EXPORTED? is #F
(define (possible-export-icon exported?)
(if %albert-use-icons-for-export-status%
(make sequence
(make element gi: "a"
attributes: (list
(list "title" (if exported?
"Exported from package"
"Internal to package")))
(make element gi: "img"
attributes: (list
(list "src" (string-append %albert-navigation-iconpath%
(if exported?
"exported.png"
"internal.png")))
(list "border" "0"))
(empty-sosofo)))
(literal " "))
(empty-sosofo)))
;; Albert: No idea what this does
;; suggestion: this seems to print the title of a method above the programlisting
;; in other words the 'title' in a formalpara
(define ($runinhead$)
(let* ((title-parent (parent (current-node)))
(parent-class (attribute-string (normalize "class") title-parent))
(exported? (string? parent-class))
(cont-class (if exported?
(list "class" "exported")
(list "class" "not-exported")))) ;; bad
(make sequence
(possible-export-icon exported?)
(make element gi: "b"
attributes: (list
(list "class" "minorheader"))
(make element gi: "font"
attributes: (list (list "size" "+1")
cont-class
;;(list "jigsaw" parent-class)
;;(list "COLOR" "darkgreen")
)
(process-children)))
)))
(element (programlisting property)
(let* ((exported? (equal? "exported" (attribute-string (normalize "role"))))
(cont-class (if exported?
(list "class" "exported")
(list "class" "not-exported"))))
(make sequence
(possible-export-icon exported?)
(make element gi: "font"
attributes: (list cont-class)
(process-children)))))
;; Albert: This is kindof experimental, we need to mark where a refentry/etc
;; is coming from to help CSS
(define ($refentry-body$)
(let ((id (element-id (current-node)))
(the-class (attribute-string (normalize "class"))))
(make sequence
(make element gi: "h1"
attributes:
(append
(if (equal? the-class "defclass")
(list (list "class" "defclass"))
'()))
(make sequence
(make element gi: "a"
attributes: (list (list "name" id))
(empty-sosofo))
(element-title-sosofo (current-node))))
(process-children))))
(element refentry
(html-document (with-mode refentry-head-title-mode
(literal (element-title-string (current-node))))
($refentry-body$)))
; ;; Albert: Do I want this? I suspect this will be changed!!
; ;; Override the book declaration, so that we generate a crossreference
; ;; for the book
; (element book
; (let* ((bookinfo (select-elements (children (current-node)) (normalize "bookinfo")))
; (ititle (select-elements (children bookinfo) (normalize "title")))
; (title (if (node-list-empty? ititle)
; (select-elements (children (current-node)) (normalize "title"))
; (node-list-first ititle)))
; (nl (titlepage-info-elements (current-node) bookinfo))
; (tsosofo (with-mode head-title-mode
; (process-node-list title)))
; (dedication (select-elements (children (current-node)) (normalize "dedication"))))
; (make sequence
; (html-document
; tsosofo
; (make element gi: "DIV"
; attributes: '(("CLASS" "BOOK"))
; (if %generate-book-titlepage%
; (make sequence
; (book-titlepage nl 'recto)
; (book-titlepage nl 'verso))
; (empty-sosofo))
; (if (node-list-empty? dedication)
; (empty-sosofo)
; (with-mode dedication-page-mode
; (process-node-list dedication)))
; (if (not (generate-toc-in-front))
; (process-children)
; (empty-sosofo))
; (if %generate-book-toc%
; (build-toc (current-node) (toc-depth (current-node)))
; (empty-sosofo))
; ;; (let loop ((gilist %generate-book-lot-list%))
; ;; (if (null? gilist)
; ;; (empty-sosofo)
; ;; (if (not (node-list-empty?
; ;; (select-elements (descendants (current-node))
; ;; (car gilist))))
; ;; (make sequence
; ;; (build-lot (current-node) (car gilist))
; ;; (loop (cdr gilist)))
; ;; (loop (cdr gilist)))))
; (if (generate-toc-in-front)
; (process-children)
; (empty-sosofo))))
; (make entity
; system-id: "index.sgml"
; (with-mode generate-index-mode
; (process-children))))))
; ;; Albert: Do I need this?
; ;; Mode for generating cross references
; (define (process-child-elements)
; (process-node-list
; (node-list-map (lambda (snl)
; (if (equal? (node-property 'class-name snl) 'element)
; snl
; (empty-node-list)))
; (children (current-node)))))
; ;; Albert: This seems to be a side-effect of the stuff introduced in book
; ;; above.. it seems to go through the tree and register stuff..
; ;; it does no harm so it'll stay I guess
; (mode generate-index-mode
; (element anchor
; (if (attribute-string "href" (current-node))
; (empty-sosofo)
; (make formatting-instruction data:
; (string-append "\less-than-sign;ANCHOR id =\""
; (attribute-string "id" (current-node))
; "\" href=\""
; (href-to (current-node))
; "\"\greater-than-sign;
; "))))
; ;; We also want to be able to link to complete RefEntry.
; (element refentry
; (make sequence
; (make formatting-instruction data:
; (string-append "\less-than-sign;ANCHOR id =\""
; (attribute-string "id" (current-node))
; "\" href=\""
; (href-to (current-node))
; "\"\greater-than-sign;"))
; (process-child-elements)))
; (default
; (process-child-elements)))
;; These override 2 functions which return the English text to use for links to
;; previous and next pages. (copied from 1.20, dbl1en.dsl).
;;(define (gentext-en-nav-prev prev)
;; (make sequence (literal "<<< Previous Page")))
;;(define (gentext-en-nav-next next)
;; (make sequence (literal "Next Page >>>")))
;; This overrides the refsect2 definition (copied from 1.20, dbrfntry.dsl).
;; It puts a horizontal rule before each function/struct/... description,
;; except the first one in the refsect1.
;;(element refsect2
;; (make sequence
;; (if (first-sibling?)
;; (empty-sosofo)
;; (make empty-element gi: "HR"))
;; ($block-container$)))
;;(define ($runinhead$)
;; (let ((title (data (current-node))))
;; (make element gi: "FONT"
;; attributes: (list (list "SIZE" "+1"))
;; (process-children))
;; )
</style-specification-body>
</style-specification>
<!-- End HTML -->
<external-specification id="docbook" document="docbook.dsl">
</style-sheet>
|