File: dbblock.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 (265 lines) | stat: -rw-r--r-- 6,990 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
;; $Id: dbblock.dsl,v 1.19 1999/12/16 13:19:01 nwalsh Exp $
;;
;; This file is part of the Modular DocBook Stylesheet distribution.
;; See ../README or http://www.berkshire.net/~norm/dsssl/
;;

(element highlights ($block-container$))

(element revhistory ($book-revhistory$))

(element blockquote
  (let ((id     (attribute-string (normalize "id")))
	(attrib (select-elements (children (current-node))
				 (normalize "attribution")))
	(paras  (node-list-filter-by-not-gi
		 (children (current-node))
		 (list (normalize "attribution")))))
    (make sequence
      (if id
	  (make element gi: "A"
		attributes: (list (list "NAME" id))
		(empty-sosofo))
	  (empty-sosofo))

      (if (node-list-empty? attrib) 
	  (make element gi: "BLOCKQUOTE"
		attributes: '(("CLASS" "BLOCKQUOTE"))
		(process-children))
	  (make element gi: "TABLE"
		attributes: '(("BORDER" "0")
			      ("WIDTH" "100%")
			      ("CELLSPACING" "0")
			      ("CELLPADDING" "0")
			      ("CLASS" "BLOCKQUOTE"))
		(make element gi: "TR"
		      (make element gi: "TD"
			    attributes: '(("WIDTH" "10%")
					  ("VALIGN" "TOP"))
			    (make entity-ref name: "nbsp"))
		      (make element gi: "TD"
			    attributes: '(("WIDTH" "80%")
					  ("VALIGN" "TOP"))
			    (process-node-list paras))
		      (make element gi: "TD"
			    attributes: '(("WIDTH" "10%")
					  ("VALIGN" "TOP"))
			    (make entity-ref name: "nbsp")))
		(make element gi: "TR"
		      (make element gi: "TD"
			    attributes: '(("COLSPAN" "2")
					  ("ALIGN" "RIGHT")
					  ("VALIGN" "TOP"))
			    (make sequence
			      (literal "--")
			      (process-node-list attrib)))
		      (make element gi: "TD"
			    attributes: '(("WIDTH" "10%"))
			    (make entity-ref name: "nbsp"))))))))
	
(element epigraph
  (let* ((attrib       (select-elements (children (current-node))
					(normalize "attribution")))
	 (paras        (node-list-filter-by-not-gi
			(children (current-node))
			(list (normalize "attribution")))))
  (make element gi: "TABLE"
	attributes: '(("BORDER" "0")
		      ("WIDTH" "100%")
		      ("CELLSPACING" "0")
		      ("CELLPADDING" "0")
		      ("CLASS" "EPIGRAPH"))
	(make element gi: "TR"
	      (make element gi: "TD"
		    attributes: '(("WIDTH" "45%"))
		    (make entity-ref name: "nbsp"))
	      (make element gi: "TD"
		    attributes: '(("WIDTH" "45%")
				  ("ALIGN" "LEFT")
				  ("VALIGN" "TOP"))
		    (make element gi: "I"
			  (process-node-list paras))))
	(if (node-list-empty? attrib)
	    (empty-sosofo)
	    (make element gi: "TR"
		  (make element gi: "TD"
			attributes: '(("WIDTH" "45%"))
			(make entity-ref name: "nbsp"))
		  (make element gi: "TD"
			attributes: '(("WIDTH" "45%")
				      ("ALIGN" "RIGHT")
				      ("VALIGN" "TOP"))
			(make element gi: "I"
			      (process-node-list attrib))))))))

(element attribution ($charseq$))

(element (epigraph para)
  (make element gi: "P"
	(make element gi: "I"
	      (process-children-trim))))

(element para ($paragraph$))
(element simpara ($paragraph$))

(element formalpara
  (make element gi: "DIV"
	attributes: (list
		     (list "CLASS" (gi)))
	(make element gi: "P"
	      (process-children))))

