deplate 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. data/AUTHORS.TXT +26 -0
  2. data/CHANGES.TXT +177 -0
  3. data/LICENSE.TXT +340 -0
  4. data/NEWS.TXT +29 -0
  5. data/README.TXT +86 -0
  6. data/TODO.TXT +202 -0
  7. data/VERSION.TXT +1 -0
  8. data/bin/deplate +3 -0
  9. data/bin/deplate.bat +2 -0
  10. data/etc/deplate.ini +361 -0
  11. data/lib/deplate.rb +31 -0
  12. data/lib/deplate/abstract-class.rb +30 -0
  13. data/lib/deplate/builtin.rb +11 -0
  14. data/lib/deplate/cache.rb +59 -0
  15. data/lib/deplate/commands.rb +693 -0
  16. data/lib/deplate/common.rb +335 -0
  17. data/lib/deplate/converter.rb +99 -0
  18. data/lib/deplate/core.rb +2705 -0
  19. data/lib/deplate/css/article.css +545 -0
  20. data/lib/deplate/css/deplate.css +699 -0
  21. data/lib/deplate/css/heading-navbar.css +29 -0
  22. data/lib/deplate/css/layout-deplate-print.css +540 -0
  23. data/lib/deplate/css/layout-deplate.css +764 -0
  24. data/lib/deplate/css/sans-serif.css +160 -0
  25. data/lib/deplate/css/serif-e.css +170 -0
  26. data/lib/deplate/css/serif-rel.css +121 -0
  27. data/lib/deplate/css/serif.css +190 -0
  28. data/lib/deplate/css/slides.css +11 -0
  29. data/lib/deplate/css/tabbar-left.css +91 -0
  30. data/lib/deplate/css/tabbar-right-ie.css +14 -0
  31. data/lib/deplate/css/tabbar-right.css +118 -0
  32. data/lib/deplate/css/tabbar-top.css +64 -0
  33. data/lib/deplate/css/tabbar.css +81 -0
  34. data/lib/deplate/css/text-sans-serif.css +154 -0
  35. data/lib/deplate/css/text-serif.css +175 -0
  36. data/lib/deplate/define.rb +439 -0
  37. data/lib/deplate/docbook.rb +738 -0
  38. data/lib/deplate/elements.rb +1355 -0
  39. data/lib/deplate/etc.rb +199 -0
  40. data/lib/deplate/external.rb +135 -0
  41. data/lib/deplate/fmt/dbk-article-4.1.2.rb +21 -0
  42. data/lib/deplate/fmt/dbk-article.rb +46 -0
  43. data/lib/deplate/fmt/dbk-book.rb +46 -0
  44. data/lib/deplate/fmt/dbk-ref.rb +105 -0
  45. data/lib/deplate/fmt/dbk-slides.rb +47 -0
  46. data/lib/deplate/fmt/dbk-snippet.rb +21 -0
  47. data/lib/deplate/fmt/html-snippet.rb +21 -0
  48. data/lib/deplate/fmt/html.rb +1696 -0
  49. data/lib/deplate/fmt/htmlsite.rb +419 -0
  50. data/lib/deplate/fmt/htmlslides.rb +21 -0
  51. data/lib/deplate/fmt/htmlwebsite.rb +70 -0
  52. data/lib/deplate/fmt/latex-snippet.rb +22 -0
  53. data/lib/deplate/fmt/latex.rb +1242 -0
  54. data/lib/deplate/fmt/php.rb +19 -0
  55. data/lib/deplate/fmt/phpsite.rb +19 -0
  56. data/lib/deplate/fmt/plain.rb +598 -0
  57. data/lib/deplate/fmt/template.rb +34 -0
  58. data/lib/deplate/fmt/xhtml10t.rb +41 -0
  59. data/lib/deplate/formatter-snippet.rb +17 -0
  60. data/lib/deplate/formatter.rb +1210 -0
  61. data/lib/deplate/input.rb +492 -0
  62. data/lib/deplate/input/deplate-headings.rb +48 -0
  63. data/lib/deplate/input/deplate-restricted.rb +70 -0
  64. data/lib/deplate/input/deplate.rb +28 -0
  65. data/lib/deplate/input/rdoc.rb +277 -0
  66. data/lib/deplate/input/template.rb +29 -0
  67. data/lib/deplate/lib/latex/highlight-extra.sty +15 -0
  68. data/lib/deplate/lib/latex/highlight-typical.sty +15 -0
  69. data/lib/deplate/lib/tabmenu.js +146 -0
  70. data/lib/deplate/locale/de.latin1 +708 -0
  71. data/lib/deplate/locale/ru.koi8-r +48 -0
  72. data/lib/deplate/locale/zh_cn.gb2312 +35 -0
  73. data/lib/deplate/macros.rb +639 -0
  74. data/lib/deplate/messages.rb +120 -0
  75. data/lib/deplate/metadata.rb +77 -0
  76. data/lib/deplate/metadata/marshal.rb +24 -0
  77. data/lib/deplate/metadata/xml.rb +42 -0
  78. data/lib/deplate/metadata/yaml.rb +26 -0
  79. data/lib/deplate/mod/anyword.rb +56 -0
  80. data/lib/deplate/mod/babelfish.rb +27 -0
  81. data/lib/deplate/mod/code-gvim.rb +52 -0
  82. data/lib/deplate/mod/code-highlight.rb +91 -0
  83. data/lib/deplate/mod/colored-log.rb +17 -0
  84. data/lib/deplate/mod/de.rb +19 -0
  85. data/lib/deplate/mod/en.rb +17 -0
  86. data/lib/deplate/mod/endnotes.rb +60 -0
  87. data/lib/deplate/mod/fr.rb +46 -0
  88. data/lib/deplate/mod/html-asciimath.rb +40 -0
  89. data/lib/deplate/mod/html-deplate-button.rb +15 -0
  90. data/lib/deplate/mod/html-headings-navbar.rb +39 -0
  91. data/lib/deplate/mod/html-obfuscate-email.rb +47 -0
  92. data/lib/deplate/mod/html-sidebar.rb +232 -0
  93. data/lib/deplate/mod/htmlslides-navbar-fh.rb +32 -0
  94. data/lib/deplate/mod/iconv.rb +35 -0
  95. data/lib/deplate/mod/imgurl.rb +30 -0
  96. data/lib/deplate/mod/inlatex-compound.rb +69 -0
  97. data/lib/deplate/mod/koma.rb +109 -0
  98. data/lib/deplate/mod/latex-emph-table-head.rb +38 -0
  99. data/lib/deplate/mod/latex-styles.rb +461 -0
  100. data/lib/deplate/mod/latex-verbatim-small.rb +29 -0
  101. data/lib/deplate/mod/makefile.rb +194 -0
  102. data/lib/deplate/mod/mark-external-urls.rb +38 -0
  103. data/lib/deplate/mod/markup-1-warn.rb +37 -0
  104. data/lib/deplate/mod/markup-1.rb +41 -0
  105. data/lib/deplate/mod/navbar-png.rb +33 -0
  106. data/lib/deplate/mod/noindent.rb +32 -0
  107. data/lib/deplate/mod/numpara.rb +40 -0
  108. data/lib/deplate/mod/particle-math.rb +34 -0
  109. data/lib/deplate/mod/php-extra.rb +44 -0
  110. data/lib/deplate/mod/pstoedit.rb +71 -0
  111. data/lib/deplate/mod/recode.rb +57 -0
  112. data/lib/deplate/mod/ru_koi8-r.rb +20 -0
  113. data/lib/deplate/mod/smiley.rb +50 -0
  114. data/lib/deplate/mod/soffice.rb +23 -0
  115. data/lib/deplate/mod/symbols-latin1.rb +58 -0
  116. data/lib/deplate/mod/symbols-od-utf-8.rb +16 -0
  117. data/lib/deplate/mod/symbols-plain.rb +58 -0
  118. data/lib/deplate/mod/symbols-sgml.rb +97 -0
  119. data/lib/deplate/mod/symbols-utf-8.rb +81 -0
  120. data/lib/deplate/mod/symbols-xml.rb +34 -0
  121. data/lib/deplate/mod/syntax-region-alt.rb +37 -0
  122. data/lib/deplate/mod/utf8.rb +49 -0
  123. data/lib/deplate/mod/validate-html.rb +35 -0
  124. data/lib/deplate/mod/xmlrpc.rb +233 -0
  125. data/lib/deplate/mod/zh-cn-autospace.rb +108 -0
  126. data/lib/deplate/mod/zh-cn.rb +59 -0
  127. data/lib/deplate/once-method.rb +44 -0
  128. data/lib/deplate/output.rb +249 -0
  129. data/lib/deplate/particles.rb +815 -0
  130. data/lib/deplate/regions.rb +1076 -0
  131. data/lib/deplate/structured.rb +763 -0
  132. data/lib/deplate/template.rb +430 -0
  133. data/lib/deplate/templates/html-doc.html +28 -0
  134. data/lib/deplate/templates/html-left-tabbar-js.html +37 -0
  135. data/lib/deplate/templates/html-left-tabbar.html +31 -0
  136. data/lib/deplate/templates/html-tabbar-right-table.html +43 -0
  137. data/lib/deplate/templates/html-tabbar-right.html +23 -0
  138. data/lib/deplate/templates/html-tabbar-top.html +43 -0
  139. data/lib/deplate/templates/html-tabbar.html +31 -0
  140. data/lib/deplate/wiki-markup.rb +117 -0
  141. data/lib/deplate/xml.rb +109 -0
  142. data/lib/deplate/zh-cn.rb +59 -0
  143. data/lib/ps2ppm.rb +239 -0
  144. data/man/man1/deplate.1 +692 -0
  145. metadata +210 -0
