summaryrefslogtreecommitdiff
path: root/html/dbcompon.dsl
diff options
context:
space:
mode:
authorGraydon, Tracy <tracy.graydon@intel.com>2012-08-31 11:34:41 -0700
committerGraydon, Tracy <tracy.graydon@intel.com>2012-08-31 11:34:41 -0700
commitd31c43e62fd5483de3604ef825522501eece7feb (patch)
tree176c351869a67eaf8347faba2e1f3a60fa9caeaf /html/dbcompon.dsl
downloaddocbook-style-dsssl-d31c43e62fd5483de3604ef825522501eece7feb.tar.gz
docbook-style-dsssl-d31c43e62fd5483de3604ef825522501eece7feb.tar.bz2
docbook-style-dsssl-d31c43e62fd5483de3604ef825522501eece7feb.zip
Diffstat (limited to 'html/dbcompon.dsl')
-rw-r--r--html/dbcompon.dsl199
1 files changed, 199 insertions, 0 deletions
diff --git a/html/dbcompon.dsl b/html/dbcompon.dsl
new file mode 100644
index 0000000..250726d
--- /dev/null
+++ b/html/dbcompon.dsl
@@ -0,0 +1,199 @@
+;; $Id: dbcompon.dsl,v 1.8 2003/04/29 05:49:21 adicarlo Exp $
+;;
+;; This file is part of the Modular DocBook Stylesheet distribution.
+;; See ../README or http://docbook.sourceforge.net/projects/dsssl/
+;;
+
+;; ============================= COMPONENTS =============================
+;;
+;; in docbook, components are containers at the chapter/appendix level
+
+(define ($component$)
+ (html-document
+ (with-mode head-title-mode
+ (literal (element-title-string (current-node))))
+ ($component-body$)))
+
+(define ($component-separator$)
+ (if (or (not nochunks) (node-list=? (current-node) (sgml-root-element)))
+ (empty-sosofo)
+ (make empty-element gi: "HR")))
+
+(define ($component-body$)
+ (let* ((epigraph (let loop ((nl (children (current-node))))
+ (if (node-list-empty? nl)
+ nl
+ (let ((first-gi (gi (node-list-first nl))))
+ (if (equal? first-gi (normalize "epigraph"))
+ (node-list-first nl)
+ (if (or (equal? first-gi (normalize "title"))
+ (equal? first-gi (normalize "subtitle"))
+ (equal? first-gi (normalize "titleabbrev"))
+ (equal? first-gi (normalize "docinfo"))
+ (equal? first-gi (normalize "chapterinfo"))
+ (equal? first-gi (normalize "appendixinfo")))
+ (loop (node-list-rest nl))
+ (loop (empty-node-list))))))))
+ (notepigraph (let loop ((nl (children (current-node)))
+ (ch (empty-node-list)))
+ (if (node-list-empty? nl)
+ ch
+ (if (node-list=? (node-list-first nl) epigraph)
+ (loop (node-list-rest nl) ch)
+ (loop (node-list-rest nl)
+ (node-list ch (node-list-first nl))))))))
+ (make element gi: "DIV"
+ attributes: (list (list "CLASS" (gi)))
+ ($component-separator$)
+ ($component-title$)
+ (process-node-list epigraph)
+ (if ($generate-chapter-toc$)
+ ($chapter-toc$)
+ (empty-sosofo))
+ (process-node-list notepigraph))))
+
+(define ($component-title$ #!optional (titlegi "H1") (subtitlegi "H2"))
+ (let* ((info (cond
+ ((equal? (gi) (normalize "article"))
+ (node-list-filter-by-gi (children (current-node))
+ (list (normalize "artheader")
+ (normalize "articleinfo"))))
+ ((or
+ (equal? (gi) (normalize "appendix"))
+ (equal? (gi) (normalize "bibliography"))
+ (equal? (gi) (normalize "chapter"))
+ (equal? (gi) (normalize "glossary"))
+ (equal? (gi) (normalize "index"))
+ (equal? (gi) (normalize "preface"))
+ (equal? (gi) (normalize "reference"))
+ (equal? (gi) (normalize "setindex")))
+ (select-elements (children (current-node)) (normalize "docinfo")))
+ (else
+ (empty-node-list))))
+ (exp-children (if (node-list-empty? info)
+ (empty-node-list)
+ (expand-children (children info)
+ (list (normalize "bookbiblio")
+ (normalize "bibliomisc")
+ (normalize "biblioset")))))
+ (parent-titles (select-elements (children (current-node)) (normalize "title")))
+ (titles (if (node-list-empty? parent-titles)
+ (select-elements exp-children (normalize "title"))
+ parent-titles))
+ (parent-subttl (select-elements (children (current-node)) (normalize "subtitle")))
+ (subtitles (if (node-list-empty? parent-subttl)
+ (select-elements exp-children (normalize "subtitle"))
+ parent-subttl)))
+ (make sequence
+ (make element gi: titlegi
+ (make sequence
+ (make element gi: "A"
+ attributes: (list (list "NAME" (element-id)))
+ (empty-sosofo))
+ (if (and %chapter-autolabel%
+ (or (equal? (gi) (normalize "chapter"))
+ (equal? (gi) (normalize "appendix"))))
+ (literal (gentext-element-name-space (gi))
+ (element-label (current-node))
+ (gentext-label-title-sep (gi)))
+ (empty-sosofo))
+ (if (node-list-empty? titles)
+ (element-title-sosofo) ;; get a default!
+ (with-mode title-mode
+ (process-node-list titles)))))
+ (if (node-list-empty? subtitles)
+ (empty-sosofo)
+ (with-mode subtitle-mode
+ (make element gi: subtitlegi
+ (process-node-list subtitles)))))))
+
+(define ($chapter-toc$)
+ ;; Called by the TITLE element so that it can come after the TITLE
+ (build-toc (ancestor-member (current-node) (component-element-list))
+ (toc-depth
+ (ancestor-member (current-node) (component-element-list)))
+ #t))
+
+(element appendix ($component$))
+(element (appendix title) (empty-sosofo))
+
+(element chapter ($component$))
+(element (chapter title) (empty-sosofo))
+
+(element preface ($component$))
+(element (preface title) (empty-sosofo))
+
+;; Dedication is empty except in a special mode so that it can be
+;; reordered (made to come before the TOCs)...see dbttlpg.dsl
+;; Dedication is empty except in a special mode so that it can be
+;; reordered (made to come before the TOCs)
+
+(element dedication (empty-sosofo))
+
+(mode dedication-page-mode
+ (element dedication
+ (html-document
+ (with-mode head-title-mode
+ (literal (element-title-string (current-node))))
+ (make sequence
+ ($component-separator$)
+ ($component-title$)
+ (process-children))))
+ (element (dedication title) (empty-sosofo))
+)
+
+(element colophon ($component$))
+
+;; Articles are like components, except that if they may have much
+;; more formal title pages (created with article-titlepage).
+;;
+(element article
+ (let* ((info (node-list-filter-by-gi (children (current-node))
+ (list (normalize "artheader")
+ (normalize "articleinfo"))))
+ (ititle (select-elements (children info) (normalize "title")))
+ (title (if (node-list-empty? ititle)
+ (select-elements (children (current-node))
+ (normalize "title"))
+ (node-list-first ititle)))
+ (tsosofo (with-mode head-title-mode
+ (process-node-list title)))
+ (nl (titlepage-info-elements (current-node) info)))
+ (html-document
+ tsosofo
+ (make element gi: "DIV"
+ attributes: '(("CLASS" "ARTICLE"))
+ (if %generate-article-titlepage%
+ (make sequence
+ (article-titlepage nl 'recto)
+ (article-titlepage nl 'verso))
+ ($component-title$))
+
+ (if (not (generate-toc-in-front))
+ (process-children)
+ (empty-sosofo))
+
+ (if %generate-article-toc%
+ (make sequence
+ (build-toc (current-node)
+ (toc-depth (current-node))))
+ (empty-sosofo))
+
+ (let loop ((gilist ($generate-article-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))))))
+
+(element (article title) (empty-sosofo))
+
+(element (article appendix) ($section$)) ;; this is a special case