1;; $Id: dbinline.dsl,v 1.7 2003/03/25 19:53:56 adicarlo Exp $
2;;
3;; This file is part of the Modular DocBook Stylesheet distribution.
4;; See ../README or http://docbook.sourceforge.net/projects/dsssl/
5;;
6
7;; ============================== INLINES ===============================
8
9(element abbrev ($charseq$))
10(element accel ($score-seq$ 'after))
11(element acronym ($charseq$))
12(element action ($charseq$))
13(element application ($charseq$))
14(element classname ($mono-seq$))
15(element constant ($mono-seq$))
16(element command ($bold-seq$))
17(element computeroutput ($mono-seq$))
18(element database ($charseq$))
19(element email
20  (make sequence (literal "<") ($mono-seq$) (literal ">")))
21(element envar ($charseq$))
22(element errorcode ($charseq$))
23(element errorname ($charseq$))
24(element errortype ($charseq$))
25(element filename ($mono-seq$))
26(element function ($mono-seq$))
27(element guibutton ($guilabel-seq$))
28(element guiicon ($guilabel-seq$))
29(element guilabel ($guilabel-seq$))
30(element guimenu ($guilabel-seq$))
31(element guimenuitem ($guilabel-seq$))
32(element guisubmenu ($guilabel-seq$))
33(element hardware ($charseq$))
34(element interface ($charseq$))
35(element interfacedefinition ($charseq$))
36(element keycap ($bold-seq$))
37(element keycode ($charseq$))
38
39(element keycombo
40  (let* ((action (attribute-string (normalize "action")))
41	 (joinchar
42	  (cond
43	   ((equal? action (normalize "seq")) " ")          ;; space
44	   ((equal? action (normalize "simul")) "+")        ;; +
45	   ((equal? action (normalize "press")) "-")        ;; ? I don't know
46	   ((equal? action (normalize "click")) "-")        ;; ? what to do
47	   ((equal? action (normalize "double-click")) "-") ;; ? about the rest
48	   ((equal? action (normalize "other")) "-")        ;; ? of these
49	   (else "-"))))
50    (let loop ((nl (children (current-node))) (count 1))
51      (if (node-list-empty? nl)
52	  (empty-sosofo)
53	  (if (equal? count 1)
54	      (make sequence
55		(process-node-list (node-list-first nl))
56		(loop (node-list-rest nl) (+ count 1)))
57	      (make sequence
58		(literal joinchar)
59		(process-node-list (node-list-first nl))
60		(loop (node-list-rest nl) (+ count 1))))))))
61
62(element keysym ($charseq$))
63(element literal ($mono-seq$))
64(element medialabel ($italic-seq$))
65
66(element menuchoice
67  (let* ((shortcut (select-elements (children (current-node))
68				    (normalize "shortcut")))
69	 (items    (node-list-filter-by-not-gi
70		    (children (current-node))
71		    (list (normalize "shortcut")))))
72    (make sequence
73      (let loop ((nl items) (first? #t))
74	(if (node-list-empty? nl)
75	    (empty-sosofo)
76	    (make sequence
77	      (if first?
78		  (process-node-list (node-list-first nl))
79		  (make sequence
80		    (if (or (equal? (gi (node-list-first nl))
81				    (normalize "guimenuitem"))
82			    (equal? (gi (node-list-first nl))
83				    (normalize "guisubmenu")))
84			(literal "\rightwards-arrow;")
85			(literal "+"))
86		    (process-node-list (node-list-first nl))))
87	      (loop (node-list-rest nl) #f))))
88      (if (node-list-empty? shortcut)
89	  (empty-sosofo)
90	  (make sequence
91	    (literal " (")
92	    (process-node-list shortcut)
93	    (literal ")"))))))
94
95(element methodname ($mono-seq$))
96(element shortcut ($bold-seq$))
97(element mousebutton ($charseq$))
98(element option ($mono-seq$))
99
100(element optional
101  (make sequence
102    (literal %arg-choice-opt-open-str%)
103    ($charseq$)
104    (literal %arg-choice-opt-close-str%)))
105
106(element parameter ($italic-mono-seq$))
107(element property ($charseq$))
108(element prompt ($mono-seq$))
109(element replaceable ($italic-mono-seq$))
110(element returnvalue ($charseq$))
111(element structfield ($italic-mono-seq$))
112(element structname ($charseq$))
113(element symbol ($charseq$))
114(element systemitem ($charseq$))
115(element token ($charseq$))
116(element type ($charseq$))
117(element userinput ($bold-mono-seq$))
118(element varname ($mono-seq$))
119
120(element citation
121  (if biblio-citation-check
122      (let* ((bgraphies (select-elements (descendants (sgml-root-element))
123					 (normalize "bibliography")))
124	     (bchildren1 (expand-children bgraphies
125					  (list (normalize "bibliography"))))
126	     (bchildren2 (expand-children bchildren1
127					  (list (normalize "bibliodiv"))))
128	     (bibentries (node-list-filter-by-gi
129			  bchildren2
130			  (list (normalize "biblioentry")
131				(normalize "bibliomixed")))))
132	(let loop ((bibs bibentries))
133	  (if (node-list-empty? bibs)
134	      (make sequence
135		(error (string-append "Cannot find citation: "
136					   (data (current-node))))
137		(literal "[") ($charseq$) (literal "]"))
138	      (if (citation-matches-target? (current-node)
139					    (node-list-first bibs))
140		  (make link
141		    destination: (node-list-address (node-list-first bibs))
142		    (literal "[") ($charseq$) (literal "]"))
143		  (loop (node-list-rest bibs))))))
144      (make sequence
145	(literal "[") ($charseq$) (literal "]"))))
146
147(element citerefentry
148  (if %refentry-xref-italic%
149      ($italic-seq$)
150      ($charseq$)))
151
152(element citetitle
153  (if (equal? (attribute-string (normalize "pubwork")) "article")
154      (make sequence
155	(literal (gentext-start-quote))
156	(process-children)
157	(literal (gentext-end-quote)))
158      ($italic-seq$)))
159
160(element emphasis
161  (if (and (attribute-string (normalize "role"))
162	   (or (equal? (attribute-string (normalize "role")) "strong")
163	       (equal? (attribute-string (normalize "role")) "bold")))
164      ($bold-seq$)
165      ($italic-seq$)))
166
167(element foreignphrase ($italic-seq$))
168(element markup ($charseq$))
169(element phrase ($charseq$))
170
171(element quote
172  (let* ((hnr   (hierarchical-number-recursive (normalize "quote")
173					       (current-node)))
174	 (depth (length hnr)))
175    (if (equal? (modulo depth 2) 1)
176	(make sequence
177	  (literal (gentext-start-nested-quote))
178	  (process-children)
179	  (literal (gentext-end-nested-quote)))
180	(make sequence
181	  (literal (gentext-start-quote))
182	  (process-children)
183	  (literal (gentext-end-quote))))))
184
185(element sgmltag
186  (let ((class (if (attribute-string (normalize "class"))
187		   (attribute-string (normalize "class"))
188		   (normalize "element"))))
189    (cond
190<![CDATA[
191      ((equal? class (normalize "attribute")) ($mono-seq$))
192      ((equal? class (normalize "attvalue")) ($mono-seq$))
193      ((equal? class (normalize "element")) ($mono-seq$))
194      ((equal? class (normalize "emptytag")) ($mono-seq$ (make sequence
195				  (literal "<")
196				  (process-children)
197				  (literal "/>"))))
198      ((equal? class (normalize "endtag")) ($mono-seq$ (make sequence
199			       (literal "</")
200			       (process-children)
201			       (literal ">"))))
202      ((equal? class (normalize "genentity")) ($mono-seq$ (make sequence
203				    (literal "&")
204				    (process-children)
205				    (literal ";"))))
206      ((equal? class (normalize "numcharref")) ($mono-seq$ (make sequence
207				     (literal "&#")
208				     (process-children)
209				     (literal ";"))))
210      ((equal? class (normalize "paramentity")) ($mono-seq$ (make sequence
211				      (literal "%")
212				      (process-children)
213				      (literal ";"))))
214      ((equal? class (normalize "pi")) ($mono-seq$ (make sequence
215			    (literal "<?")
216			    (process-children)
217			    (literal ">"))))
218      ((equal? class (normalize "starttag")) ($mono-seq$ (make sequence
219				  (literal "<")
220				  (process-children)
221				  (literal ">"))))
222      ((equal? class (normalize "sgmlcomment")) ($mono-seq$ (make sequence
223				     (literal "<!--")
224				     (process-children)
225				     (literal "-->"))))
226      ((equal? class (normalize "xmlpi")) ($mono-seq$ (make sequence
227			    (literal "<?")
228			    (process-children)
229			    (literal "?>"))))
230]]>
231      (else ($charseq$)))))
232
233(element trademark
234  (make sequence
235    ($charseq$)
236    (cond
237     ((equal? (attribute-string "class") (normalize "copyright"))
238      (literal "\copyright-sign;"))
239     ((equal? (attribute-string "class") (normalize "registered"))
240      (literal "\registered-sign;"))
241     ((equal? (attribute-string "class") (normalize "service"))
242      ($ss-seq$ + (literal "SM")))
243     (else
244      (literal "\trade-mark-sign;")))))
245
246(element wordasword ($italic-seq$))
247
248(element lineannotation
249  (make sequence
250    font-family-name: %body-font-family%
251    font-posture: 'italic
252    (process-children)))
253
254(define ($ss-seq$ plus-or-minus #!optional (sosofo (process-children)))
255  (make sequence
256	font-size:
257	  (* (inherited-font-size) %ss-size-factor%)
258	position-point-shift:
259	  (plus-or-minus (* (inherited-font-size) %ss-shift-factor%))
260	sosofo))
261
262(element superscript ($ss-seq$ +))
263(element subscript ($ss-seq$ -))
264