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