[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Re: DOCBOOK: customized headers and footers
Sylvan Ravinet <sylvan@ravinet.com> writes: > Well it does not work. Jade complains something I don't remember now but > I'm gonna tell you soon. That was absolutely a snippet from existing, working code. I might have missed a bit or made a wrong snip... I'll include the whole thing here, which is all of our house style -- some of this is Docbook bugfixes; some is hackarounds, etc. BTW, I don't claim to be getting aroudn the "one line in header" limitation. I'm just customizing a header.... -- .....Adam Di Carlo....adam@onShore.com.....<URL:http://www.onShore.com/> <!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [ <!-- $Id: docbook-onshore.dsl,v 1.19 1999/11/08 21:44:40 apharris Exp $ --> <!-- Copyright 1999, onShore Inc. (http://www.onshore.com/) This program is free software under the terms of the GNU General Public License (GPL). A copy of the GPL, "COPYING", should have been made available with this software. If not, a copy may be obtained at http://www.fsf.org/copyleft/gpl.html ========================================== onShore DocBook Stylesheet customizations ========================================== This DSSSL file serves two functions: * uses onShore extended DTD for requirements environment * sets "house style" parameters Authors: Craig Brozefsky <craig@onshore.com> Adam Di Carlo <adam@onshore.com> --> <!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 % print "IGNORE"> <!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA DSSSL> ]]> ]> <style-sheet> <style-specification id="html" use="docbook"> <style-specification-body> (declare-flow-object-class element "UNREGISTERED::James Clark//Flow Object Class::element") ; turn on section numbers (define %section-autolabel% #t) ; of titlepages and TOCs (define %generate-book-titlepage% #t) (define %generate-part-titlepage% #f) (define %generate-part-toc% #t) (define %generate-article-toc% #t) ; HTML file naming (define %html-ext% ".html") (define %use-id-as-filename% #t) ;; cut-n-paste from Norm Walsh's html/dbhtml.dsl (define (element-id #!optional (nd (current-node))) ;; IDs of TITLEs are the IDs of the PARENTs (let ((elem (if (equal? (gi nd) (normalize "title")) (parent nd) nd))) (if (attribute-string (normalize "id") elem) (attribute-string (normalize "id") elem) (generate-anchor elem)))) (define (generate-anchor #!optional (nd (current-node))) (string-append "AEN" (number->string (all-element-number nd)))) ;; done cut-n-paste (define ($requirement$) (let* ((p-label (literal (element-label (parent (current-node)) #t))) (c-label (literal (format-number (child-number (current-node)) "1"))) (title (select-elements (children (current-node)) "TITLE")) (has-title (not (node-list-empty? title))) (r-title (if has-title (make sequence (with-mode xref-title-mode (process-node-list (node-list-first title)))) (literal "")))) (make element gi: "BLOCKQUOTE" attributes: (list (list "CLASS" "REQUIREMENT")) (make element gi: "B" (make element gi: "A" attributes: (list (list "NAME" (element-id))) (make sequence (literal "Requirement ") p-label (literal ".") c-label (literal ". ") r-title))) (process-children)))) (define ($reqpara$) (let* ((title (select-elements (children (parent (current-node))) "TITLE")) (has-title (not (node-list-empty? title))) (adm-title (if has-title (make sequence (with-mode xref-title-mode (process-node-list (node-list-first title))) (literal (gentext-label-title-sep (gi (parent (current-node)))))) (literal (gentext-element-name (gi (parent (current-node)))) (gentext-label-title-sep (gi (parent (current-node)))))))) (make element gi: "P" (if (= (child-number) 1) (make element gi: "B" adm-title) (empty-sosofo)) (process-children)))) (element requirement ($requirement$)) (element (requirement title) (empty-sosofo)) </style-specification-body> </style-specification> <style-specification id="print" use="docbook"> <style-specification-body> <!-- generally, we use the TeX backend, but you can use -V foo-backend --> (define default-backend 'tex) <!-- DSSSL for print output, i.e., TeX, RTF, MIF --> (define %title-font-family% "Times New Roman") (define %chapter-autolabel% #t) (define %section-autolabel% #t) (define %body-start-indent% 0pi) ; decreased (define %block-start-indent% ;; Extra start-indent for block-elements 0pi) (define %verbatim-size-factor% ;; Verbatim font scaling factor 1.0) ; same size as everything else (define %line-spacing-factor% ;; Factor used to calculate leading 1.2) ; tightened up from default 1.3 (define %para-sep% ;; Distance between paragraphs (* %bf-size% 0.9)) ; increased (define %block-sep% ;; Distance between block-elements %para-sep%) ; same as paragraph (define %head-before-factor% ;; Factor used to calculate space above a title 0.6) ; from default of 0.75 ;; seems to be a bug in jadetex -- we get a wierd indent (define %cals-cell-before-column-margin% (cond ((equal? (print-backend) 'tex) 0pt) (else 3pt))) ;; ;; deal with excessive indentation in lists and such ;; ; we don't want $para-container$ in the following (element varlistentry (process-children-trim)) (element glossentry (process-children-trim)) ; indent for qanda (define %qanda-start-indent% 1em) ; space-after on quanda answer is excessive; keep with next should be ; upstream (element question (let* ((chlist (children (current-node))) (firstch (node-list-first chlist)) (restch (node-list-rest chlist))) (make sequence (make paragraph space-after: (/ %para-sep% 2) keep-with-next?: #t start-indent: %qanda-start-indent% first-line-start-indent: (- %qanda-start-indent%) (make sequence font-weight: 'bold (literal (question-answer-label (current-node)) " ")) (process-node-list (children firstch))) (process-node-list restch)))) ; front space on lists drives me insane (define ($list$) (make display-group start-indent: (if (INBLOCK?) (inherited-start-indent) (+ %block-start-indent% (inherited-start-indent))) space-after: (if (INLIST?) %para-sep% %block-sep%))) ;; hack (element (itemizedlist listitem para) (if (first-sibling?) (make paragraph space-after: %para-sep% start-indent: (if (member (current-node) (outer-parent-list)) %body-start-indent% (inherited-start-indent)) (process-children-trim)) ($paragraph$))) ;; Returns the depth of auto TOC that should be made at the nd-level (define (toc-depth nd) (if (string=? (gi nd) (normalize "book")) 3 ; default of 7 is too deep 1)) (define ($requirement$) (let* ((p-label (literal (element-label (parent (current-node)) #t))) (c-label (literal (format-number (child-number (current-node)) "1"))) (title (select-elements (children (current-node)) "TITLE")) (has-title (not (node-list-empty? title))) (r-title (if has-title (make sequence (with-mode xref-title-mode (process-node-list (node-list-first title)))) (literal "")))) (make display-group space-before: %block-sep% space-after: %block-sep% (make paragraph font-family-name: %title-font-family% font-weight: 'bold space-before: %para-sep% space-after: %para-sep% keep-with-next?: #t (literal "Requirement: ") p-label (literal ".") c-label (literal " ") r-title) (process-children)))) (define ($admonpara$) (let* ((title (select-elements (children (current-node)) "TITLE")) (has-title (not (node-list-empty? title))) (adm-title (if has-title (make sequence (with-mode xref-title-mode (process-node-list (node-list-first title))) (literal (gentext-label-title-sep (gi (parent (current-node)))))) (literal (gentext-element-name (gi (parent (current-node)))) (gentext-label-title-sep (gi (parent (current-node)))))))) (make paragraph space-before: %para-sep% space-after: %para-sep% font-size: (- %bf-size% 1pt) font-weight: 'medium font-posture: 'upright font-family-name: %admon-font-family% line-spacing: (* (- %bf-size% 1pt) %line-spacing-factor%) start-indent: (+ (inherited-start-indent) (* (ILSTEP) 2)) (if (= (child-number) 1) (make sequence font-family-name: %title-font-family% font-weight: 'bold adm-title) (empty-sosofo)) (process-children)))) (element requirement ($requirement$)) (element (requirement title) (empty-sosofo)) ; use the date in the header (define ($revision-header$) (let* ((revision-info (select-elements (children (select-elements (children (sgml-root-element)) (normalize "bookinfo"))) (normalize "date"))) (has-revision (not (node-list-empty? revision-info)))) (if has-revision (make sequence font-posture: 'italic (process-node-list (node-list-first revision-info))) (empty-sosofo)))) (define (page-inner-header gi) (cond ((equal? (normalize gi) (normalize "dedication")) (empty-sosofo)) ((equal? (normalize gi) (normalize "lot")) (empty-sosofo)) ((equal? (normalize gi) (normalize "part")) (empty-sosofo)) (else ($revision-header$)))) <!-- QAndASet ..................................................... --> <!-- Default to labelling Q/A with Q: and A: --> ;; should be common to print and html (define (qanda-defaultlabel) (normalize "qanda")) </style-specification-body> </style-specification> <external-specification id="docbook" document="docbook.dsl"> </style-sheet>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC