File: dbadmon.dsl

package info (click to toggle)
docbook-stylesheets 1.49-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 7,576 kB
  • ctags: 33
  • sloc: perl: 444; xml: 115; makefile: 98; sh: 27
file content (171 lines) | stat: -rw-r--r-- 5,350 bytes parent folder | download
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
;; $Id: dbadmon.dsl,v 1.9 1999/11/18 12:17:51 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))
	 (id        (attribute-string (normalize "id")))
	 (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))))
	 (gr-cell   (make element gi: "TD"
			  attributes: (list 
				       (list "WIDTH" 
					     ($admon-graphic-width$))
				       (list "ALIGN" "CENTER")
				       (list "VALIGN" "TOP"))
			  (make empty-element gi: "IMG"
				attributes: (list 
					     (list "SRC" 
						   (root-rel-path 
						    ($admon-graphic$)))
					     (list "HSPACE" "5")
					     (list "ALT"
						   (gentext-element-name adm))))))
	 (ttl-cell  (make element gi: "TH"
			  attributes: '(("ALIGN" "LEFT")
					("VALIGN" "CENTER"))
			  (make element gi: "B" adm-title)))
	 (body-cell (make element gi: "TD"
			  attributes: '(("ALIGN" "LEFT")
					("VALIGN" "TOP"))
			  (process-children))))
    (make element gi: "DIV"
	  attributes: (list (list "CLASS" (gi adm)))
	  (if id 
	      (make element gi: "A"
		    attributes: (list (list "NAME" id))
		    (empty-sosofo))
	      (empty-sosofo))
	  (if %spacing-paras%
	      (make element gi: "P" (empty-sosofo))
	      (empty-sosofo))
	  (make element gi: "TABLE"
		attributes: (list (list "CLASS" (gi))
				  (list "WIDTH" ($table-width$))
				  (list "BORDER" "0"))
		(if title?
		    (make sequence
		      (make element gi: "TR"
			    gr-cell
			    ttl-cell)
		      (make element gi: "TR"
			    (make element gi: "TD"
				  (make entity-ref name: "nbsp"))
			    body-cell))
		    (make sequence
		      (make element gi: "TR"
			    gr-cell
			    body-cell)))))))

(define ($admonition$)
  (let ((id     (attribute-string (normalize "id"))))
    (if %admon-graphics%
	($graphical-admonition$)
	(make element gi: "DIV"
	      attributes: (list (list "CLASS" (gi)))
	      ;; The DIV isn't strictly necessary, of course, but it
	      ;; is consistent with the graphical-admonition case.
	      (make element gi: "BLOCKQUOTE"
		    attributes: (list
				 (list "CLASS" (gi)))
		    (if id
			(make element gi: "A"
			      attributes: (list (list "NAME" id))
			      (empty-sosofo))
			(empty-sosofo))
		    (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 
			  (gi (parent (current-node))))
			 (gentext-label-title-sep 
			  (gi (parent (current-node))))))))
    (make element gi: "P"
	  (if (and (not %admon-graphics%) (= (child-number) 1))
	      (make element gi: "B"
		    adm-title)
	      (empty-sosofo))
	  (process-children))))

(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
;;
(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 
			  (gi (current-node))))))
	 (id     (attribute-string (normalize "id"))))
    (if %admon-graphics%
	($graphical-admonition$)
	(make element gi: "DIV"
	      attributes: (list (list "CLASS" (gi)))
	      ;; The DIV isn't strictly necessary, of course, but it
	      ;; is consistent with the graphical-admonition case.
	      (if %spacing-paras%
		  (make element gi: "P" (empty-sosofo))
		  (empty-sosofo))
	      (make element gi: "TABLE"
		    attributes: (list
				 (list "CLASS" (gi))
				 (list "BORDER" "1")
				 (list "WIDTH" ($table-width$)))
		    (make element gi: "TR"
			  (make element gi: "TD"
				attributes: (list
					     (list "ALIGN" "CENTER"))
				(make element gi: "B"
				      (if id
					  (make element gi: "A"
						attributes: (list (list "NAME" id))
						(empty-sosofo))
					  (empty-sosofo))
				      adm-title)))
		    (make element gi: "TR"
			  (make element gi: "TD"
				attributes: (list
					     (list "ALIGN" "LEFT"))
				(process-children))))))))

(element caution ($peril$))
(element warning ($peril$))
(element (caution title) (empty-sosofo))
(element (warning title) (empty-sosofo))