@@ -0,0 +1,37 @@
1
+ #Mingle type=pre slot=css:
2
+ <!--[if IE]>
3
+ <style type="text/css">
4
+ @media screen {
5
+ table.tabBarLeft {
6
+ border-collapse: collapse;
7
+ }
8
+ }
9
+ </style>
10
+ <![endif]-->
11
+ #End
12
+ #Mingle type=pre slot=javascript:
13
+ <script src="tabmenu.js" type="text/javascript"></script>
14
+ #End
15
+ #PREMATTER
16
+
17
+ <div id="tabFrame">
18
+ <div id="tabFrameRow1">
19
+ <div id="tabBodyFrame">
20
+ <div class="tabBody">
21
+ <img width="700px" height="1px" src="spacer.png" alt="" />
22
+ #BODY: -navbar_top -navbar_bottom
23
+ </div>
24
+ #POSTMATTER: html_pageicons_beg..html_pageicons_end
25
+ </div>
26
+ <div id="tabBar" class="tabBar">
27
+ <div id="pin">
28
+ <a href="javascript:ToggleSticky()" title="Toggle Sticky">
29
+ <img id="pinImg" border=0 src="pin-up.png" alt="Pin" />
30
+ </a>
31
+ </div>
32
+ #ARG: tabBarLeft(progressBar! nextKey! spacer=spacer.png depth=2 depthInactive=1)
33
+ </div>
34
+ </div>
35
+ </div>
36
+
37
+ #POSTMATTER
@@ -0,0 +1,31 @@
1
+ #Mingle type=pre slot=css:
2
+ <!--[if IE]>
3
+ <style type="text/css">
4
+ @media screen {
5
+ table.tabBarLeft {
6
+ border-collapse: collapse;
7
+ }
8
+ }
9
+ </style>
10
+ <![endif]-->
11
+ #End
12
+ #PREMATTER
13
+
14
+ <div id="tabFrame">
15
+ <div class="tabFrameRow">
16
+ <div id="tabBar" class="tabBar">
17
+ #ARG: tabBarLeft(progressBar! nextKey! spacer=spacer.png depth=2 depthInactive=1)
18
+ </div>
19
+ <div id="tabBodyFrame">
20
+ <div class="tabBody">
21
+ <img width="700px" height="1px" src="spacer.png" alt="" />
22
+ #BODY: -navbar_top -navbar_bottom
23
+ </div>
24
+ </div>
25
+ </div>
26
+ <div class="tabFrameRow">
27
+ #POSTMATTER: html_pageicons_beg..html_pageicons_end
28
+ </div>
29
+ </div>
30
+
31
+ #POSTMATTER
@@ -0,0 +1,43 @@
1
+ #Mingle type=pre slot=css:
2
+ <style type="text/css">
3
+ <!--
4
+ div.tableNote {
5
+ text-align: left;
6
+ }
7
+ -->
8
+ </style>
9
+ <!--[if IE]>
10
+ <style type="text/css">
11
+ @media screen {
12
+ table.tabBarRight {
13
+ border-collapse: collapse;
14
+ }
15
+ #tabBar {
16
+ position: static;
17
+ }
18
+ }
19
+ </style>
20
+ <![endif]-->
21
+ #End
22
+ #PREMATTER
23
+
24
+ <table id="tabFrame">
25
+ <tr class="tabFrameRow">
26
+ <td id="tabBodyFrame">
27
+ <div id="tabBody">
28
+ <img width="700px" height="1px" src="spacer.png" alt="" />
29
+ #BODY: -navbar_top -navbar_bottom
30
+ </div>
31
+ </td>
32
+ <td id="tabBar">
33
+ #ARG: tabBarRight(progressBar! nextKey! spacer=spacer.png depth=2 depthInactive=1)
34
+ </td>
35
+ </tr>
36
+ <tr class="tabFrameRow">
37
+ <td class="tabFrameCell">
38
+ #POSTMATTER: html_pageicons_beg..html_pageicons_end
39
+ </td>
40
+ </tr>
41
+ </table>
42
+
43
+ #POSTMATTER
@@ -0,0 +1,23 @@
1
+ #Mingle type=pre slot=css:
2
+ <!--[if IE]>
3
+ <style type="text/css">
4
+ <link rel="stylesheet" type="text/css" href="tabbar-right-ie.css" media="screen">
5
+ </style>
6
+ <![endif]-->
7
+ #End
8
+ #PREMATTER
9
+
10
+ <div id="tabFrame">
11
+ <div id="tabBodyFrame">
12
+ <div id="tabBody">
13
+ <img width="600px" height="1px" src="spacer.png" alt="" />
14
+ #BODY: -navbar_top -navbar_bottom
15
+ </div>
16
+ #POSTMATTER: html_pageicons_beg..html_pageicons_end
17
+ </div>
18
+ <div id="tabBar">
19
+ #ARG: tabBarRight(progressBar! nextKey! spacer=spacer.png depth=2 depthInactive=1)
20
+ </div>
21
+ </div>
22
+
23
+ #POSTMATTER
@@ -0,0 +1,43 @@
1
+ #Mingle type=pre slot=css:
2
+ <style type="text/css">
3
+ <!--
4
+ @media screen {
5
+ body {
6
+ background-color: #e9e9ff;
7
+ }
8
+ }
9
+ -->
10
+ </style>
11
+ <!--[if IE]>
12
+ <style type="text/css">
13
+ @media screen {
14
+ table.tabBarTop {
15
+ border-collapse: collapse;
16
+ }
17
+ }
18
+ </style>
19
+ <![endif]-->
20
+ #End
21
+
22
+ #PREMATTER
23
+
24
+ <div id="tabFrame">
25
+ <div id="tabBodyFrame" class="tabBodyFrame">
26
+ <div id="tabBar" class="tabBar">
27
+ #IF: tabBarPos==top
28
+ #ARG: tabBarTop()
29
+ #ELSEIF: tabBarPos==right
30
+ #ARG: tabBarRight(progressBar! nextKey! depth=2 depthInactive=1)
31
+ #ELSE
32
+ #ARG: tabBarLeft(progressBar! nextKey! depth=2 depthInactive=1)
33
+ #ENDIF
34
+ </div>
35
+ <div id="tabBody" class="tabBody">
36
+ #BODY
37
+ </div>
38
+ #POSTMATTER: html_pageicons_beg..html_pageicons_end
39
+ </div>
40
+ </div>
41
+
42
+ #POSTMATTER
43
+
@@ -0,0 +1,31 @@
1
+ #Mingle type=pre slot=css:
2
+ <style type="text/css">
3
+ <!--
4
+ @media screen {
5
+ body {
6
+ background-color: #e9e9ff;
7
+ }
8
+ }
9
+ -->
10
+ </style>
11
+ #End
12
+ #PREMATTER
13
+
14
+ <div id="tabBar" class="tabBar">
15
+ #IF: tabBarPos==top
16
+ #ARG: tabBarTop()
17
+ #ELSEIF: tabBarPos==right
18
+ #ARG: tabBarRight(progressBar! nextKey! depth=2 depthInactive=1)
19
+ #ELSE
20
+ #ARG: tabBarLeft(progressBar! nextKey! depth=2 depthInactive=1)
21
+ #ENDIF
22
+ </div>
23
+ <div id="tabBodyFrame" class="tabBodyFrame">
24
+ <div id="tabBody" class="tabBody">
25
+ #BODY: -navbar_top -navbar_bottom
26
+ </div>
27
+ #POSTMATTER: html_pageicons_beg..html_pageicons_end
28
+ </div>
29
+
30
+ #POSTMATTER
31
+
@@ -0,0 +1,117 @@
1
+ # wiki-markup.rb
2
+ # @Author: Thomas Link (samul AT web.de)
3
+ # @Website: http://deplate.sf.net/
4
+ # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
+ # @Created: 10-M�r-2005.
6
+ # @Last Change: 23-Okt-2005.
7
+ # @Revision: 0.221
8
+ #
9
+ # = Description
10
+ # Various elements for defining input filters
11
+ # = Usage
12
+ # = TODO
13
+ # = CHANGES
14
+
15
+ module Deplate::Input::Wiki; end
16
+
17
+ class Deplate::Input::Wiki::ItalicWordSingleUnderscore < Deplate::Particle::Emphasize
18
+ @rx = /^\b_(\S+?)_\b/
19
+ end
20
+
21
+ class Deplate::Input::Wiki::BoldWordSingleAsterisk < Deplate::Particle::Emphasize
22
+ @rx = /^\B\*(\S+?)\*\B/
23
+ end
24
+
25
+ class Deplate::Input::Wiki::TypewriterWordSinglePlus < Deplate::Particle::Code
26
+ @rx = /^\B\+(\S+?)\+\B/
27
+ end
28
+
29
+ # Treat a reference to an image as included images. Requires subclassing and a
30
+ # definition of @rx.
31
+ class Deplate::Input::Wiki::AbstractImgUrl < Deplate::HyperLink::Url
32
+ def get_destination
33
+ @match[1]
34
+ end
35
+
36
+ def get_anchor
37
+ nil
38
+ end
39
+
40
+ def process
41
+ @elt = @deplate.formatter.include_image(@dest, @args, true)
42
+ end
43
+ end
44
+
45
+ # Treat non-indented text as paragraph, indented as verbatim.
46
+ class Deplate::Input::Wiki::ParagraphIndentedVerbatim < Deplate::Element::Paragraph
47
+ @rx = /^([ \t]*)(.+)[ \t]*$/
48
+ def get_text
49
+ @leading_whitespace = @match[1]
50
+ @keep_whitespace = !@leading_whitespace.empty?
51
+ @match[2]
52
+ end
53
+
54
+ def to_be_continued?(line)
55
+ indent = get_indent(line).size
56
+ return @level > 0 || indent == 0
57
+ end
58
+
59
+ def format_special
60
+ if @level == 0
61
+ format_as_paragraph
62
+ else
63
+ @elt = @leading_whitespace + @accum.join("\n")
64
+ format_as_verbatim
65
+ end
66
+ end
67
+
68
+ def format_as_paragraph
69
+ format_element(:format_paragraph, self)
70
+ end
71
+
72
+ def format_as_verbatim
73
+ margin = @args["wrap"]
74
+ if margin
75
+ @elt = @deplate.formatter.wrap_text(@elt, :margin => margin.to_i)
76
+ end
77
+ format_element(:format_verbatim, self)
78
+ end
79
+ end
80
+
81
+ module Deplate::Input::Wiki::ListExtra
82
+ def continuation_level_ok?(otherLevel, thisLevel, thisMaxLevel)
83
+ return (otherLevel > 0 and otherLevel >= thisLevel and otherLevel <= thisMaxLevel)
84
+ end
85
+ end
86
+
87
+ class Deplate::Input::Wiki::NumberedNotIndented < Deplate::List::Numbered
88
+ include Deplate::Input::Wiki::ListExtra
89
+ @formatter = :format_list
90
+ @name = "Numbered"
91
+ @rx = /^(()([0-9]+\.|[a-zA-Z]\.)[ \t]+)(.+)$/
92
+ end
93
+
94
+ class Deplate::Input::Wiki::ItemizeNotIndented < Deplate::List::Itemize
95
+ include Deplate::Input::Wiki::ListExtra
96
+ @formatter = :format_list
97
+ @name = "Itemize"
98
+ @rx = /^(()([-*])[ \t]+)(.+)$/
99
+ end
100
+
101
+ # Requires subclassing & definition of @rx.
102
+ class Deplate::Input::Wiki::AbstractDescription < Deplate::List::Description
103
+ include Deplate::Input::Wiki::ListExtra
104
+ @formatter = :format_list
105
+ @name = "Description"
106
+ end
107
+
108
+ class Deplate::Input::Wiki::HeadingPrefixEqual < Deplate::Element::Heading
109
+ @formatter = :format_heading
110
+ @rx = /^(=+)[ \t]+(.*?)$/
111
+ end
112
+
113
+ class Deplate::Input::Wiki::Break3Hyphens < Deplate::Element::Break
114
+ @formatter = :format_break
115
+ @rx = /^\s*-{3,}\s*$/
116
+ end
117
+
@@ -0,0 +1,109 @@
1
+ # xml.rb
2
+ # @Author: Thomas Link (samul AT web.de)
3
+ # @Website: http://deplate.sf.net/
4
+ # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
+ # @Created: 17-M�r-2004.
6
+ # @Last Change: 01-Nov-2005.
7
+ # @Revision: 0.2294
8
+ #
9
+ # TODO:
10
+ # -
11
+
12
+ # An abstract xml formatter
13
+
14
+ require "deplate/structured"
15
+
16
+ class Deplate::Formatter::XML < Deplate::Formatter::Structured
17
+ self.suffix = ".xml"
18
+
19
+ def initialize(deplate, args)
20
+ @consumed_ids = []
21
+ deplate.options.indentation_level = [0]
22
+ super
23
+ @special_symbols = {
24
+ "\"" => Proc.new {|e| symbol_quote(nil)},
25
+ "&" => Proc.new {|e| symbol_amp(nil)},
26
+ "�" => Proc.new {|e| symbol_paragraph(nil)},
27
+ "<" => Proc.new {|e| symbol_lt(nil)},
28
+ ">" => Proc.new {|e| symbol_gt(nil)},
29
+ " " => Proc.new {|e| e ? nonbreakingspace(nil) : " "},
30
+ }
31
+ build_plain_text_rx
32
+ @encodings = {
33
+ 'latin1' => 'ISO-8859-1',
34
+ 'latin9' => 'ISO-8859-15',
35
+ }
36
+ end
37
+
38
+ def pre_process
39
+ @encoding = canonic_enc_name(@deplate.variables["encoding"] || "utf-8")
40
+ if @deplate.options.symbols_encoding
41
+ symbols = @deplate.options.symbols_encoding
42
+ elsif @deplate.variables["sgml"]
43
+ symbols = :sgml
44
+ require "deplate/mod/symbols-sgml" unless @deplate.symbols[symbols]
45
+ @sgml = true
46
+ else
47
+ case @encoding
48
+ when "ISO-8859-1", "ISO-8859-15"
49
+ symbols = "ISO-8859-1"
50
+ require "deplate/mod/symbols-latin1" unless @deplate.symbols[symbols]
51
+ else
52
+ symbols = :xml
53
+ require "deplate/mod/symbols-xml" unless @deplate.symbols[symbols]
54
+ end
55
+ end
56
+ if @sgml
57
+ require "deplate/mod/noindent"
58
+ Deplate::NoIndent.setup(self)
59
+ end
60
+ @deplate.initialize_symbols
61
+ mod = @deplate.symbols[symbols]
62
+ if mod
63
+ self.extend(mod)
64
+ else
65
+ raise "Unknown symbols encoding: %s (%s)" % [symbols, @deplate.symbols.keys.join(", ")]
66
+ end
67
+ @deplate.variables["refButton"] ||= "[%s]" % format_symbol(nil, "->")
68
+ end
69
+
70
+ def prepare
71
+ creator = ["===================================================",
72
+ "== Created with deplate (http://deplate.sf.net) ==",
73
+ "==================================================="]
74
+ output_at(:pre, :doc_def, get_doc_def({:deplate => @deplate}))
75
+ output_at(:pre, :doc_def, get_comment(creator))
76
+ output_at(:pre, :doc_beg, get_doc_open({}))
77
+ output_at(:pre, :head_beg, get_doc_head_open({}))
78
+ output_at(:pre, :head, indent_text(get_doc_head({})))
79
+ output_at(:pre, :head_end, get_doc_head_close({}))
80
+ output_at(:pre, :body_beg, get_doc_body_open({}))
81
+
82
+ @deplate.postponed_print << Proc.new do
83
+ output_at(:post, :body_end, close_headings(0))
84
+ output_at(:post, :body_end, get_doc_body_close({}))
85
+ output_at(:post, :doc_end, get_doc_close({}))
86
+ end
87
+ end
88
+
89
+ def plain_text(text, escaped=false, vapor_space=true)
90
+ super(text, escaped) do |accum|
91
+ if vapor_space
92
+ accum.join.gsub(/ {2,}/, " ")
93
+ else
94
+ accum.join
95
+ end
96
+ end
97
+ end
98
+
99
+ def encode_id(text)
100
+ text ? text.gsub(/\W/, "00") : ""
101
+ end
102
+
103
+ def get_comment(strings)
104
+ strings.collect {|l| %{<!-- %s -->} % l}.join("\n")
105
+ end
106
+
107
+ end
108
+
109
+ # vim: ff=unix
@@ -0,0 +1,59 @@
1
+ # zh-cn.rb -- Simplified Chinese messages
2
+ # @Author: Thomas Link; localization by Jjgod Jiang (gzjjgod@21cn.com)
3
+ # @Website: http://deplate.sf.net/
4
+ # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
+ # @Created: 01-Aug-2004.
6
+ # @Last Change: 23-Okt-2005.
7
+ # @Revision: 0.207
8
+
9
+ require 'deplate/messages'
10
+
11
+ class Deplate::Formatter
12
+ attr_reader :cjk_smart_blanks
13
+
14
+ def hook_pre_setup_zh_cn
15
+ # @deplate.variables["encoding"] = "gb2312"
16
+ @cjk_smart_blanks = !(@deplate.variables["noSmartBlanks"] || false)
17
+ end
18
+ end
19
+
20
+ class Deplate::Formatter::LaTeX
21
+ def prepare_zh_cn
22
+ family = @deplate.variables["cjk_family"] || "gbsn"
23
+ encoding = @deplate.variables["cjk_encoding"] || "GB"
24
+ union_at(:pre, :mod_packages, "\\usepackage{CJK}")
25
+ union_at(:pre, :mod_packages, "\\usepackage{CJKnumb}")
26
+ union_at(:pre, :mod_packages, "\\usepackage{indentfirst}")
27
+ output_at(:pre, :body_beg, "\\begin{CJK*}{#{encoding}}{#{family}}",
28
+ "\\CJKtilde{}", "\\CJKcaption{GB}", "\\CJKindent{}")
29
+ output_at(:post, :prepend_body_end, "\\end{CJK*}")
30
+ end
31
+
32
+ def set_document_encoding
33
+ end
34
+ end
35
+
36
+ class Deplate::Formatter
37
+ def multibyte_leader?(ch)
38
+ ch && ch >= 0xA1 && ch <= 0xFE
39
+ end
40
+
41
+ alias :get_first_char_re_zh_cn :get_first_char
42
+
43
+ def get_first_char(string, upcase=false)
44
+ if multibyte_leader?(string[0])
45
+ string[0..1]
46
+ else
47
+ get_first_char_re_zh_cn(string, upcase)
48
+ end
49
+ end
50
+ end
51
+
52
+ class Deplate::Messages::ZhCnGb2312 < Deplate::Messages
53
+ setup 'zh-cn'
54
+ def_prop 'lang', 'zh-cn'
55
+ def_prop 'encoding', 'gb2312'
56
+ def_prop 'latex_encoding', nil
57
+ load_catalog 'zh_cn.gb2312'
58
+ end
59
+