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,29 @@
1
+ # latex-verbatim-small.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: 20-Nov-2004.
6
+ # @Last Change: 23-Okt-2005.
7
+ # @Revision: 0.27
8
+ #
9
+ # Description:
10
+ #
11
+ # Usage:
12
+ #
13
+ # TODO:
14
+ #
15
+ # CHANGES:
16
+ #
17
+
18
+ class Deplate::Formatter::LaTeX
19
+ def formatter_initialize_latex_verbatim_small
20
+ def_advice("latex-verbatim-small", :format_verbatim,
21
+ :wrap => Proc.new do |agent, rv, *rest|
22
+ join_blocks(["{\\" + (@variables["verbSize"] || "footnotesize{}"),
23
+ rv,
24
+ "}"])
25
+ end
26
+ )
27
+ end
28
+ end
29
+
@@ -0,0 +1,194 @@
1
+ # makefile.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: 28-Aug-2005.
6
+ # @Last Change: 31-Okt-2005.
7
+ # @Revision: 0.143
8
+ #
9
+ # = Description
10
+ # Create a standard makefile.
11
+
12
+ # require ''
13
+
14
+ class Deplate::Core
15
+ def deplate_initialize_makefile
16
+ options = @@command_line_args
17
+ for f in @options.files.reverse
18
+ if options.last == f
19
+ options.pop
20
+ else
21
+ log(['Internal error', 'Makefile', @@command_line_args], :error)
22
+ options = []
23
+ break
24
+ end
25
+ end
26
+ unless options.empty?
27
+ options.each_with_index do |e,i|
28
+ if e == 'makefile'
29
+ o = options[i - 1]
30
+ if o == '-m' or o == '--module'
31
+ options.slice!(i-1 .. i)
32
+ break
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ base, *files = @options.files
39
+ base0 = File.basename(base, '.*')
40
+ suffix = File.extname(base)
41
+
42
+ if @variables['genericViewer']
43
+ genericViewer = @variables['genericViewer']
44
+ elsif ENV['genericViewer']
45
+ genericViewer = ENV['genericViewer']
46
+ elsif ENV['GNOME_DESKTOP_SESSION_ID']
47
+ genericViewer = 'gnome-open'
48
+ elsif ENV['KDEDIR']
49
+ genericViewer = 'kfmclient'
50
+ elsif ENV['CYGWIN'] || ENV['CYGWIN_PATH']
51
+ genericViewer = 'cygstart'
52
+ else
53
+ genericViewer = 'echo Not supported: genericViewer '
54
+ end
55
+
56
+ config = <<MAKEFILE
57
+ BASE=#{base0}
58
+ FILE=#{base}
59
+ OTHER=#{files.join(' ') if files}
60
+
61
+ DEPLATE=deplate
62
+
63
+ DFLAGS=#{options.join(' ')}
64
+
65
+ HTML_DIR=html
66
+ HTML_DFLAGS=-d ${HTML_DIR} -f html
67
+
68
+ WEBSITE_DIR=website
69
+ WEBSITE_DFLAGS=-d ${WEBSITE_DIR} -f htmlsite
70
+
71
+ PHP_DIR=php
72
+ PHP_DFLAGS=-d ${PHP_DIR} -f phpsite
73
+
74
+ TEX_DIR=tex
75
+ TEX_DFLAGS=-d ${TEX_DIR} -f latex
76
+
77
+ TEXT_DIR=plain
78
+ TEXT_DFLAGS=-d ${TEXT_DIR} -f plain
79
+
80
+ DBK_DIR=docbook
81
+ DBK_DFLAGS=-d ${DBK_DIR} -f dbk-article
82
+
83
+ REF_DIR=${DBK_DIR}
84
+ REF_DFLAGS=-d ${REF_DIR} -f dbk-ref
85
+
86
+ MAKEFILE
87
+
88
+ makefile = <<MAKEFILE
89
+ include Makefile.config
90
+
91
+ PHONY: html
92
+
93
+ all: dbk html pdf tex text man
94
+
95
+ dvi: ${BASE}.dvi
96
+ dbk: ${BASE}.dbk
97
+ html: ${BASE}.html
98
+ pdf:
99
+ make DFLAGS="${DFLAGS} --pdf" ${BASE}.pdf
100
+ php: ${BASE}.php
101
+ tex: ${BASE}.tex
102
+ text: ${BASE}.text
103
+ man: ${BASE}.1
104
+
105
+ pdfclean: pdf cleantex
106
+ dviclean: dvi cleantex
107
+
108
+ makefile:
109
+ ${DEPLATE} -m makefile ${DFLAGS} ${BASE}#{suffix} ${OTHER}
110
+
111
+ website:
112
+ mkdir -p ${WEBSITE_DIR}
113
+ ${DEPLATE} ${DFLAGS} ${WEBSITE_DFLAGS} ${FILE} ${OTHER}
114
+ echo ${website_dir}/${BASE}.html > .last_output
115
+
116
+ %.html: %#{suffix}
117
+ mkdir -p ${HTML_DIR}
118
+ ${DEPLATE} ${DFLAGS} ${HTML_DFLAGS} $< ${OTHER}
119
+ echo ${HTML_DIR}/$@ > .last_output
120
+
121
+ %.text: %#{suffix}
122
+ mkdir -p ${TEXT_DIR}
123
+ ${DEPLATE} ${DFLAGS} ${TEXT_DFLAGS} $< ${OTHER}
124
+ echo ${TEXT_DIR}/$@ > .last_output
125
+
126
+ %.php: %#{suffix}
127
+ mkdir -p ${PHP_DIR}
128
+ ${DEPLATE} ${DFLAGS} ${PHP_DFLAGS} $< ${OTHER}
129
+ echo ${PHP_DIR}/$@ > .last_output
130
+
131
+ %.dbk: %#{suffix}
132
+ mkdir -p ${DBK_DIR}
133
+ ${DEPLATE} ${DFLAGS} ${DBK_DFLAGS} $< ${OTHER}
134
+ echo ${DBK_DIR}/$@ > .last_output
135
+
136
+ %.tex: %#{suffix}
137
+ mkdir -p ${TEX_DIR}
138
+ ${DEPLATE} ${DFLAGS} ${TEX_DFLAGS} $< ${OTHER}
139
+ echo ${TEX_DIR}/$@ > .last_output
140
+
141
+ %.ref: %#{suffix}
142
+ mkdir -p ${REF_DIR}
143
+ ${DEPLATE} ${DFLAGS} ${REF_DFLAGS} -o $@ $< ${OTHER}
144
+ echo ${REF_DIR}/$@ > .last_output
145
+
146
+ %.dvi: %.tex
147
+ cd ${TEX_DIR}; \\
148
+ latex $<; \\
149
+ bibtex $*; \\
150
+ latex $<; \\
151
+ latex $<; \\
152
+ echo ${TEX_DIR}/$@ > .last_output
153
+
154
+ %.pdf: %.tex
155
+ cd ${TEX_DIR}; \\
156
+ pdflatex $<; \\
157
+ bibtex $*; \\
158
+ pdflatex $<; \\
159
+ pdflatex $<
160
+ echo ${TEX_DIR}/$@ > .last_output
161
+
162
+ %.1: %.ref
163
+ cd ${REF_DIR}; \\
164
+ xmlto man $<
165
+ echo ${REF_DIR}/$@ > .last_output
166
+
167
+ view: show
168
+ show:
169
+ #{genericViewer} `cat .last_output`
170
+
171
+ cleantex:
172
+ cd ${TEX_DIR}; \\
173
+ rm -f *.toc *.aux *.log *.cp *.fn *.tp *.vr *.pg *.ky \\
174
+ *.blg *.bbl *.out *.lot *.ind *.4tc *.4ct \\
175
+ *.ilg *.idx *.idv *.lg *.xref || echo Nothing to be done!
176
+
177
+ MAKEFILE
178
+
179
+ log('Writing Makefile', :anyway)
180
+ File.open(File.join(@options.dir, 'Makefile'), 'w') do |io|
181
+ io.puts makefile
182
+ end
183
+ if File.exist?('Makefile.config')
184
+ log('Makefile.config already exists', :anyway)
185
+ else
186
+ log('Writing Makefile.config', :anyway)
187
+ File.open(File.join(@options.dir, 'Makefile.config'), 'w') do |io|
188
+ io.puts config
189
+ end
190
+ end
191
+ exit 0
192
+ end
193
+ end
194
+
@@ -0,0 +1,38 @@
1
+ # mark-urls.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: 16-Nov-2004.
6
+ # @Last Change: 01-Nov-2005.
7
+ # @Revision: 0.36
8
+ #
9
+ # Description:
10
+ #
11
+ # Usage:
12
+ #
13
+ # TODO:
14
+ #
15
+ # CHANGES:
16
+ #
17
+
18
+ class Deplate::Formatter
19
+ def formatter_initialize_mark_urls
20
+ def_advice("mark-external-urls", :format_url,
21
+ :wrap => Proc.new do |agent, rv, invoker, name, dest, *args|
22
+ if dest =~ Deplate::HyperLink::Url.rx
23
+ if dest =~ /^mailto:/
24
+ icon = @variables["mailtoIcon"] || "mailto.png"
25
+ invoker.args['alt'] ||= 'e-mail'
26
+ else
27
+ icon = @variables["urlIcon"] || "url.png"
28
+ # invoker.args['alt'] ||= 'url'
29
+ end
30
+ rv + format_particle(:include_image, icon, {}, true)
31
+ else
32
+ rv
33
+ end
34
+ end
35
+ )
36
+ end
37
+ end
38
+
@@ -0,0 +1,37 @@
1
+ # textstyles-warn-single.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: 03-Okt-2004.
6
+ # @Last Change: 23-Okt-2005.
7
+ # @Revision: 0.8
8
+
9
+ class Deplate::Particle::DeprecatedTextStyleMarkup < Deplate::DeprecatedParticle
10
+ def get_text(match)
11
+ match[2]
12
+ end
13
+ def get_prepost(match)
14
+ [[match[1]], [match[4]]]
15
+ end
16
+ end
17
+
18
+ class Deplate::Particle::EmphasizeDeprecated < Deplate::Particle::DeprecatedTextStyleMarkup
19
+ @@particles << self
20
+ @rx = /^(\*\*)(.+?)(\*\*)/
21
+ end
22
+
23
+ class Deplate::Particle::CodeDeprecated < Deplate::Particle::DeprecatedTextStyleMarkup
24
+ @@particles << self
25
+ @rx = /^(==)(.+?)(==)/
26
+ end
27
+
28
+ class Deplate::Particle::EmphasizeSingleDeprecated < Deplate::Particle::DeprecatedTextStyleMarkup
29
+ @@particles << self
30
+ @rx = /^(\*)((\w|\\[*\s])+?)(\*)/
31
+ end
32
+
33
+ class Deplate::Particle::CodeSingleDeprecated < Deplate::Particle::DeprecatedTextStyleMarkup
34
+ @@particles << self
35
+ @rx = /^(=)((\w|\\[=\s])+?)(=)/
36
+ end
37
+
@@ -0,0 +1,41 @@
1
+ # textstyles1.rb -- Re-enable text styles markup prior to version 0.6
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: 03-Okt-2004.
6
+ # @Last Change: 23-Okt-2005.
7
+ # @Revision: 0.12
8
+
9
+ class Deplate::Particle::Emphasize < Deplate::SimpleParticle
10
+ @rx = /^\*\*(.+?)\*\*/
11
+ end
12
+
13
+ class Deplate::Particle::Code < Deplate::Particle
14
+ @rx = /^==(.+?)==/
15
+ class << self
16
+ def markup(text)
17
+ %{==%s==} % text.gsub("'", "\\\\'")
18
+ end
19
+ end
20
+ end
21
+
22
+ class Deplate::Particle::EmphasizeSingle < Deplate::Particle::Emphasize
23
+ @@particles << self
24
+ @rx = /^\*((\w|\\[*\s])+?)\*/
25
+ end
26
+
27
+ class Deplate::Particle::CodeSingle < Deplate::Particle::Code
28
+ @@particles << self
29
+ @rx = /^=((\w|\\[=\s])+?)=/
30
+ end
31
+
32
+ class Deplate::Macro::Emphasize < Deplate::Macro::FormattedText
33
+ @@macros.delete("_")
34
+ @@macros["*"] = self
35
+ end
36
+
37
+ class Deplate::Macro::Code < Deplate::Macro::FormattedText
38
+ @@macros.delete("'")
39
+ @@macros["="] = self
40
+ end
41
+
@@ -0,0 +1,33 @@
1
+ # mod-navbar1.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: 14-Aug-2004.
6
+ # @Last Change: 23-Okt-2005.
7
+ # @Revision: 0.25
8
+ #
9
+ # Description:
10
+ #
11
+ # Usage:
12
+ #
13
+ # TODO:
14
+ #
15
+ # CHANGES:
16
+ #
17
+
18
+ class Deplate::Formatter::HTML_Site
19
+ def prepare_navbar_png
20
+ type = @deplate.variables["buttonsColour"]
21
+ fileformat = @deplate.variables["buttonsFileFormat"] || "png"
22
+ if type
23
+ type = "-%s.%s" % [type, fileformat]
24
+ else
25
+ type = ".%s" % fileformat
26
+ end
27
+ @deplate.variables["prevButton"] = %{<img src="prev#{type}" border="0" alt="Prev" />}
28
+ @deplate.variables["homeButton"] = %{<img src="home#{type}" border="0" alt="Home" />}
29
+ @deplate.variables["nextButton"] = %{<img src="next#{type}" border="0" alt="Next" />}
30
+ @deplate.variables["goButton"] = %{<img src="go#{type}" border="0" alt="Go" />}
31
+ end
32
+ end
33
+
@@ -0,0 +1,32 @@
1
+ # noindent.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: 29-Aug-2004.
6
+ # @Last Change: 23-Okt-2005.
7
+ # @Revision: 0.18
8
+ #
9
+ # Description:
10
+ # Avoid inserting spaces and linebreaks
11
+
12
+ module Deplate::NoIndent
13
+ def setup(context)
14
+ class << context
15
+ def join_blocks(blocks)
16
+ blocks.join
17
+ end
18
+
19
+ def format_indent(level, shift=false)
20
+ ""
21
+ end
22
+ end
23
+ end
24
+ module_function :setup
25
+ end
26
+
27
+ class Deplate::Core
28
+ def module_initialize_noindent
29
+ Deplate::NoIndent.setup(@formatter)
30
+ end
31
+ end
32
+
@@ -0,0 +1,40 @@
1
+ # numpara.rb -- add numbers to paragraphs
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: 20-Aug-2004.
6
+ # @Last Change: 23-Okt-2005.
7
+ # @Revision: 0.58
8
+ #
9
+ # Description:
10
+ #
11
+ # Usage:
12
+ #
13
+ # TODO:
14
+ #
15
+ # CHANGES:
16
+ #
17
+
18
+ class Deplate::Formatter
19
+ def module_initialize_numpara
20
+ @numpara_done = []
21
+ def_advice("numpara", :format_paragraph,
22
+ :wrap => Proc.new do |agent, rv, invoker, *rest|
23
+ unless invoker.args["noNum"] or @numpara_done.include?(invoker)
24
+ if defined?(@paragraph_number)
25
+ @paragraph_number += 1
26
+ else
27
+ @paragraph_number = 1
28
+ end
29
+ invoker.elt = numbered_paragraph(invoker.elt, @paragraph_number)
30
+ @numpara_done << invoker
31
+ end
32
+ end
33
+ )
34
+ end
35
+
36
+ def numbered_paragraph(text, number)
37
+ return [text, plain_text("[%d]" % number)].join(" ")
38
+ end
39
+ end
40
+