TIVI-153: Add docbook-style-dssl as dep for iputils
[profile/ivi/docbook-style-dsssl.git] / common / dbl1af.dsl
1 <!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
2 <!ENTITY % af.words
3   PUBLIC "-//Norman Walsh//ENTITIES DocBook Stylesheet Localization//AF"
4          "dbl1af.ent">
5 %af.words;
6 ]>
7
8 <style-sheet>
9 <style-specification id="docbook-l10n-af">
10 <style-specification-body>
11
12 ;; $Id: dbl1af.dsl,v 1.1 2001/07/04 14:46:00 uid48421 Exp $
13 ;;
14 ;; This file is part of the Modular DocBook Stylesheet distribution.
15 ;; See ../README or http://nwalsh.com/docbook/dsssl/
16 ;;
17
18 ;; ----------------------------- Localization -----------------------------
19
20 ;; If you create a new version of this file, please send it to
21 ;; Norman Walsh, ndw@nwalsh.com
22
23 ;; Modified for Afrikaans
24
25 ;; The generated text for cross references to elements.  See dblink.dsl
26 ;; for a discussion of how substitution is performed on the %x 
27 ;; keywords.
28 ;;
29
30 (define (af-author-string #!optional (author (current-node)))
31   ;; Return a formatted string representation of the contents of:
32   ;; AUTHOR:
33   ;;   Handles Honorific, FirstName, SurName, and Lineage.
34   ;;     If %author-othername-in-middle% is #t, also OtherName
35   ;;   Handles *only* the first of each.
36   ;;   Format is "Honorific. FirstName [OtherName] SurName, Lineage"
37   ;; CORPAUTHOR:
38   ;;   returns (data corpauthor)
39   (let* ((h_nl (select-elements (descendants author) (normalize "honorific")))
40          (f_nl (select-elements (descendants author) (normalize "firstname")))
41          (o_nl (select-elements (descendants author) (normalize "othername")))
42          (s_nl (select-elements (descendants author) (normalize "surname")))
43          (l_nl (select-elements (descendants author) (normalize "lineage")))
44          (has_h (not (node-list-empty? h_nl)))
45          (has_f (not (node-list-empty? f_nl)))
46          (has_o (and %author-othername-in-middle%
47                      (not (node-list-empty? o_nl))))
48          (has_s (not (node-list-empty? s_nl)))
49          (has_l (not (node-list-empty? l_nl))))
50     (if (or (equal? (gi author) (normalize "author"))
51             (equal? (gi author) (normalize "editor"))
52             (equal? (gi author) (normalize "othercredit")))
53         (string-append
54          (if has_h (string-append (data-of (node-list-first h_nl)) 
55                                   %honorific-punctuation%) "")
56          (if has_f (string-append 
57                     (if has_h " " "") 
58                     (data-of (node-list-first f_nl))) "")
59          (if has_o (string-append
60                     (if (or has_h has_f) " " "")
61                     (data-of (node-list-first o_nl))) "")
62          (if has_s (string-append 
63                     (if (or has_h has_f has_o) " " "")
64                     (data-of (node-list-first s_nl))) "")
65          (if has_l (string-append ", " (data-of (node-list-first l_nl))) ""))
66         (data-of author))))
67
68 (define (af-xref-strings)
69   (list (list (normalize "appendix")    (if %chapter-autolabel%
70                                             "&Appendix; %n"
71                                             "the &appendix; called %t"))
72         (list (normalize "article")     (string-append %gentext-af-start-quote%
73                                                        "%t"
74                                                        %gentext-af-end-quote%))
75         (list (normalize "bibliography") "%t")
76         (list (normalize "book")        "%t")
77         (list (normalize "chapter")     (if %chapter-autolabel%
78                                             "&Chapter; %n"
79                                             "the &chapter; called %t"))
80         (list (normalize "equation")    "&Equation; %n")
81         (list (normalize "example")     "&Example; %n")
82         (list (normalize "figure")      "&Figure; %n")
83         (list (normalize "glossary")    "%t")
84         (list (normalize "index")       "%t")
85         (list (normalize "listitem")    "%n")
86         (list (normalize "part")        "&Part; %n")
87         (list (normalize "preface")     "%t")
88         (list (normalize "procedure")   "&Procedure; %n, %t")
89         (list (normalize "reference")   "&Reference; %n, %t")
90         (list (normalize "section")     (if %section-autolabel%
91                                             "&Section; %n"
92                                             "the &section; called %t"))
93         (list (normalize "sect1")       (if %section-autolabel%
94                                             "&Section; %n"
95                                             "the &section; called %t"))
96         (list (normalize "sect2")       (if %section-autolabel%
97                                             "&Section; %n"
98                                             "the &section; called %t"))
99         (list (normalize "sect3")       (if %section-autolabel%
100                                             "&Section; %n"
101                                             "the &section; called %t"))
102         (list (normalize "sect4")       (if %section-autolabel%
103                                             "&Section; %n"
104                                             "the &section; called %t"))
105         (list (normalize "sect5")       (if %section-autolabel%
106                                             "&Section; %n"
107                                             "the &section; called %t"))
108         (list (normalize "simplesect")  (if %section-autolabel%
109                                             "&Section; %n"
110                                             "the &section; called %t"))
111         (list (normalize "sidebar")     "the &sidebar; %t")
112         (list (normalize "step")        "&step; %n")
113         (list (normalize "table")       "&Table; %n")))
114
115 (define (gentext-af-xref-strings gind)
116   (let* ((giname (if (string? gind) gind (gi gind)))
117          (name   (normalize giname))
118          (xref   (assoc name (af-xref-strings))))
119     (if xref
120         (car (cdr xref))
121         (let* ((msg    (string-append "[&xrefto; "
122                                       (if giname giname "&nonexistantelement;")
123                                       " &unsupported;]"))
124                (err    (node-list-error msg (current-node))))
125           msg))))
126
127 (define (af-auto-xref-indirect-connector before) 
128   ;; In English, the (cond) is unnecessary since the word is always the
129   ;; same, but in other languages, that's not the case.  I've set this
130   ;; one up with the (cond) so it stands as an example.
131   (cond 
132    ((equal? (gi before) (normalize "book"))
133     (literal " &in; "))
134    ((equal? (gi before) (normalize "chapter"))
135     (literal " &in; "))
136    ((equal? (gi before) (normalize "sect1"))
137     (literal " &in; "))
138    (else
139     (literal " &in; "))))
140
141 ;; Should the TOC come first or last?
142 ;;
143 (define %generate-af-toc-in-front% #t)
144
145 ;; gentext-element-name returns the generated text that should be 
146 ;; used to make reference to the selected element.
147 ;;
148
149 (define (af-element-name)
150   (list
151    (list (normalize "abstract")         "&Abstract;")
152    (list (normalize "answer")           "&Answer;")
153    (list (normalize "appendix")         "&Appendix;")
154    (list (normalize "article")          "&Article;")
155    (list (normalize "bibliography")     "&Bibliography;")
156    (list (normalize "book")             "&Book;")
157    (list (normalize "calloutlist")      "")
158    (list (normalize "caution")          "&Caution;")
159    (list (normalize "chapter")          "&Chapter;")
160    (list (normalize "copyright")        "&Copyright;")
161    (list (normalize "dedication")       "&Dedication;")
162    (list (normalize "edition")          "&Edition;")
163    (list (normalize "equation")         "&Equation;")
164    (list (normalize "example")          "&Example;")
165    (list (normalize "figure")           "&Figure;")
166    (list (normalize "glossary")         "&Glossary;")
167    (list (normalize "glosssee")         "&GlossSee;")
168    (list (normalize "glossseealso")     "&GlossSeeAlso;")
169    (list (normalize "important")        "&Important;")
170    (list (normalize "index")            "&Index;")
171    (list (normalize "colophon")         "&Colophon;")
172    (list (normalize "setindex")         "&SetIndex;")
173    (list (normalize "isbn")             "&ISBN;")
174    (list (normalize "legalnotice")      "&LegalNotice;")
175    (list (normalize "msgaud")           "&MsgAud;")
176    (list (normalize "msglevel")         "&MsgLevel;")
177    (list (normalize "msgorig")          "&MsgOrig;")
178    (list (normalize "note")             "&Note;")
179    (list (normalize "part")             "&Part;")
180    (list (normalize "preface")          "&Preface;")
181    (list (normalize "procedure")        "&Procedure;")
182    (list (normalize "pubdate")          "&Published;")
183    (list (normalize "question")         "&Question;")
184    (list (normalize "refentry")         "&RefEntry;")
185    (list (normalize "reference")        "&Reference;")
186    (list (normalize "refname")          "&RefName;")
187    (list (normalize "revhistory")       "&RevHistory;")
188    (list (normalize "refsect1")         "&RefSection;")
189    (list (normalize "refsect2")         "&RefSection;")
190    (list (normalize "refsect3")         "&RefSection;")
191    (list (normalize "refsynopsisdiv")   "&RefSynopsisDiv;")
192    (list (normalize "revision")         "&Revision;")
193    (list (normalize "sect1")            "&Section;")
194    (list (normalize "sect2")            "&Section;")
195    (list (normalize "sect3")            "&Section;")
196    (list (normalize "sect4")            "&Section;")
197    (list (normalize "sect5")            "&Section;")
198    (list (normalize "section")          "&Section;")
199    (list (normalize "simplesect")       "&Section;")
200    (list (normalize "seeie")            "&See;")
201    (list (normalize "seealsoie")        "&Seealso;")
202    (list (normalize "set")              "&Set;")
203    (list (normalize "sidebar")          "&Sidebar;")
204    (list (normalize "step")             "&step;")
205    (list (normalize "table")            "&Table;")
206    (list (normalize "tip")              "&Tip;")
207    (list (normalize "toc")              "&TableofContents;")
208    (list (normalize "warning")          "&Warning;")
209    ))
210
211 (define (gentext-af-element-name gind)
212   (let* ((giname (if (string? gind) gind (gi gind)))
213          (name   (normalize giname))
214          (pname  (assoc name (af-element-name))))
215     (if pname
216         (car (cdr pname))
217         (let* ((msg (string-append 
218                      "gentext-af-element-name: &unexpectedelementname;: "
219                      name))
220                (err (node-list-error msg (current-node))))
221           msg))))
222
223 ;; gentext-element-name-space returns gentext-element-name with a 
224 ;; trailing space, if gentext-element-name isn't "".
225 ;;
226 (define (gentext-af-element-name-space giname)
227   (string-with-space (gentext-element-name giname)))
228
229 ;; gentext-intra-label-sep returns the seperator to be inserted
230 ;; between multiple occurances of a label (or parts of a label)
231 ;; for the specified element.  Most of these are for enumerated
232 ;; labels like "Figure 2-4", but this function is used elsewhere
233 ;; (e.g. REFNAME) with a little abuse.
234 ;;
235
236 (define (local-af-intra-label-sep)
237   (list))
238
239 (define (af-intra-label-sep)
240   (list
241    (list (normalize "equation")         "-")
242    (list (normalize "informalequation") "-")
243    (list (normalize "example")          "-")
244    (list (normalize "figure")           "-")
245    (list (normalize "listitem")         ".")
246    (list (normalize "procedure")        ".")
247    (list (normalize "refentry")         ".")
248    (list (normalize "reference")        ".")
249    (list (normalize "refname")          ", ")
250    (list (normalize "refsect1")         ".")
251    (list (normalize "refsect2")         ".")
252    (list (normalize "refsect3")         ".")
253    (list (normalize "sect1")            ".")
254    (list (normalize "sect2")            ".")
255    (list (normalize "sect3")            ".")
256    (list (normalize "sect4")            ".")
257    (list (normalize "sect5")            ".")
258    (list (normalize "section")          ".")
259    (list (normalize "simplesect")       ".")
260    (list (normalize "step")             ".")
261    (list (normalize "table")            "-")
262    (list (normalize "_pagenumber")      "-")
263    ))
264
265 (define (gentext-af-intra-label-sep gind)
266   (let* ((giname (if (string? gind) gind (gi gind)))
267          (name   (normalize giname))
268          (sep    (assoc name (af-intra-label-sep))))
269     (if sep
270         (car (cdr sep))
271         "")))
272
273 ;; gentext-label-title-sep returns the seperator to be inserted
274 ;; between a label and the text following the label for the
275 ;; specified element.  Most of these are for use between
276 ;; enumerated labels and titles like "1. Chapter One Title", but
277 ;; this function is used elsewhere (e.g. NOTE) with a little
278 ;; abuse.
279 ;;
280
281 (define (local-af-label-title-sep)
282   (list))
283
284 (define (af-label-title-sep)
285   (list
286    (list (normalize "abstract")         ": ")
287    (list (normalize "answer")           " ")
288    (list (normalize "appendix")         ". ")
289    (list (normalize "caution")          "")
290    (list (normalize "chapter")          ". ")
291    (list (normalize "equation")         ". ")
292    (list (normalize "example")          ". ")
293    (list (normalize "figure")           ". ")
294    (list (normalize "footnote")         ". ")
295    (list (normalize "glosssee")         ": ")
296    (list (normalize "glossseealso")     ": ")
297    (list (normalize "important")        ": ")
298    (list (normalize "note")             ": ")
299    (list (normalize "orderedlist")      ". ")
300    (list (normalize "part")             ". ")
301    (list (normalize "procedure")        ". ")
302    (list (normalize "prefix")           ". ")
303    (list (normalize "question")         " ")
304    (list (normalize "refentry")         "")
305    (list (normalize "reference")        ". ")
306    (list (normalize "refsect1")         ". ")
307    (list (normalize "refsect2")         ". ")
308    (list (normalize "refsect3")         ". ")
309    (list (normalize "sect1")            ". ")
310    (list (normalize "sect2")            ". ")
311    (list (normalize "sect3")            ". ")
312    (list (normalize "sect4")            ". ")
313    (list (normalize "sect5")            ". ")
314    (list (normalize "section")          ". ")
315    (list (normalize "simplesect")       ". ")
316    (list (normalize "seeie")            " ")
317    (list (normalize "seealsoie")        " ")
318    (list (normalize "step")             ". ")
319    (list (normalize "table")            ". ")
320    (list (normalize "tip")              ": ")
321    (list (normalize "warning")          "")
322    ))
323
324 (define (gentext-af-label-title-sep gind)
325   (let* ((giname (if (string? gind) gind (gi gind)))
326          (name   (normalize giname))
327          (sep    (assoc name (af-label-title-sep))))
328     (if sep
329         (car (cdr sep))
330         "")))
331
332 (define (af-label-number-format-list)
333   (list
334    (list (normalize "set")              "1")
335    (list (normalize "book")             "1")
336    (list (normalize "prefix")           "1")
337    (list (normalize "part")             "I")
338    (list (normalize "chapter")          "1")
339    (list (normalize "appendix")         "A")
340    (list (normalize "reference")        "I")
341    (list (normalize "example")          "1")
342    (list (normalize "figure")           "1")
343    (list (normalize "table")            "1")
344    (list (normalize "procedure")        "1")
345    (list (normalize "step")             "1")
346    (list (normalize "refsect1")         "1")
347    (list (normalize "refsect2")         "1")
348    (list (normalize "refsect3")         "1")
349    (list (normalize "sect1")            "1")
350    (list (normalize "sect2")            "1")
351    (list (normalize "sect3")            "1")
352    (list (normalize "sect4")            "1")
353    (list (normalize "sect5")            "1")
354    (list (normalize "section")          "1")
355    ))
356
357 (define (af-label-number-format gind)
358   (let* ((giname (if (string? gind) gind (gi gind)))
359          (name   (normalize giname))
360          (format (assoc name (af-label-number-format-list))))
361     (if format
362         (car (cdr format))
363         "1")))
364
365 (define (af-lot-title)
366   (list
367    (list (normalize "table")            "&ListofTables;")
368    (list (normalize "example")          "&ListofExamples;")
369    (list (normalize "figure")           "&ListofFigures;")
370    (list (normalize "equation")         "&ListofEquations;")
371    ))
372
373 (define ($lot-title-af$ gind)
374   (let* ((giname (if (string? gind) gind (gi gind)))
375          (name   (normalize giname))
376          (title  (assoc name (af-lot-title))))
377     (if title
378         (car (cdr title))
379         (let* ((msg (string-append "&ListofUnknown;: " name))
380                (err (node-list-error msg (current-node))))
381           msg))))
382
383 (define %gentext-af-start-quote% (dingbat "ldquo"))
384
385 (define %gentext-af-end-quote% (dingbat "rdquo"))
386
387 (define %gentext-af-start-nested-quote% (dingbat "lsquo"))
388
389 (define %gentext-af-end-nested-quote% (dingbat "rsquo"))
390
391 (define %gentext-af-by% "&by;") ;; e.g. Copyright 1997 "by" A. Nonymous
392                            ;; Authored "by" Jane Doe
393
394 (define %gentext-af-edited-by% "&Editedby;")
395                            ;; "Edited by" Jane Doe
396
397 (define %gentext-af-revised-by% "&Revisedby;")
398                            ;; "Revised by" Jane Doe
399
400 (define %gentext-af-page% "")
401
402 (define %gentext-af-and% "&and;")
403
404 (define %gentext-af-listcomma% "&listcomma;")
405
406 (define %gentext-af-lastlistcomma% "&lastlistcomma;")
407
408 (define %gentext-af-bibl-pages% "&Pgs;")
409
410 (define %gentext-af-endnotes% "&Notes;")
411
412 (define %gentext-af-table-endnotes% "&TableNotes;:")
413
414 (define %gentext-af-index-see% "&See;")
415
416 (define %gentext-af-index-seealso% "&SeeAlso;")
417
418
419 (define (gentext-af-nav-prev prev) 
420   (make sequence (literal "&nav-prev;")))
421
422 (define (gentext-af-nav-prev-sibling prevsib) 
423   (make sequence (literal "&nav-prev-sibling;")))
424
425 (define (gentext-af-nav-next-sibling nextsib)
426   (make sequence (literal "&nav-next-sibling;")))
427
428 (define (gentext-af-nav-next next)
429   (make sequence (literal "&nav-next;")))
430
431 (define (gentext-af-nav-up up)
432   (make sequence (literal "&nav-up;")))
433
434 (define (gentext-af-nav-home home)
435   (make sequence (literal "&nav-home;")))
436
437 </style-specification-body>
438 </style-specification>
439 </style-sheet>
440