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
|
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY docbook.dsl SYSTEM "@DOCBOOK_HTML@" CDATA DSSSL>
<!ENTITY html-common.dsl SYSTEM "@srcdir@/html-common.dsl">
<!ENTITY common.dsl SYSTEM "common.dsl">
<!ENTITY version.dsl SYSTEM "@srcdir@/version.dsl">
]>
<!--
$Id: phpweb.dsl.in,v 1.1 2002/01/06 15:42:27 hholzgra Exp $
HTML-specific stylesheet customization for use by the online manual.
-->
<style-sheet>
<style-specification id="docbook-php-website" use="docbook">
<style-specification-body>
(declare-flow-object-class processing-instruction
"UNREGISTERED::James Clark//Flow Object Class::processing-instruction")
(define %html-ext% ".php")
(define %html-manifest% "PHPWEB.manifest")
(define %output-dir% "php")
;; XXX hackish workaround. I'm not sure what side effects setting
;; the element number to 0 would have?
(define (generate-anchor #!optional (nd (current-node)))
(string-append "AEN" (number->string (or (all-element-number nd) 0))))
(define (phpweb-quote str)
(string-replace str "'" "\\'"))
(define (phpweb-header #!optional (nd (current-node)))
(php-code
(string-append
newline
"require('shared-manual.inc');" newline
"sendManualHeaders('@ENCODING@','@LANG@');" newline
(phpweb-header-navigation nd) newline
"manualHeader('" (phpweb-quote (phpweb-node-title nd)) "','" (phpweb-quote (html-base-filename nd)) "');" newline)))
(define (phpweb-footer #!optional (nd (current-node)))
(php-code
(string-append
"manualFooter('" (phpweb-quote (phpweb-node-title nd)) "','" (phpweb-quote (html-base-filename nd)) "');" newline)))
(define (phpweb-node-title #!optional (nd (current-node)) (title-elem "title"))
(let* ((preferred-title-node
(cond ((equal? (gi nd) "refentry")
(node-list-first
(select-elements
(children
(select-elements (children nd) "refnamediv"))
"refname")))
(else
(node-list-first
(select-elements (children nd) title-elem)))))
(title-node
(if (node-list-empty? preferred-title-node)
(select-elements (children nd) "title") ;; fallback
preferred-title-node)))
(data title-node)))
(define (phpweb-header-nav-array nd)
(let ((href (href-to nd))
(title (phpweb-quote (phpweb-node-title nd "titleabbrev"))))
(string-append
"array('" href "', '" title "')")))
(define (phpweb-node-list-map func ndl)
(let* ((node (node-list-first ndl))
(rest (node-list-rest ndl))
(item (func node)))
(if (node-list-empty? rest)
(list item)
(append (list item) (phpweb-node-list-map func rest)))))
(define (phpweb-header-navigation nd)
(let ((prev (prev-chunk-element nd))
(next (next-chunk-element nd))
(up (parent nd))
(home (sgml-root-element))
(toc-nodes (siblings (chunk-parent nd))))
(string-append
"setupNavigation(array(" newline
" 'home' => " (phpweb-header-nav-array home) "," newline
" 'prev' => " (phpweb-header-nav-array prev) "," newline
" 'next' => " (phpweb-header-nav-array next) "," newline
" 'up' => " (phpweb-header-nav-array up) "," newline
" 'toc' => array(" newline
(join
(phpweb-node-list-map (lambda (nnl)
(string-append
" "
(phpweb-header-nav-array nnl)))
toc-nodes)
(string-append "," newline))
")));")))
(define (html-document title-sosofo body-sosofo)
(let ((doc-sosofo
(if (or (chunk?) (node-list=? (current-node) (sgml-root-element)))
(make sequence
(phpweb-header (current-node))
body-sosofo
(phpweb-footer (current-node)))
body-sosofo)))
(if (chunk?)
(make entity
system-id: (html-entity-file (html-file))
doc-sosofo)
doc-sosofo)))
&html-common.dsl;
&common.dsl;
&version.dsl;
</style-specification-body>
</style-specification>
<external-specification id="docbook" document="docbook.dsl">
</style-sheet>
<!--
Local Variables:
mode: scheme
End:
-->
|