From ce1cb7e0d57df7d16afa9db7ea1150986baeaac5 Mon Sep 17 00:00:00 2001 From: Xin LI Date: Sun, 28 Aug 2005 16:58:24 +0000 Subject: [PATCH] Improved build infrastructure which will provide better page rendering experience. Submitted by: "intron" Obtained from: The FreeBSD Simplified Chinese Project --- zh_CN.GB2312/share/sgml/dbl1zhcn.ent | 170 -------- zh_CN.GB2312/share/sgml/freebsd.dsl | 593 +++++++++++++++++++-------- 2 files changed, 433 insertions(+), 330 deletions(-) delete mode 100644 zh_CN.GB2312/share/sgml/dbl1zhcn.ent diff --git a/zh_CN.GB2312/share/sgml/dbl1zhcn.ent b/zh_CN.GB2312/share/sgml/dbl1zhcn.ent deleted file mode 100644 index 3cd9ad3559..0000000000 --- a/zh_CN.GB2312/share/sgml/dbl1zhcn.ent +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/zh_CN.GB2312/share/sgml/freebsd.dsl b/zh_CN.GB2312/share/sgml/freebsd.dsl index 583b2f0f13..2308490202 100644 --- a/zh_CN.GB2312/share/sgml/freebsd.dsl +++ b/zh_CN.GB2312/share/sgml/freebsd.dsl @@ -1,173 +1,446 @@ - + - - -%zhcn.words; + + +%freebsd.l10n; + + + + ]> - + + + (define %refentry-xref-link% #t) + + (define ($email-footer$) + (make sequence + (make element gi: "p" + attributes: (list (list "align" "center")) + (make element gi: "small" + (literal "本文档和其它文档可从这里下载:") + (create-link + (list (list "HREF" "ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/")) + (literal "ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/")) + (literal "."))) + (make element gi: "p" + attributes: (list (list "align" "center")) + (make element gi: "small" + (literal "如果对于FreeBSD有问题,请先阅读") + (create-link + (list (list "HREF" "http://www.FreeBSD.org/docs.html")) + (literal "文档")) + (literal ",如不能解决再联系<") + (create-link + (list (list "HREF" "mailto:questions@FreeBSD.org")) + (literal "questions@FreeBSD.org")) + (literal ">.") + (make empty-element gi: "br") + (literal "关于本文档的问题请发信联系 <") + (create-link (list (list "HREF" "mailto:doc@FreeBSD.org")) + (literal "doc@FreeBSD.org")) + (literal ">."))))) + +;; 以下几个定义可产生出汉语习惯的章节号。 +;; 很奇怪,不知道定义在 +;; /usr/local/share/sgml/docbook/dsssl/modular/common/dbl1zhcn.dsl +;; 中的zhcn-xref-strings为什么不起作用。 +;; 用Google可以搜索到其它语言翻译者此类抱怨的文章。 + +;; toc-entry +;; 修改自 /usr/local/share/sgml/docbook/dsssl/modular/html/dbautoc.dsl +;; 在目录中显示: +;; 第 xx 章 +;; 第 xx.xx 节 + +(define (toc-entry tocentry) + (make element gi: "DT" + (make sequence + (if (equal? (element-label tocentry) "") + (empty-sosofo) + (make sequence + (literal "第") + (literal (element-label tocentry)) + (literal (gentext-element-name tocentry)) + (literal (gentext-label-title-sep + (gi tocentry))))) + + ;; If the tocentry isn't in its own + ;; chunk, don't make a link... + (if (and #f (not (chunk? tocentry))) + (element-title-sosofo tocentry) + (make element gi: "A" + attributes: (list + (list "HREF" + (href-to tocentry))) + (element-title-sosofo tocentry))) + + ;; Maybe annotate... + (if (and %annotate-toc% + (equal? (gi tocentry) (normalize "refentry"))) + (make sequence + (dingbat-sosofo "nbsp"); + (dingbat-sosofo "em-dash"); + (dingbat-sosofo "nbsp"); + (toc-annotation tocentry)) + (empty-sosofo))))) + +;; lot-entry +;; 修改自 /usr/local/share/sgml/docbook/dsssl/modular/html/dbautoc.dsl +;; 在表格清单中显示: +;; 表 xx-xx. .... +;; 在插图清单中显示: +;; 图 xx-xx. .... +;; 在范例清单中显示: +;; 例 xx-xx. .... + + +(define (lot-entry tocentry) + (make element gi: "DT" + (make sequence + (if (equal? (element-label tocentry) "") + (empty-sosofo) + (make sequence + (literal (gentext-element-name tocentry)) + (literal (element-label tocentry)) + (literal (gentext-label-title-sep + (gi tocentry))))) + + ;; If the tocentry isn't in its own + ;; chunk, don't make a link... + (if (and #f (not (chunk? tocentry))) + (element-title-sosofo tocentry) + (make element gi: "A" + attributes: (list + (list "HREF" + (href-to tocentry))) + (element-title-sosofo tocentry)))))) + +;; 修改自 /usr/local/share/sgml/docbook/dsssl/modular/html/dbttlpg.dsl +;; 使每部分的开头页(称为Title Page)显示“第xx部分” + +(mode part-titlepage-recto-mode + (element title + (let ((division (ancestor-member (current-node) (division-element-list)))) + (make element gi: "H1" + attributes: (list (list "CLASS" (gi))) + (if (string=? (element-label division) "") + (empty-sosofo) + (literal "第" + (element-label division) + (gentext-element-name division) + (gentext-label-title-sep (gi division)))) + (with-mode title-mode + (process-children))))) +) + + +;; 修改自/usr/local/share/sgml/docbook/dsssl/modular/html/dbcompon.dsl +;; 使每章第一页上显示“第xx章” + +(define ($component-title$ #!optional (titlegi "H1") (subtitlegi "H2")) + (let* ((info (cond + ((equal? (gi) (normalize "article")) + (node-list-filter-by-gi (children (current-node)) + (list (normalize "artheader") + (normalize "articleinfo")))) + ((or + (equal? (gi) (normalize "appendix")) + (equal? (gi) (normalize "bibliography")) + (equal? (gi) (normalize "chapter")) + (equal? (gi) (normalize "glossary")) + (equal? (gi) (normalize "index")) + (equal? (gi) (normalize "preface")) + (equal? (gi) (normalize "reference")) + (equal? (gi) (normalize "setindex"))) + (select-elements (children (current-node)) (normalize "docinfo"))) + (else + (empty-node-list)))) + (exp-children (if (node-list-empty? info) + (empty-node-list) + (expand-children (children info) + (list (normalize "bookbiblio") + (normalize "bibliomisc") + (normalize "biblioset"))))) + (parent-titles (select-elements (children (current-node)) (normalize "title"))) + (titles (if (node-list-empty? parent-titles) + (select-elements exp-children (normalize "title")) + parent-titles)) + (parent-subttl (select-elements (children (current-node)) (normalize "subtitle"))) + (subtitles (if (node-list-empty? parent-subttl) + (select-elements exp-children (normalize "subtitle")) + parent-subttl))) + (make sequence + (make element gi: titlegi + (make sequence + (make element gi: "A" + attributes: (list (list "NAME" (element-id))) + (empty-sosofo)) + (if (and %chapter-autolabel% + (or (equal? (gi) (normalize "chapter")) + (equal? (gi) (normalize "appendix")))) + (literal "第" + (element-label (current-node)) + (gentext-element-name-space (gi)) + (gentext-label-title-sep (gi))) + (empty-sosofo)) + (if (node-list-empty? titles) + (element-title-sosofo) ;; get a default! + (with-mode title-mode + (process-node-list titles))))) + (if (node-list-empty? subtitles) + (empty-sosofo) + (with-mode subtitle-mode + (make element gi: subtitlegi + (process-node-list subtitles))))))) + +;; 修改自/usr/local/share/sgml/docbook/dsssl/modular/html/dbnavig.dsl +;; 使页眉上显示“第xx章”等等。 + +(define (nav-context-sosofo elemnode) + (let* ((component (ancestor-member elemnode + (append (book-element-list) + (division-element-list) + (component-element-list)))) + (context-text (inherited-dbhtml-value elemnode "context-text"))) + (if (and context-text (not (string=? context-text ""))) + (literal context-text) + (if (equal? (element-label component) "") + (make sequence + (element-title-sosofo component)) + (make sequence + ;; Special case. This is a bit of a hack. + ;; I need to revisit this aspect of + ;; appendixes. + (if (and (equal? (gi component) (normalize "appendix")) + (or (equal? (gi elemnode) (normalize "sect1")) + (equal? (gi elemnode) (normalize "section"))) + (equal? (gi (parent component)) (normalize "article"))) + (element-label-sosofo component) + (make sequence + (literal "第") + (element-label-sosofo component) + (literal (gentext-element-name-space (gi component))) + )) + (literal (gentext-label-title-sep (gi component))) + (element-title-sosofo component)))))) + + ]]> - - - (define (gentext-en-nav-prev prev) - (make sequence (literal "上一页"))) - (define (gentext-en-nav-next next) - (make sequence (literal "下一页"))) - (define (gentext-en-nav-up up) - (make sequence (literal "向上"))) - (define (gentext-en-nav-home home) - (make sequence (literal "首页"))) - (define (en-xref-strings) - (list (list (normalize "appendix") (if %chapter-autolabel% - "附录 %n" - "附录 %t")) - (list (normalize "article") (string-append %gentext-en-start-quote% - "%t" - %gentext-en-end-quote%)) - (list (normalize "bibliography") "%t") - (list (normalize "book") "%t") - (list (normalize "chapter") (if %chapter-autolabel% - "第 %n 章" - "%t 这章")) - (list (normalize "equation") "公式 %n") - (list (normalize "example") "例 %n") - (list (normalize "figure") "图 %n") - (list (normalize "glossary") "%t") - (list (normalize "index") "%t") - (list (normalize "listitem") "%n") - (list (normalize "part") "第 %n 部分") - (list (normalize "preface") "%t") - (list (normalize "procedure") "过程 %n, %t") - (list (normalize "reference") "参考文献 %n, %t") - (list (normalize "section") (if %section-autolabel% - "第 %n 节" - "%t 小节")) - (list (normalize "sect1") (if %section-autolabel% - "第 %n 节" - "%t 小节")) - (list (normalize "sect2") (if %section-autolabel% - "第 %n 节" - "%t 小节")) - (list (normalize "sect3") (if %section-autolabel% - "第 %n 节" - "%t 小节")) - (list (normalize "sect4") (if %section-autolabel% - "第 %n 节" - "%t 小节")) - (list (normalize "sect5") (if %section-autolabel% - "第 %n 节" - "%t 小节")) - (list (normalize "simplesect") (if %section-autolabel% - "第 %n 节" - "%t 小节")) - (list (normalize "sidebar") "提示 %t") - (list (normalize "step") "第 %n 步") - (list (normalize "table") "表 %n"))) - (define (en-element-name) - (list (list (normalize "abstract") "&Abstract;") - (list (normalize "answer") "&Answer;") - (list (normalize "appendix") "&Appendix;") - (list (normalize "article") "&Article;") - (list (normalize "bibliography") "&Bibliography;") - (list (normalize "book") "&Book;") - (list (normalize "calloutlist") "") - (list (normalize "caution") "&Caution;") - (list (normalize "chapter") "&numbercn;") - (list (normalize "copyright") "&Copyright;") - (list (normalize "dedication") "&Dedication;") - (list (normalize "edition") "&Edition;") - (list (normalize "equation") "&Equation;") - (list (normalize "example") "&Example;") - (list (normalize "figure") "&Figure;") - (list (normalize "glossary") "&Glossary;") - (list (normalize "glosssee") "&GlossSee;") - (list (normalize "glossseealso") "&GlossSeeAlso;") - (list (normalize "important") "&Important;") - (list (normalize "index") "&Index;") - (list (normalize "colophon") "&Colophon;") - (list (normalize "setindex") "&SetIndex;") - (list (normalize "isbn") "&isbn;") - (list (normalize "legalnotice") "&LegalNotice;") - (list (normalize "msgaud") "&MsgAud;") - (list (normalize "msglevel") "&MsgLevel;") - (list (normalize "msgorig") "&MsgOrig;") - (list (normalize "note") "&Note;") - (list (normalize "part") "&Part;") - (list (normalize "preface") "&Preface;") - (list (normalize "procedure") "&Procedure;") - (list (normalize "pubdate") "&Published;") - (list (normalize "question") "&Question;") - (list (normalize "refentry") "&RefEntry;") - (list (normalize "reference") "&Reference;") - (list (normalize "refname") "&RefName;") - (list (normalize "revhistory") "&RevHistory;") - (list (normalize "refsect1") "&RefSection;") - (list (normalize "refsect2") "&RefSection;") - (list (normalize "refsect3") "&RefSection;") - (list (normalize "refsynopsisdiv") "&RefSynopsisDiv;") - (list (normalize "revision") "&Revision;") - (list (normalize "sect1") "&numbercn;") - (list (normalize "sect2") "&numbercn;") - (list (normalize "sect3") "&numbercn;") - (list (normalize "sect4") "&numbercn;") - (list (normalize "sect5") "&numbercn;") - (list (normalize "section") "&numbercn;") - (list (normalize "simplesect") "&numbercn;") - (list (normalize "seeie") "&See;") - (list (normalize "seealsoie") "&Seealso;") - (list (normalize "set") "&Set;") - (list (normalize "sidebar") "&Sidebar;") - (list (normalize "step") "&step;") - (list (normalize "table") "&Table;") - (list (normalize "tip") "&Tip;") - (list (normalize "toc") "&TableofContents;") - (list (normalize "warning") "&Warning;"))) - (define (en-label-title-sep) - (list (list (normalize "abstract") ": ") - (list (normalize "answer") " ") - (list (normalize "appendix") ". ") - (list (normalize "caution") "") - (list (normalize "chapter") " &Chapter;. ") - (list (normalize "equation") ". ") - (list (normalize "example") ". ") - (list (normalize "figure") ". ") - (list (normalize "footnote") ". ") - (list (normalize "glosssee") ": ") - (list (normalize "glossseealso") ": ") - (list (normalize "important") ": ") - (list (normalize "note") ": ") - (list (normalize "orderedlist") ". ") - (list (normalize "part") ". ") - (list (normalize "procedure") ". ") - (list (normalize "prefix") ". ") - (list (normalize "question") " ") - (list (normalize "refentry") "") - (list (normalize "reference") ". ") - (list (normalize "refsect1") ". ") - (list (normalize "refsect2") ". ") - (list (normalize "refsect3") ". ") - (list (normalize "sect1") " &Section;. ") - (list (normalize "sect2") " &Section;. ") - (list (normalize "sect3") " &Section;. ") - (list (normalize "sect4") " &Section;. ") - (list (normalize "sect5") " &Section;. ") - (list (normalize "section") " &Section;. ") - (list (normalize "simplesect") " &Section;. ") - (list (normalize "seeie") " ") - (list (normalize "seealsoie") " ") - (list (normalize "step") ". ") - (list (normalize "table") ". ") - (list (normalize "tip") ": ") - (list (normalize "warning") ": "))) + + + + + + + number ;; then get the apparent level + (substring renderas 4 5)) ;; from "renderas", + (SECTLEVEL))) ;; else use the real level + (hs (HSIZE (- 4 hlevel)))) + + (make sequence + (make paragraph + font-family-name: %title-font-family% + font-weight: (if (< hlevel 5) 'bold 'medium) + font-posture: (if (< hlevel 5) 'upright 'italic) + font-size: hs + line-spacing: (* hs %line-spacing-factor%) + space-before: (* hs %head-before-factor%) + space-after: (if (node-list-empty? subtitles) + (* hs %head-after-factor%) + 0pt) + start-indent: (if (or (>= hlevel 3) + (member (gi) (list (normalize "refsynopsisdiv") + (normalize "refsect1") + (normalize "refsect2") + (normalize "refsect3")))) + %body-start-indent% + 0pt) + first-line-start-indent: 0pt + quadding: %section-title-quadding% + keep-with-next?: #t + heading-level: (if %generate-heading-level% (+ hlevel 1) 0) + ;; SimpleSects are never AUTO numbered...they aren't hierarchical + (if (> hlevel (- max-section-level-labels 1)) + (empty-sosofo) + (if (string=? (element-label (current-node)) "") + (empty-sosofo) + (literal (element-label (current-node)) + (gentext-label-title-sep (gi sect))))) + (element-title-sosofo (current-node))) + (with-mode section-title-mode + (process-node-list subtitles)) + ($section-info$ info)))) + + ]]> + + + + (define (local-zhcn-label-title-sep) + (list + (list (normalize "warning") ": ") + (list (normalize "caution") ": ") + (list (normalize "chapter") " ") + (list (normalize "sect1") " ") + (list (normalize "sect2") " ") + (list (normalize "sect3") " ") + (list (normalize "sect4") " ") + (list (normalize "sect5") " ") + )) + + + + (define %default-language% "zh_cn") + + +