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
data/lib/ps2ppm.rb ADDED
@@ -0,0 +1,239 @@
1
+ #!/usr/bin/env ruby
2
+ # ps2ppm.rb
3
+ # @Author: Peter Kleiweg
4
+ # @Created: 11-Nov-2004.
5
+ # @Last Change: 30-Jul-2005.
6
+ # @Revision: 0.101
7
+ #
8
+ # Ruby translation of the ps2ppm script that can be found
9
+ # http://odur.let.rug.nl/~kleiweg/postscript/ps2ppm
10
+ # here.
11
+ #
12
+ # Note that this is still very perlish.
13
+ #
14
+ # The original perl script is by Peter Kleiweg.
15
+ # Kaspar Schiess (eule AT space.ch) converted this script to ruby.
16
+ #
17
+ # This is a slightly modified and de-perlished version of his converted script.
18
+ #
19
+
20
+ require 'getopts'
21
+ # require 'pp'
22
+
23
+ module Ps2ppm
24
+ @gsname = "gs"
25
+ # @gsname = "gs.bat"
26
+ @progname = "ps2pmm"
27
+ @default = 'ppmraw'
28
+
29
+ def syntax
30
+ puts <<EOS
31
+
32
+ PostScript to Pixelmap(s) Converter
33
+ (C) P. Kleiweg 1996-1999
34
+
35
+ Usage: #{@progname} [-1ghot] [-f format] [-m margin] [-O orientation] [-r resolution] file[.[e]ps]
36
+
37
+ -1: old PostScript Level 1 method (unsafe?)
38
+ -f: format (default #{@default}), for listing type: gs -h
39
+ -g: anti-alias graphics (try it)
40
+ -h: this help
41
+ -m: margin (default 0)
42
+ -O: orientation (overrides %%Orientation comment)
43
+ valid orientations are: Portrait Landscape Upside-Down Seascape
44
+ -o: force overwrite
45
+ -r: resolution (default 72)
46
+ -t: anti-alias text (recommended)
47
+
48
+ EOS
49
+ exit
50
+ end
51
+ module_function :syntax
52
+
53
+ def run(file, opt={})
54
+ syntax unless file
55
+
56
+ level = 2
57
+ format = @default
58
+ margin = 0
59
+ overwrite = 0
60
+ orient = 'Portrait'
61
+ res = 72
62
+ gab = ''
63
+ tab = ''
64
+ values = []
65
+
66
+ level = true if opt['1']
67
+ format = opt['f'] if opt['f']
68
+ margin = Float(opt['m']) if opt['m']
69
+ overwrite = true if opt['o']
70
+ res = Integer(opt['r']) if opt['r']
71
+ gab = '-dGraphicsAlphaBits=4' if opt['g']
72
+ tab = '-dTextAlphaBits=4' if opt['t']
73
+
74
+ case format
75
+ when "jpeg"
76
+ # values << "-dQFactor=1.0"
77
+ values << "-dJPEGQ=100"
78
+ end
79
+
80
+ out_file1 = "#{file}.01.#{format}"
81
+
82
+ # If you have problems with anti-aliasing, try uncommenting this:
83
+ # if opt['g'] or opt['t']
84
+ # values << '-dRedValues=256 -dGreenValues=256 -dBlueValues=256 -dGrayValues=256'
85
+ # end
86
+
87
+ infile = file
88
+ file = file.sub( /\.[eE]?[Pp][Ss]$/, '' )
89
+ unless infile =~ /\.[eE]?[Pp][Ss]$/
90
+ infile += '.ps'
91
+ end
92
+
93
+ if FileTest.file?(out_file1) && (! overwrite)
94
+ raise "File exists: #{out_file1}";
95
+ end
96
+
97
+ found = false
98
+ level = 0
99
+ x1 = nil
100
+ y1 = nil
101
+ x2 = nil
102
+ y2 = nil
103
+ found = nil
104
+
105
+ postscript = nil
106
+ File.open( infile, 'rb' ) do |io|
107
+ postscript = io.readlines
108
+ end
109
+ postscript.each do |line|
110
+ if level == 0 and line =~ /^%%BoundingBox:\s*(-?\d+)\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)/
111
+ x1 = Integer($1)
112
+ y1 = Integer($2)
113
+ x2 = Integer($3)
114
+ y2 = Integer($4)
115
+ found = true
116
+ elsif level == 0 and line =~ /^%%Orientation:\s*(\S+)/
117
+ o = $1
118
+ if o =~ /^portrait$/i
119
+ orient = 'Portrait';
120
+ elsif o =~ /^landscape$/i
121
+ orient = 'Landscape'
122
+ elsif o =~ /^upside-?down$/i
123
+ orient = 'Upside-Down'
124
+ elsif o =~ /^seascape$/i
125
+ orient = 'Seascape'
126
+ end
127
+ elsif line =~ /^%%BeginDocument\b/
128
+ level += 1
129
+ elsif line =~ /^%%EndDocument\b/
130
+ level -= 1
131
+ end
132
+ end
133
+ found or raise "BoundingBox not found in #{file}.ps"
134
+
135
+ if opt['O']
136
+ case opt['O']
137
+ when /^portrait/i
138
+ orient = 'Portrait'
139
+ when /^landscape$/i
140
+ orient = 'Landscape'
141
+ when /^upside-?down$/i
142
+ orient = 'Upside-Down'
143
+ when /^seascape$/i
144
+ orient = 'Seascape'
145
+ else
146
+ raise 'Illegal orientation'
147
+ end
148
+ end
149
+
150
+ trans = ''
151
+
152
+ if margin != 0
153
+ trans << "#{margin} dup translate "
154
+ end
155
+
156
+ case orient
157
+ when 'Portrait'
158
+ w = x2 - x1
159
+ h = y2 - y1
160
+ when 'Landscape'
161
+ w = y2 - y1
162
+ h = x2 - x1
163
+ t = -h
164
+ trans << "-90 rotate #{t} 0 translate "
165
+ when 'Upside-Down'
166
+ w = x2 - x1
167
+ h = y2 - y1
168
+ ww = -w
169
+ hh = -h
170
+ trans << "180 rotate #{ww} #{hh} translate "
171
+ when 'Seascape'
172
+ w = y2 - y1
173
+ h = x2 - x1
174
+ t = -w
175
+ trans << "90 rotate 0 #{t} translate "
176
+ else
177
+ raise "Unknown orientation: %s" % orient
178
+ end
179
+
180
+ w = ((2.0 * margin + w) * res / 72.0).to_i
181
+ h = ((2.0 * margin + h) * res / 72.0).to_i
182
+
183
+ x = -x1
184
+ y = -y1
185
+ trans << "#{x} #{y} translate"
186
+
187
+ puts "#{file}.ps -> #{file}.%02d.#{format}"
188
+
189
+ if defined?(Deplate::External.get_app)
190
+ gsname = Deplate::External.get_app('gs', @gsname)
191
+ else
192
+ gsname = @gsname
193
+ end
194
+ cmdline = "#{gsname} -dDOINTERPOLATE #{values.join(" ")} #{gab} #{tab} -g#{w}x#{h} -r#{res} -sDEVICE=#{format} -sOutputFile=#{file}.%02d.#{format} -dNOPAUSE -"
195
+ IO.popen(cmdline, 'w') do |gs|
196
+
197
+ if level == 1
198
+ gs.puts <<LEV1HEAD
199
+ /showpage {
200
+ showpage
201
+ #{trans}
202
+ (.) print flush
203
+ } bind def
204
+ #{trans}
205
+ LEV1HEAD
206
+ else
207
+ gs.puts <<LEV2HEAD
208
+ <<
209
+ /BeginPage {
210
+ pop
211
+ #{trans}
212
+ }
213
+ /EndPage {
214
+ dup 0 eq {
215
+ pop
216
+ 1 add 4 string cvs print ( ) print flush
217
+ true
218
+ } {
219
+ 1 eq
220
+ exch pop
221
+ } ifelse
222
+ }
223
+ >> setpagedevice
224
+ LEV2HEAD
225
+ end
226
+ gs.puts postscript
227
+ gs.puts "\nquit\n"
228
+ return File.exist?(out_file1)
229
+ end
230
+ end
231
+ module_function :run
232
+ end
233
+
234
+ if __FILE__ == $0
235
+ file = ARGV.pop
236
+ getopts('1f:ghm:oO:r:t')
237
+ Ps2ppm.run(file, $OPT)
238
+ end
239
+
@@ -0,0 +1,692 @@
1
+ .\"Generated by db2man.xsl. Don't modify this, modify the source.
2
+ .de Sh \" Subsection
3
+ .br
4
+ .if t .Sp
5
+ .ne 5
6
+ .PP
7
+ \fB\\$1\fR
8
+ .PP
9
+ ..
10
+ .de Sp \" Vertical space (when we can't use .PP)
11
+ .if t .sp .5v
12
+ .if n .sp
13
+ ..
14
+ .de Ip \" List item
15
+ .br
16
+ .ie \\n(.$>=3 .ne \\$3
17
+ .el .ne 3
18
+ .IP "\\$1" \\$2
19
+ ..
20
+ .TH "DEPLATE" 1 "02. Nov 2005" "" ""
21
+ .SH NAME
22
+ deplate \- Deplate - convert wiki-like markup to latex, docbook, html, or �html-slides�
23
+ .SH "USAGE"
24
+
25
+ .PP
26
+ The command\-line options:
27
+
28
+ .IP
29
+
30
+ Usage: deplate\&.rb [OPTIONS] FILE [OTHER FILES \&.\&.\&.]
31
+
32
+
33
+ deplate is a free software with ABSOLUTELY NO WARRANTY under
34
+ the terms of the GNU General Public License version 2\&.
35
+
36
+
37
+ General Options:
38
+ \-a, \-\-[no\-]ask On certain actions, query
39
+ user before overwriting files
40
+ \-A, \-\-allow ALLOW Allow certain things: x,
41
+ X, $
42
+ \-c, \-\-config FILE Alternative user cfg file
43
+ \-\-[no\-]clean Clean up temporary files
44
+ \-\-color Colored output
45
+ \-\-css NAME Copy NAME\&.css to the destination
46
+ directory, if inexistent
47
+ \-\-copy\-css NAME Copy NAME\&.css to the destination
48
+ directory
49
+ \-d, \-\-dir DIR Output directory
50
+ \-D, \-\-define NAME=VALUE Define a document option
51
+ \-e, \-\-[no\-]each Handle each file separately
52
+ \-\-[no\-]force Force output
53
+ \-f, \-\-format FORMAT Output format (default:
54
+ html)
55
+ \-\-[no\-]included Output body only
56
+ \-i, \-\-input NAME Input definition
57
+ \-\-list FILE A file that contains a list
58
+ of input files
59
+ \-\-log FILE A file (or \- for stdout)
60
+ where to put the log
61
+ \-\-[no\-]loop Read from stdin forever
62
+ and ever
63
+ \-\-metadata [NAME] Save metadata in this format
64
+ (default: yaml)
65
+ \-m, \-\-module MODULE Load a module
66
+ \-o, \-\-out FILE Output to file or stdout
67
+ ('\-')
68
+ \-p, \-\-pattern GLOBPATTERN File name pattern
69
+ \-P, \-\-exclude GLOBPATTERN Excluded file name pattern
70
+ \-r, \-\-[no\-]recurse Recurse into directories
71
+ \-\-reset\-filecache Reset the file database
72
+ \-R, \-\-[no\-]Recurse Recurse and rebuild hierarchy
73
+ \-\-[no\-]simple\-names Disable simple wiki names
74
+ \-\-suffix SUFFIX Suffix for output files
75
+ \-t, \-\-template NAME Template to use
76
+ \-\-[no\-]vanilla Ignore user configuration
77
+ \-x, \-\-allow\-ruby [RUBY SAFE] Allow the execution of ruby
78
+ code
79
+ \-X, \-\-[no\-]allow\-exec Allow the execution of helper
80
+ applications
81
+ \-\-[no\-]external
82
+
83
+
84
+ LaTeX Formatter:
85
+ \-\-[no\-]pdf Prepare for use with pdf(la)tex
86
+
87
+
88
+ Available input defintions:
89
+ deplate, deplate\-headings, deplate\-restricted, rdoc, template
90
+
91
+
92
+ Available formatters:
93
+ dbk\-article, dbk\-article\-4\&.1\&.2, dbk\-book, dbk\-ref, dbk\-slides,
94
+ dbk\-snippet, html, html\-snippet, htmlsite, htmlslides, htmlwebsite,
95
+ latex, latex\-snippet, php, phpsite, plain, template, xhtml10t
96
+
97
+
98
+ Available metadata formats:
99
+ marshal, xml, yaml
100
+
101
+
102
+ Available modules:
103
+ anyword, babelfish, code\-gvim, code\-highlight, colored\-log, de,
104
+ en, endnotes, fr, html\-asciimath, html\-deplate\-button, html\-headings\-navbar,
105
+ html\-obfuscate\-email, html\-sidebar, htmlslides\-navbar\-fh, iconv,
106
+ imgurl, inlatex\-compound, koma, latex\-emph\-table\-head, latex\-styles,
107
+ latex\-verbatim\-small, makefile, mark\-external\-urls, markup\-1,
108
+ markup\-1\-warn, navbar\-png, noindent, numpara, particle\-math,
109
+ php\-extra, pstoedit, recode, ru_koi8\-r, smiley, soffice, symbols\-latin1,
110
+ symbols\-od\-utf\-8, symbols\-plain, symbols\-sgml, symbols\-utf\-8,
111
+ symbols\-xml, syntax\-region\-alt, utf8, validate\-html, xmlrpc,
112
+ zh\-cn, zh\-cn\-autospace
113
+
114
+
115
+ Available css files:
116
+ article, deplate, heading\-navbar, layout\-deplate, layout\-deplate\-print,
117
+ sans\-serif, serif, serif\-e, serif\-rel, slides, tabbar, tabbar\-left,
118
+ tabbar\-right, tabbar\-right\-ie, tabbar\-top, text\-sans\-serif, text\-serif
119
+
120
+
121
+ Available templates:
122
+ CVS, html\-doc\&.html, html\-left\-tabbar\-js\&.html, html\-left\-tabbar\&.html,
123
+ html\-tabbar\-right\-table\&.html, html\-tabbar\-right\&.html, html\-tabbar\-top\&.html,
124
+ html\-tabbar\&.html
125
+
126
+
127
+ Other Options:
128
+ \-\-debug [LEVEL] Show debug messages
129
+ \-\-[no\-]profile Profile execution
130
+ \-\-[no\-]quiet Be quiet
131
+ \-v, \-\-[no\-]verbose Run verbosely
132
+ \-h, \-\-help Show this message
133
+ \-\-version Show version
134
+ \-\-microversion Show version
135
+
136
+ .PP
137
+ Typical uses of deplate are:
138
+
139
+ .TP
140
+ deplate \-D auxiliaryDirSuffix=_files text\&.txt
141
+ Convert the file to html; put auxiliary files that are created during the conversion process into a subdirectory called �text_files�
142
+
143
+ .TP
144
+ deplate \-d DESTDIR \-f htmlslides text*\&.txt
145
+ Convert a bunch of files to �html slides�; put the output into �DESTDIR�
146
+
147
+ .TP
148
+ deplate \-f latex \-\-pdf \-D suffix=txt text*\&.txt
149
+ Convert a bunch of files to a single LaTeX file and prepare for pdflatex; assume that the wiki files have a �txt� extension; wiki names referring to included files are transformed to internal references
150
+
151
+ .TP
152
+ deplate \-R \-p �\\*\&.txt� \-D suffix=txt \-o \&.\&./Wiki\&.tex WikiIndex\&.txt *
153
+ Convert all files in the current directory and below to a single LaTeX file; include only files with �txt� as suffix; put WikiIndex\&.txt first
154
+
155
+ .TP
156
+ deplate \-R \-e \-d \&.\&./Wiki_html *
157
+ Convert all files in the current directory and its subdirectories to html; save the output in directory Wiki_html; rebuild the directory structure of the input files
158
+
159
+ .TP
160
+ deplate \- < INPUT > OUTPUT
161
+ Work as a filter by converting the input from stdin; this doesn�t actually work like a pipe though because all the input has to be read in order to generate the output
162
+
163
+ .TP
164
+ deplate \-x \-X file\&.txt
165
+ Convert a file and allow the evaluation of embedded ruby code and the execution of external applications, e\&.g\&., latex\&. These command switches are necessary for some language elements to work\&.
166
+
167
+ .PP
168
+ Notes:
169
+
170
+ .TP
171
+ \-D VAR, \-D VAR=VALUE
172
+ You can define document variables via the command line; if no value is provided the variable is set to �1�\&.
173
+
174
+ The option parser library, which deplate uses, doesn�t deal well with spaces in command line arguments\&. This is why spaces have to be replaced with tildes; a tilde and backslashes have to be preceded with backslashes\&. Example: \-D\~text=bla~bla\\~bla sets the document variable text to �bla bla~bla�\&. As a shell usually interpretes backslashes too, you would usually have to type \-D\~text=bla~bla\\\\~bla\&.
175
+
176
+ .TP
177
+ \-e
178
+ Process each file separately
179
+
180
+ .TP
181
+ \-m, \-\-module MODULE
182
+ Load an add\-on/module (after loading the core and the formatter); modules reside in the deplate library directory or in the user configuration directory (�~/\&.deplate/mod/�); type deplate\~\-\-help to see a list of available modules\&.
183
+
184
+ After loading the module, deplate searches for the file �~/\&.deplate/after/mod/NAME\&.rb� which will be loaded if found\&.
185
+
186
+ German, Chinese, and Russian localizations are provided as modules\&.
187
+
188
+ .TP
189
+ \-p PATTERN, \-P PATTERN
190
+ Backslashes in the pattern must come in doubles; backslashes can be used to prevent the shell from expanding the pattern; e\&.g\&., in case you�re using bash, you would usually type something like \-p\~"\\\\*\&.txt"
191
+
192
+ .TP
193
+ \-x, \-\-allow\-ruby [RUBY SAFE]
194
+ Ruby�s SAFE variable has 5 levels (0=no checks/default \&.\&. 4=sandbox; at present, this also sets the SAFE variable for deplate itself, which doesn�t work with SAFE set to 4)
195
+
196
+ .TP
197
+ \-X, \-\-[no\-]allow\-exec, \-\-[no\-]external
198
+ Allow the execution of external applications, e\&.g\&., LaTeX\&. You won�t be able to translate inline LaTeX unless you call deplate with this command line option\&. In order to make this permanent, see\~[xref to anchor]\&.
199
+
200
+ .TP
201
+ \-A, \-\-allow FLAGS
202
+ Flags is a list of comma separated letters which may contain:
203
+
204
+ .RS
205
+
206
+ .TP
207
+ x
208
+ Same as \-x
209
+
210
+ .TP
211
+ X
212
+ Same as \-X
213
+
214
+ .TP
215
+ :
216
+ Allow referencing options by prepending a name with �:� in some situations (e\&.g\&. #IF tests)\&.
217
+
218
+ .RE
219
+ .IP
220
+
221
+ .PP
222
+ Some variables change the way deplate works\&.
223
+
224
+ .TP
225
+ autoFileNames
226
+ In multi\-file output, the file name is constructed from the top heading unless explicitely defined (id, caption, shortcaption)
227
+
228
+ .TP
229
+ auxiliaryDirSuffix
230
+ If defined, auxiliary files are saved in the subdirectory #{basename\~FILENAME}#{auxiliaryDirSuffix}\&. E\&.g\&., if auxiliaryDirSuffix is �_files� and the current file is �Test�, then auxiliary files (images, on\-the\-fly generated files that are passed to external applications etc\&.) are saved in �Test_files�\&.
231
+
232
+ .SS "Editor support"
233
+
234
+ .PP
235
+ As whitespace is significant in the context of lists and the like, you should not insert tab characters in the document but replace tabs with blanks/spaces\&. Most editors can be tweaked to work this way\&.
236
+
237
+ .PP
238
+ If you absolutely want to insert tab characters or if you don�t know how to keep your editor from inserting tabs, you can set the tabwidth (default: 4) variable to the tab width setting of your editor\&. deplate will then try to expand tab characters\&.
239
+
240
+ .PP
241
+ deplate is the accompanying converter for the Vim viki plugin: \fIhttp://www.vim.org/scripts/script.php?script_id=861\fR, which supports all of deplate�s default markup\&.
242
+
243
+ .SH "CONFIGURATION"
244
+
245
+ .PP
246
+ Configuration requires some knowledge of the ruby language\&. If you don�t already know ruby, ruby is a well designed, \fIfully\fR object\-oriented interpreted language in the spirit of Smalltalk (but with a rather modern syntax) plus some features from Perl and Lisp/Scheme (e\&.g\&. continuations)\&.
247
+
248
+ .PP
249
+ The configuration files are regular ruby files and are loaded after requiring all the libraries necessary\&. Theses files reside in the directory �$HOME/\&.deplate/� or �$USERPROFILE/deplate\&.rc/�\&. This directory may also contain custom modules or css files etc\&. On Win 2000/XP etc\&., $USERPROFILE is usually set to �C:\\Documents and Settings\\USERNAME\\�\&. See also\~?? for how to add new elements, particles, macros etc\&.
250
+
251
+ .PP
252
+ The user configuration directory should look like this:
253
+
254
+ .TP 3
255
+ \(bu
256
+ ~/\&.deplate/
257
+
258
+ .RS
259
+ .TP 3
260
+ \(bu
261
+ config\&.rb (the general user configuration file, which is loaded last)
262
+ .TP
263
+ \(bu
264
+ deplate\&.ini (an alternative way to configure deplate)
265
+ .TP
266
+ \(bu
267
+ after/ (files that are loaded right after the corresponding formatter or module)
268
+
269
+ .RS
270
+ .TP 3
271
+ \(bu
272
+ fmt/
273
+ .TP
274
+ \(bu
275
+ input/
276
+ .TP
277
+ \(bu
278
+ mod/
279
+ .LP
280
+ .RE
281
+ .IP
282
+ .TP
283
+ \(bu
284
+ css/ (user defined css files)
285
+ .TP
286
+ \(bu
287
+ fmt/ (user defined formatters)
288
+ .TP
289
+ \(bu
290
+ input/ (user defined input definitions)
291
+ .TP
292
+ \(bu
293
+ lib/ (user defined deplate snippets)
294
+
295
+ .RS
296
+ .TP 3
297
+ \(bu
298
+ FORMATTER/ (output\-format specific deplate snippets)
299
+ .LP
300
+ .RE
301
+ .IP
302
+ .TP
303
+ \(bu
304
+ mod/ (user defined modules)
305
+ .TP
306
+ \(bu
307
+ templates/ (user defined templates)
308
+ .LP
309
+ .RE
310
+ .IP
311
+ .LP
312
+
313
+ .PP
314
+ If the user requests loading �MODULE�, deplate searches for �~/\&.deplate/mod/MODULE\&.rb� first, then in ruby site\-library\&. If it was found and loaded, the file �~/\&.deplate/after/mod/MODULE\&.rb� will be sourced, too \-\- if available\&.
315
+
316
+ .PP
317
+ deplate calls the class method Deplate::Core\&.user_setup after processing the command line argumend\&. It calls the instance method Deplate#user_initialize after the new instance of the deplate converter was created and initialized, right before actually performing the conversion\&.
318
+
319
+ .PP
320
+ In general, configuration is done by patching ruby classes\&. In the following example, we
321
+
322
+ .TP 3
323
+ \(bu
324
+ restrict the markers for unordered lists to �#�
325
+ .TP
326
+ \(bu
327
+ define Koma\-Script�s article class as the default latex class
328
+ .LP
329
+
330
+ .IP
331
+
332
+ class Deplate::List::Itemize
333
+ @rx = /^(([ \\t]+)(#)[ \\t]+)(\&.+)$/
334
+ end
335
+
336
+ class Deplate::Formatter::LaTeX
337
+ @@latexDocClass = "scrartcl"
338
+ end
339
+
340
+ .PP
341
+ Here is another example from my personal �after/fmt/latex\&.rb� file\&.
342
+
343
+ .IP
344
+
345
+ class Deplate::Formatter::LaTeX
346
+ def hook_pre_prepare_my_configuration
347
+ suppl = @deplate\&.variables["suppl"] #1
348
+ suppl &&= "[" + suppl + "]"
349
+ output_at(:pre, :user_packages, "\\\\usepackage#{suppl}{suppl}")
350
+
351
+ t = @deplate\&.get_clip("title") #2
352
+ output_at(:pre, :body_title, "\\\\tmltitle{#{t\&.elt}}") if t
353
+ a = @deplate\&.get_clip("author")
354
+ output_at(:pre, :body_title, "\\\\tmlauthor{#{a\&.elt}}") if a
355
+ d = @deplate\&.get_clip("date")
356
+ output_at(:pre, :body_title, "\\\\tmldate{#{d\&.elt}}") if d
357
+ end
358
+ end
359
+
360
+ .TP 3
361
+ 1.
362
+ Add a usepackage statement to the preamble \-\- with optional arguments from the �suppl� variable: \fImarkup.xml#docCmd\fR\&.
363
+ .TP
364
+ 2.
365
+ extracts information about the document�s title and author (see\~??) and adds some user\-defined commands to the document preamble \-\- but below any usepackage statements (see\~??)
366
+ .LP
367
+
368
+ .SS "User configuration of the standard setup"
369
+
370
+ .PP
371
+ deplate calls the methods Deplate::Core\&.user_setup(options) and Deplate::Core#user_initialize if they are defined in order to provide a possibility to hook into the standard setup procedure\&.
372
+
373
+ .PP
374
+ Deplate::Core\&.user_setup is called when starting deplate from the command line and before a instance of Deplate::Core was created\&. This method should be used to set values in the options structure (see\~??) or to permanently require one of deplate�s modules\&.
375
+
376
+ .PP
377
+ Deplate::Core#user_initialize is called after an instance of Deplate::Core was created and should be used to set variables specific to this instance\&.
378
+
379
+ .IP
380
+
381
+ class Deplate::Core
382
+ def self\&.user_setup(options)
383
+ options\&.field_name = 'some value'
384
+ require_module(options, 'NAME')
385
+ end
386
+
387
+ def user_initialize
388
+ @variables['NAME'] = 'VALUE'
389
+ end
390
+ end
391
+
392
+ .SS "Configuration of wiki names"
393
+
394
+ .PP
395
+ Usually, any word in CamelCase (a\&.k\&.a\&. wiki name) is turned into a hyperlink\&. By default only the letters A\-Z and a\-z are allowed here in order to minimize possible conflicts between different encodings and different versions of ruby on different systems with different locales in effect\&. If this doesn�t fit your needs, maybe because you happen to write in a language other than English, which is possible and maybe even likely, you might want to change this\&. Add something like this with the new character sets to your config\&.rb file:
396
+
397
+ .IP
398
+
399
+ class Deplate::HyperLink
400
+ @@uc = 'A\-Z���'
401
+ @@lc = 'a\-z��������������'
402
+ end
403
+
404
+ # the following re\-compiles the regexps for wiki names
405
+ Deplate::HyperLink\&.setup
406
+
407
+ .SS "Configuration via deplate.ini"
408
+
409
+ .PP
410
+ If you don�t want to configure deplate using ruby, you can put some settings into the deplate\&.ini file, which usually resides in ~/\&.depate and/or #{PWD}/deplate\&.rc\-\-but see\~[xref to refsect1]\&.
411
+
412
+ .PP
413
+ This file contains a sequence of commands\&. Each command must fit in one line\&. The following commands are allowed:
414
+
415
+ .TP
416
+ mod\~NAME
417
+ Load the module NAME
418
+
419
+ .TP
420
+ fmt\~NAME
421
+ Set the standard formatter
422
+
423
+ .TP
424
+ clip\~NAME=VALUE
425
+ Set the clip NAME (e\&.g\&., �author�) to VALUE
426
+
427
+ .TP
428
+ wiki\~NAME\&.SUFFIX=BASEURL
429
+ Define an interwiki (the \&.SUFFIX part is optional)
430
+
431
+ .TP
432
+ wikichars\~UPPERCHARS\~LOWERCHARS
433
+ Define the allowed characters in wiki names
434
+
435
+ .RS
436
+ .Sh "Important"
437
+
438
+ .PP
439
+ Wiki names must always begin with A\-Z even then wiki chars were redefined (at least until ruby�s regexp library makes \\b match properly against words starting with an international upper case character)
440
+
441
+ .RE
442
+
443
+ .TP
444
+ app\~NAME=COMMANDLINE
445
+ Define an external app (e\&.g\&., latex, dvips, R, dot, neato, pstoedit, identify, gs \&.\&.\&.)
446
+
447
+ .TP
448
+ $ENV=VALUE
449
+ Set an environment variable
450
+
451
+ .TP
452
+ VAR=VALUE
453
+ Set variable VAR to VALUE
454
+
455
+ .RS
456
+ .TP 3
457
+ \(bu
458
+ Alternatively, variables can contain multi\-line values using the usual heredoc pattern (<<MARKER\\nTEXT\&.\&.\&.\\nMARKER\\n) as long as the smaller characters (�<<�) appear right after the equals sign\&. Internally, a multi\-line value is processed as array\&.
459
+ .LP
460
+ .RE
461
+ .IP
462
+
463
+ .PP
464
+ Although this may not always work as expected, you can also set some options (as defined in \~??) by prepending the name with a colon (�:�) or by using the option keyword:
465
+
466
+ .TP
467
+ option\~NAME~
468
+ Set option NAME to false
469
+
470
+ .TP
471
+ option\~NAME!
472
+ Set option NAME to true
473
+
474
+ .TP
475
+ option\~NAME?=true|false|yes|no|on|off
476
+ Set option NAME to a boolean value
477
+
478
+ .TP
479
+ option\~NAME%=INTEGER
480
+ Set option NAME to a numeric value
481
+
482
+ .TP
483
+ option\~NAME=VALUE
484
+ Set option NAME to VALUE as string
485
+
486
+ .PP
487
+ Lines beginning with one of *%#; are considered comments\&.
488
+
489
+ .PP
490
+ Example deplate\&.ini:
491
+
492
+ .IP
493
+
494
+ # Load some standard modules
495
+ mod de
496
+ mod mark\-external\-urls
497
+ mod colored\-log
498
+
499
+ # Applications
500
+ app dot=/somewhere/not/in/the/standard/path/dot
501
+
502
+ # Clips
503
+ clip author=Thomas Link
504
+
505
+ # Options
506
+ option allow_exec!
507
+ option allow_ruby!
508
+
509
+ # By default, use only a subset of deplate's standard markup
510
+ option input_def=deplate\-restricted
511
+
512
+ # Create latex output by default
513
+ option fmt=latex
514
+
515
+ # Wikis
516
+ wikichars A\-Z��� a\-z��������������
517
+ wiki DEPLATE\&.html=http://deplate\&.sf\&.net/
518
+
519
+ # Variables
520
+ ## HTML
521
+ css=deplate\&.css
522
+
523
+ topBar=<<\-\-\-\-
524
+ [auto]
525
+ MyOtherHomepage | http://www\&.homepage\&.org
526
+ \-\-\-\-
527
+
528
+ ## Save auxiliary files in a subdirectory (BASENAME_files)
529
+ auxiliaryDirSuffix=_files
530
+
531
+ .SS "Templates"
532
+
533
+ .PP
534
+ deplate supports two ways of page templates:
535
+
536
+ .TP 3
537
+ 1.
538
+ Template variables
539
+ .TP
540
+ 2.
541
+ Template files
542
+ .LP
543
+
544
+ .PP
545
+ You can define a template in ruby by setting the following Deplate class variables:
546
+
547
+ .TP 3
548
+ \(bu
549
+ these variables (array of arrays of strings) can be redefined in Deplate::Core\&.user_setup to put some formatted output on every page/file
550
+
551
+ .RS
552
+ .TP 3
553
+ \(bu
554
+ @@pre_matter_template
555
+ .TP
556
+ \(bu
557
+ @@body_template
558
+ .TP
559
+ \(bu
560
+ @@post_matter_template
561
+ .LP
562
+ .RE
563
+ .IP
564
+ .TP
565
+ \(bu
566
+ this variable (array of strings) can contain some deplate markup that will be prepended to every file read
567
+
568
+ .RS
569
+ .TP 3
570
+ \(bu
571
+ @@deplate_template
572
+ .LP
573
+ .RE
574
+ .IP
575
+ .LP
576
+
577
+ .PP
578
+ Typical use would be (in your config\&.rb file)
579
+
580
+ .IP
581
+
582
+ class Deplate
583
+ def self\&.user_setup(options)
584
+ if options\&.fmt =~ /^html/
585
+ @@post_matter_template[10] = ['<br>\\n(c) 2004, Me']
586
+ end
587
+ @@deplate_template << '#AU: My Name'
588
+ end
589
+ end
590
+
591
+ .PP
592
+ Via the \-t or \-\-template command\-line option or by setting the template document variable (see\~??), you can define simple text templates that will be filled in with content from your deplate file\&.
593
+
594
+ .PP
595
+ Since version 0\&.7, deplate uses a specialized formatter for handling templates\&. Before 0\&.7, this was done by search & replace\&. If you have pre 0\&.7 templates which don�t work any more, you can switch back to the old template mechanism by setting the document option: \fImarkup.xml#docOpt\fR template_version to 1\&.
596
+
597
+ .PP
598
+ In templates, only a small number of statements are available:
599
+
600
+ .TP
601
+ Commands
602
+ GET, ARG, XARG, VAR, OPT, PREMATTER, POSTMATTER, BODY, IF, ELSE, ELSEIF, ENDIF, INC/INCLUDE
603
+
604
+ .TP
605
+ Regions
606
+ Foreach, Mingle, Ruby, Var
607
+
608
+ .TP
609
+ Macros
610
+ get, clip, opt, arg, xarg, doc, ruby
611
+
612
+ .PP
613
+ The commands PREMATTER, POSTMATTER, BODY as well as the Mingle region are specific to templates\&.
614
+
615
+ .PP
616
+ PREMATTER, POSTMATTER, and BODY can be used to fill in formatted content (see\~?? for an explanation of deplate�s document structure):
617
+
618
+ .TP
619
+ #PREMATTER
620
+ The file header, the beginning of the document definition, some text that in multi\-file mode should appear in every output file
621
+
622
+ .TP
623
+ #BODY
624
+ The text body
625
+
626
+ .TP
627
+ #POSTMATTER
628
+ Some text that in multi\-file mode should appear in every output file, the end of document definition
629
+
630
+ .PP
631
+ These commands take a list of slots (named or as numbers) as arguments (see\~??)\&. The slots can be single slots or ranges\&. They can be positive (add selectively) or negative (add with the exception of certain content)\&. Examples:
632
+
633
+ .TP
634
+ #PREMATTER:\~\-doc_def
635
+ add the prematter without the document type definition
636
+
637
+ .TP
638
+ #PREMATTER:\~doc_def\~mod_packages\~mod_head
639
+ add the document type definition, and stuff added by modules
640
+
641
+ .TP
642
+ #PREMATTER:\~head_beg\&.\&.prematter_end
643
+ add everything from the head on downwards
644
+
645
+ .PP
646
+ A slot cannot be consumed twice\&. I\&.e\&., if you use several template commands, the latter will not insert the content that was already inserted by the previous command\&.
647
+
648
+ .PP
649
+ The Mingle region can be used to add some text to a specific slot in the original document\&. Filling in templates takes place after the document was produced\&. A template actually processed by deplate like normal text but with a different active rule set\&. Thus, if you define a slot or a type for a region in the template file these definitions refer to the template output which usually is not quite what you want\&. You can use Mingle to make them refer to the original document\&. See html\-left\-tabbar\-js\&.html in the templates subdirectory of the distribution for an example\&.
650
+
651
+ .PP
652
+ Curly braces in templates could cause problems because deplate maybe interpretes them as macros\&. If deplate mixes up your template, you should prefix these curly braces that cause problems with a backslash\&.
653
+
654
+ .PP
655
+ Backslashes have always to be doubled\&.
656
+
657
+ .PP
658
+ A LaTeX template could then look like this:
659
+
660
+ .IP
661
+
662
+
663
+ \\\\documentclass[12pt,a4paper]{letter}
664
+
665
+ #PREMATTER: \-doc_def
666
+
667
+ \\\\address{{get: author}\\\\\\\\
668
+ Where I live}
669
+ \\\\signature{{get: author}}
670
+
671
+ \\\\begin{letter}{{get: addresseeAddress}}
672
+
673
+ \\\\opening{Dear {get: addresseeName},}
674
+
675
+ #BODY
676
+
677
+ \\\\closing{Sincerly,}
678
+
679
+ \\\\vfill{}
680
+ \\\\encl{{val: enclosure}}
681
+
682
+ \\\\end{letter}
683
+
684
+ #POSTMATTER
685
+
686
+ .PP
687
+ You could now copy this example template to �~/\&.deplate/templates/letter\&.tex� and call deplate as:
688
+
689
+ .IP
690
+
691
+ deplate \-f latex \-t letter\&.tex DEPLATE\&.FILE
692
+