(element (formalpara title) ($runinhead$))

(element (formalpara para)
  (process-children))

(element sidebar 
  (make element gi: "TABLE"
	attributes: (list
		     (list "CLASS" (gi))
		     (list "BORDER" "1")
		     (list "CELLPADDING" "5"))
	(make element gi: "TR"
	      (make element gi: "TD"
		    ($semiformal-object$)))))

(element (sidebar title)
  (empty-sosofo))

(element abstract 
  (make element gi: "BLOCKQUOTE"
	attributes: '(("CLASS" "ABSTRACT"))
	($semiformal-object$)))

(element (abstract title) (empty-sosofo))

(element authorblurb ($block-container$))

(element ackno ($paragraph$))

(define ($inline-object$)
  (process-children))

(define ($informal-object$ #!optional (rule-before? #f) (rule-after? #f))
  (let ((id (attribute-string (normalize "id"))))
    (make element gi: "DIV"
	  attributes: (list
		       (list "CLASS" (gi)))
	  (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))
	  
	  (if rule-before?
	      (make empty-element gi: "HR")
	      (empty-sosofo))

	  (process-children)

	  (if rule-after?
	      (make empty-element gi: "HR")
	      (empty-sosofo))
	  
	  (if %spacing-paras%
	      (make element gi: "P" (empty-sosofo))
	      (empty-sosofo)))))
  
(define (object-title-after #!optional (node (current-node))) 
  (if (member (gi node) ($object-titles-after$))
      #t
      #f))

(define (named-formal-objects)
  (list (normalize "figure")
	(normalize "table")
	(normalize "example")
	(normalize "equation")))

(define ($formal-object$ #!optional (rule-before? #f) (rule-after? #f))
  (let* ((nsep  (gentext-label-title-sep (gi)))
	 (id    (attribute-string (normalize "id")))
	 (title-inline-sosofo 
	        (make sequence
		  (if (member (gi) (named-formal-objects))
		      (make sequence
			(literal (gentext-element-name (gi)))
			(if (string=? (element-label) "")
			    (literal nsep)
			    (literal " " (element-label) nsep)))
		      (empty-sosofo))
		  (with-mode title-mode
		    (process-node-list 
		     (select-elements (children (current-node))
				      (normalize "title"))))))
	 (title-sosofo (make element gi: "P"
			     (make element gi: "B"
				   title-inline-sosofo)))
	 (object-sosofo (process-children)))
    (make element gi: "DIV" 
	  attributes: (list
		       (list "CLASS" (gi)))

	  (if rule-before?
	      (make empty-element gi: "HR")
	      (empty-sosofo))

	  (if id
	      (make element gi: "A"
		    attributes: (list 
				 (list "NAME" id))
		    (empty-sosofo))
	      (empty-sosofo))
	  
	  (if (object-title-after)
	      (make sequence
		object-sosofo
		title-sosofo)
	      (make sequence
		title-sosofo
		object-sosofo))

	  (if rule-after?
	      (make empty-element gi: "HR")
	      (empty-sosofo)))))

(define ($semiformal-object$)
  ;; semiformal means optional title...
  (if (node-list-empty? (select-elements (children (current-node)) 
					 (normalize "title")))
      ($informal-object$)
      ($formal-object$)))

(element example 
  ($formal-object$ %example-rules% %example-rules%))

(element (example title) (empty-sosofo)) ; don't show caption below example

(element informalexample
  ($informal-object$ %informalexample-rules% %informalexample-rules%))

(element (figure title) (empty-sosofo)) ; don't show caption below figure

(element figure 
  ($formal-object$ %figure-rules% %figure-rules%))

(element informaltable
  ($informal-object$ %informaltable-rules% %informaltable-rules%))

(element table
  ($formal-object$ %table-rules% %table-rules%))

(element (table title) (empty-sosofo))

(element comment
  (if %show-comments%
      (make element gi: "P"
	    attributes: '(("CLASS" "COMMENT"))
	    (process-children))
      (empty-sosofo)))