1 <!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
3 PUBLIC "-//Norman Walsh//ENTITIES DocBook Stylesheet Localization//JA"
9 <style-specification id="docbook-l10n-ja">
10 <style-specification-body>
12 ;; $Id: dbl1ja.dsl,v 1.2 2001/06/20 12:50:47 nwalsh Exp $
14 ;; This file is part of the Modular DocBook Stylesheet distribution.
15 ;; See ../README or http://nwalsh.com/docbook/dsssl/
18 ;; ----------------------------- Localization -----------------------------
20 ;; If you create a new version of this file, please send it to
21 ;; Norman Walsh, ndw@nwalsh.com
24 ;; Karl Critz, kcritz@mathworks.com, contributed the original dbl1ja.ent file
25 ;; ISHIDA Eri, eri@laser5.co.jp
26 ;; Ryan Shaw, ryan@silveregg.co.jp
28 (define (ja-author-string #!optional (author (current-node)))
29 ;; Return a formatted string representation of the contents of:
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"
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")))
52 (if has_h (string-append (data-of (node-list-first h_nl))
53 %honorific-punctuation%) "")
54 (if has_f (string-append
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))) ""))
66 (define (ja-xref-strings)
67 (list (list (normalize "appendix") (if %chapter-autolabel%
70 (list (normalize "article") (string-append %gentext-ja-start-quote%
72 %gentext-ja-end-quote%))
73 (list (normalize "bibliography") "%t")
74 (list (normalize "book") "%t")
75 (list (normalize "chapter") (if %chapter-autolabel%
76 "&Chapter1;%n&Chapter2;"
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%
91 (list (normalize "sect1") (if %section-autolabel%
94 (list (normalize "sect2") (if %section-autolabel%
97 (list (normalize "sect3") (if %section-autolabel%
100 (list (normalize "sect4") (if %section-autolabel%
103 (list (normalize "sect5") (if %section-autolabel%
106 (list (normalize "simplesect") (if %section-autolabel%
109 (list (normalize "sidebar") "%t&sidebar;")
110 (list (normalize "step") "&step;%n")
111 (list (normalize "table") "&Table;%n")))
113 (define (gentext-ja-xref-strings gind)
114 (let* ((giname (if (string? gind) gind (gi gind)))
115 (name (normalize giname))
116 (xref (assoc name (ja-xref-strings))))
119 (let* ((msg (string-append "[&xrefto; "
120 (if giname giname "&nonexistantelement;")
122 (err (node-list-error msg (current-node))))
125 (define (ja-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.
130 ((equal? (gi before) (normalize "book"))
132 ((equal? (gi before) (normalize "chapter"))
134 ((equal? (gi before) (normalize "sect1"))
139 ;; Should the TOC come first or last?
141 (define %generate-ja-toc-in-front% #t)
143 ;; gentext-element-name returns the generated text that should be
144 ;; used to make reference to the selected element.
147 (define (ja-element-name)
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") "&Chapter1;")
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;")
209 (define (gentext-ja-element-name gind)
210 (let* ((giname (if (string? gind) gind (gi gind)))
211 (name (normalize giname))
212 (pname (assoc name (ja-element-name))))
215 (let* ((msg (string-append
216 "gentext-ja-element-name: &unexpectedelementname;: "
218 (err (node-list-error msg (current-node))))
221 ;; gentext-element-name-space returns gentext-element-name with a
222 ;; trailing space, if gentext-element-name isn't "".
224 (define (gentext-ja-element-name-space giname)
225 (string-with-space (gentext-element-name giname)))
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.
234 (define (local-ja-intra-label-sep)
237 (define (ja-intra-label-sep)
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") "-")
263 (define (gentext-ja-intra-label-sep gind)
264 (let* ((giname (if (string? gind) gind (gi gind)))
265 (name (normalize giname))
266 (lsep (assoc name (local-ja-intra-label-sep)))
267 (sep (assoc name (ja-intra-label-sep))))
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
282 (define (local-ja-label-title-sep)
285 (define (ja-label-title-sep)
287 (list (normalize "abstract") ": ")
288 (list (normalize "answer") " ")
289 (list (normalize "appendix") ". ")
290 (list (normalize "caution") "")
291 (list (normalize "chapter") "&Chapter2;")
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") "")
325 (define (gentext-ja-label-title-sep gind)
326 (let* ((giname (if (string? gind) gind (gi gind)))
327 (name (normalize giname))
328 (lsep (assoc name (local-ja-label-title-sep)))
329 (sep (assoc name (ja-label-title-sep))))
336 (define (ja-label-number-format-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")
361 (define (ja-label-number-format gind)
362 (let* ((giname (if (string? gind) gind (gi gind)))
363 (name (normalize giname))
364 (format (assoc name (ja-label-number-format-list))))
369 (define (ja-lot-title)
371 (list (normalize "table") "&ListofTables;")
372 (list (normalize "example") "&ListofExamples;")
373 (list (normalize "figure") "&ListofFigures;")
374 (list (normalize "equation") "&ListofEquations;")
377 (define ($lot-title-ja$ gind)
378 (let* ((giname (if (string? gind) gind (gi gind)))
379 (name (normalize giname))
380 (title (assoc name (ja-lot-title))))
383 (let* ((msg (string-append "&ListofUnknown;: " name))
384 (err (node-list-error msg (current-node))))
387 (define %gentext-ja-start-quote% (dingbat "ldquo"))
389 (define %gentext-ja-end-quote% (dingbat "rdquo"))
391 (define %gentext-ja-start-nested-quote% (dingbat "lsquo"))
393 (define %gentext-ja-end-nested-quote% (dingbat "rsquo"))
395 (define %gentext-ja-by% "&by;") ;; e.g. Copyright 1997 "by" A. Nonymous
396 ;; Authored "by" Jane Doe
398 (define %gentext-ja-edited-by% "&Editedby;")
399 ;; "Edited by" Jane Doe
401 (define %gentext-ja-revised-by% "&Revisedby;")
402 ;; "Revised by" Jane Doe
404 (define %gentext-ja-page% "")
406 (define %gentext-ja-and% "∧")
408 (define %gentext-ja-listcomma% "&listcomma;")
410 (define %gentext-ja-lastlistcomma% "&lastlistcomma;")
412 (define %gentext-ja-bibl-pages% "&Pgs;")
414 (define %gentext-ja-endnotes% "&Notes;")
416 (define %gentext-ja-table-endnotes% "&TableNotes;:")
418 (define %gentext-ja-index-see% "&See;")
420 (define %gentext-ja-index-seealso% "&SeeAlso;")
423 (define (gentext-ja-nav-prev prev)
424 (make sequence (literal "&nav-prev;")))
426 (define (gentext-ja-nav-prev-sibling prevsib)
427 (make sequence (literal "&nav-prev-sibling;")))
429 (define (gentext-ja-nav-next-sibling nextsib)
430 (make sequence (literal "&nav-next-sibling;")))
432 (define (gentext-ja-nav-next next)
433 (make sequence (literal "&nav-next;")))
435 (define (gentext-ja-nav-up up)
436 (make sequence (literal "&nav-up;")))
438 (define (gentext-ja-nav-home home)
439 (make sequence (literal "&nav-home;")))
443 </style-specification-body>
444 </style-specification>