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
|
;; $Id: dbadmon.dsl,v 1.10 1999/11/18 12:20:31 nwalsh Exp $
;;
;; This file is part of the Modular DocBook Stylesheet distribution.
;; See ../README or http://www.berkshire.net/~norm/dsssl/
;;
;; ============================ ADMONITIONS =============================
(define ($graphical-admonition$)
(let* ((adm (current-node))
(title (select-elements (children adm)
(normalize "title")))
(title? (not (node-list-empty? title)))
(adm-title (if title?
(with-mode title-sosofo-mode
(process-node-list (node-list-first title)))
(literal (gentext-element-name adm))))
(graphic (make external-graphic
display?: #f
entity-system-id: ($admon-graphic$)))
(f-child (node-list-first (children (current-node))))
(r-child (node-list-rest (children (current-node)))))
(make display-group
space-before: %block-sep%
space-after: %block-sep%
start-indent: (+ (inherited-start-indent) ($admon-graphic-width$))
font-family-name: %admon-font-family%
font-size: (- %bf-size% 1pt)
font-weight: 'medium
font-posture: 'upright
line-spacing: (* (- %bf-size% 1pt) %line-spacing-factor%)
(if title?
(make display-group
(make paragraph
first-line-start-indent: (- ($admon-graphic-width$))
(make line-field
field-width: ($admon-graphic-width$)
graphic)
(make sequence
font-family-name: %title-font-family%
font-weight: 'bold
adm-title))
(process-children))
(make display-group
(make paragraph
first-line-start-indent: (- ($admon-graphic-width$))
(make line-field
field-width: ($admon-graphic-width$)
graphic)
(process-node-list (children f-child)))
(process-node-list r-child))))))
(define ($admonition$)
(if %admon-graphics%
($graphical-admonition$)
(make display-group
space-before: %block-sep%
space-after: %block-sep%
start-indent: (if %admon-graphics%
(inherited-start-indent)
(+ (inherited-start-indent) (* (ILSTEP) 2)))
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%)
(process-children))))
(define ($admonpara$)
(let* ((title (select-elements
(children (parent (current-node))) (normalize "title")))
(has-title (not (node-list-empty? title)))
(adm-title (if has-title
(make sequence
(with-mode title-sosofo-mode
(process-node-list (node-list-first title)))
(literal (gentext-label-title-sep
(gi (parent (current-node))))))
(literal
(gentext-element-name
(parent (current-node)))
(gentext-label-title-sep
(gi (parent (current-node))))))))
(make paragraph
space-before: %para-sep%
space-after: %para-sep%
(if (and (not %admon-graphics%) (= (child-number) 1))
(make sequence
font-family-name: %title-font-family%
font-weight: 'bold
adm-title)
(empty-sosofo))
(process-children-trim))))
(element important ($admonition$))
(element (important title) (empty-sosofo))
(element (important para) ($admonpara$))
(element (important simpara) ($admonpara$))
(element note ($admonition$))
(element (note title) (empty-sosofo))
(element (note para) ($admonpara$))
(element (note simpara) ($admonpara$))
(element tip ($admonition$))
(element (tip title) (empty-sosofo))
(element (tip para) ($admonpara$))
(element (tip simpara) ($admonpara$))
;; perils are given special treatment by generating a centered title
;; and throwing a box around them
;; note that the paragraph indents are set by the box characteristics
;;
(define ($peril$)
(let* ((title (select-elements
(children (current-node)) (normalize "title")))
(has-title (not (node-list-empty? title)))
(adm-title (if has-title
(make sequence
(with-mode title-sosofo-mode
(process-node-list (node-list-first title))))
(literal
(gentext-element-name
(current-node)))))
(hs (HSIZE 2)))
(if %admon-graphics%
($graphical-admonition$)
(make display-group
space-before: %block-sep%
space-after: %block-sep%
font-family-name: %admon-font-family%
font-size: (- %bf-size% 1pt)
font-weight: 'medium
font-posture: 'upright
line-spacing: (* (- %bf-size% 1pt) %line-spacing-factor%)
(make box
display?: #t
box-type: 'border
line-thickness: 2pt
start-indent: (+ (inherited-start-indent) (* 2 (ILSTEP)) 2pt)
end-indent: (inherited-end-indent)
(make paragraph
space-before: %para-sep%
space-after: %para-sep%
start-indent: 1em
end-indent: 1em
font-family-name: %title-font-family%
font-weight: 'bold
font-size: hs
line-spacing: (* hs %line-spacing-factor%)
quadding: 'center
keep-with-next?: #t
adm-title)
(process-children))))))
(element caution ($peril$))
(element (caution title) (empty-sosofo))
(element warning ($peril$))
(element (warning title) (empty-sosofo))
|