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