deplate 0.8.1 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. data/AUTHORS.TXT +2 -1
  2. data/CHANGES.TXT +56 -211
  3. data/NEWS.TXT +15 -38
  4. data/VERSION.TXT +1 -1
  5. data/bin/deplate +0 -0
  6. data/bin/deplate.bat +0 -0
  7. data/etc/deplate.ini +11 -0
  8. data/lib/deplate/commands.rb +8 -3
  9. data/lib/deplate/common.rb +2 -2
  10. data/lib/deplate/core.rb +157 -45
  11. data/lib/deplate/css/article.css +19 -3
  12. data/lib/deplate/css/doc.css +770 -0
  13. data/lib/deplate/elements.rb +7 -7
  14. data/lib/deplate/ents/general-latin1.entities +100 -0
  15. data/lib/deplate/ents/general-utf-8.entities +252 -0
  16. data/lib/deplate/external.rb +3 -2
  17. data/lib/deplate/fmt/html.rb +12 -10
  18. data/lib/deplate/fmt/latex.rb +25 -14
  19. data/lib/deplate/fmt/plain.rb +4 -5
  20. data/lib/deplate/fmt/xhtml11m.rb +25 -0
  21. data/lib/deplate/formatter.rb +106 -32
  22. data/lib/deplate/input.rb +8 -7
  23. data/lib/deplate/lib/Makefile.config +11 -1
  24. data/lib/deplate/locale/de.latin1 +9 -0
  25. data/lib/deplate/macros.rb +23 -18
  26. data/lib/deplate/mod/code-coderay.rb +45 -0
  27. data/lib/deplate/mod/code-gvim.rb +3 -2
  28. data/lib/deplate/mod/code-gvim71.rb +3 -6
  29. data/lib/deplate/mod/code-highlight.rb +3 -2
  30. data/lib/deplate/mod/entities-decode.rb +72 -0
  31. data/lib/deplate/mod/entities-encode.rb +50 -0
  32. data/lib/deplate/mod/guesslanguage.rb +3 -3
  33. data/lib/deplate/mod/html-jsmath.rb +5 -5
  34. data/lib/deplate/mod/html-mathml.rb +40 -0
  35. data/lib/deplate/mod/latex-styles.rb +21 -11
  36. data/lib/deplate/mod/makefile.rb +21 -11
  37. data/lib/deplate/mod/markup-1.rb +3 -3
  38. data/lib/deplate/mod/particle-math.rb +15 -6
  39. data/lib/deplate/particles.rb +2 -2
  40. data/lib/deplate/regions.rb +50 -15
  41. data/lib/deplate/template.rb +7 -2
  42. data/lib/deplate/themes/presentation.html/css/highstep.css +29 -0
  43. data/lib/deplate/themes/presentation.html/css/presentation.css +206 -0
  44. data/lib/deplate/themes/presentation.html/css/website.css +281 -0
  45. data/lib/deplate/themes/presentation.html/prelude.txt +19 -0
  46. data/lib/deplate/themes/presentation.html/resources/spacer.png +0 -0
  47. data/lib/deplate/themes/presentation.html/templates/presentation.html +26 -0
  48. data/lib/deplate/themes/presentation.html/theme.ini +20 -0
  49. data/man/man1/deplate.1 +147 -73
  50. metadata +67 -40
  51. data/bin/deplate.exy +0 -192
@@ -3,8 +3,8 @@
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 26-Nov-2004.
6
- # @Last Change: 2007-06-30.
7
- # @Revision: 0.352
6
+ # @Last Change: 2008-01-30.
7
+ # @Revision: 0.363
8
8
  #
9
9
  # Description:
10
10
  #
@@ -119,6 +119,14 @@ class Deplate::Formatter::LaTeX::Styles
119
119
  rv
120
120
  end
121
121
 
122
+ def table_tabular_top(rv, invoker)
123
+ rv
124
+ end
125
+
126
+ def table_tabular_bottom(rv, invoker)
127
+ rv
128
+ end
129
+
122
130
  def table_top(rv, invoker, *args)
123
131
  rv
124
132
  end
@@ -193,33 +201,33 @@ end
193
201
  # end
194
202
  # end
195
203
  class Deplate::Formatter::LaTeX::Styles::TableSmall < Deplate::Formatter::LaTeX::Styles
196
- def table_top(rv, invoker, capAbove, rown)
204
+ def table_tabular_top(rv, invoker)
197
205
  "\\small{}\n#{rv}"
198
206
  end
199
- def table_bottom(rv, invoker, capAbove, rown)
200
- "#{rv}\\normalsize{}\n"
207
+ def table_tabular_bottom(rv, invoker)
208
+ "#{rv}\n\\normalsize{}"
201
209
  end
202
210
  def table_caption_text(rv, invoker, *args)
203
211
  "\\normalsize{#{rv}}"
204
212
  end
205
213
  end
206
214
  class Deplate::Formatter::LaTeX::Styles::TableFootnotesize < Deplate::Formatter::LaTeX::Styles
207
- def table_top(rv, invoker, capAbove, rown)
215
+ def table_tabular_top(rv, invoker)
208
216
  "\\footnotesize{}\n#{rv}"
209
217
  end
210
- def table_bottom(rv, invoker, capAbove, rown)
211
- "#{rv}\\normalsize{}\n"
218
+ def table_tabular_bottom(rv, invoker)
219
+ "#{rv}\n\\normalsize{}"
212
220
  end
213
221
  def table_caption_text(rv, invoker, *args)
214
222
  "\\normalsize{#{rv}}"
215
223
  end
216
224
  end
217
225
  class Deplate::Formatter::LaTeX::Styles::TableScriptsize < Deplate::Formatter::LaTeX::Styles
218
- def table_top(rv, invoker, capAbove, rown)
226
+ def table_tabular_top(rv, invoker)
219
227
  "\\scriptsize{}\n#{rv}"
220
228
  end
221
- def table_bottom(rv, invoker, capAbove, rown)
222
- "#{rv}\\normalsize{}\n"
229
+ def table_tabular_bottom(rv, invoker)
230
+ "#{rv}\n\\normalsize{}"
223
231
  end
224
232
  def table_caption_text(rv, invoker, *args)
225
233
  "\\normalsize{#{rv}}"
@@ -408,6 +416,7 @@ class Deplate::Formatter::LaTeX
408
416
  @style_engines = {
409
417
  :default => Deplate::Formatter::LaTeX::Styles.new(@deplate),
410
418
  }
419
+ @format_advice_backlist += [:format_table]
411
420
 
412
421
  table_agents = [
413
422
  :format_table, :table_args,
@@ -418,6 +427,7 @@ class Deplate::Formatter::LaTeX
418
427
  :table_horizontal_ruler, :table_horizontal_ruler_from_to,
419
428
  :table_longtable_top, :table_longtable_bottom,
420
429
  :table_table_bottom, :table_table_top, :table_top,
430
+ :table_tabular_top, :table_tabular_bottom,
421
431
  :tabular_col_widths, :tabular_col_justifications, :tabular_vertical_rulers,
422
432
  :table_indented_row,
423
433
  ]
@@ -3,8 +3,8 @@
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 28-Aug-2005.
6
- # @Last Change: 2007-07-17.
7
- # @Revision: 0.164
6
+ # @Last Change: 2008-04-13.
7
+ # @Revision: 0.168
8
8
  #
9
9
  # = Description
10
10
  # Create a standard makefile.
@@ -60,11 +60,15 @@ OTHER=#{files.join(' ') if files}
60
60
 
61
61
  DEPLATE=deplate
62
62
 
63
+ OFLAGS=
63
64
  DFLAGS=#{options.join(' ')}
64
65
 
65
66
  HTML_DIR=html
66
67
  HTML_DFLAGS=-d ${HTML_DIR} -f html
67
68
 
69
+ XHTML_DIR=html
70
+ XHTML_DFLAGS=-d ${XHTML_DIR} -f xhtml10t
71
+
68
72
  WEBSITE_DIR=website
69
73
  WEBSITE_DFLAGS=-d ${WEBSITE_DIR} -f htmlsite
70
74
 
@@ -93,8 +97,9 @@ all: dbk html pdf tex text man
93
97
  dvi: ${BASE}.dvi
94
98
  dbk: ${BASE}.dbk
95
99
  html: ${BASE}.html
100
+ xhtml: ${BASE}.xhtml
96
101
  pdf:
97
- make DFLAGS="${DFLAGS} --pdf" "${BASE}.pdf"
102
+ make DFLAGS="${DFLAGS} ${OFLAGS} --pdf" "${BASE}.pdf"
98
103
  php: ${BASE}.php
99
104
  tex: ${BASE}.tex
100
105
  text: ${BASE}.text
@@ -104,41 +109,46 @@ pdfclean: pdf cleantex
104
109
  dviclean: dvi cleantex
105
110
 
106
111
  makefile:
107
- ${DEPLATE} -m makefile ${DFLAGS} ${BASE}#{suffix} ${OTHER}
112
+ ${DEPLATE} -m makefile ${DFLAGS} ${OFLAGS} ${BASE}#{suffix} ${OTHER}
108
113
 
109
114
  website:
110
115
  make prepare_website
111
- ${DEPLATE} ${DFLAGS} ${WEBSITE_DFLAGS} ${FILE} ${OTHER}
116
+ ${DEPLATE} ${DFLAGS} ${OFLAGS} ${WEBSITE_DFLAGS} ${FILE} ${OTHER}
112
117
  echo ${WEBSITE_DIR}/${BASE}.html > .last_output
113
118
 
114
119
  %.html: %#{suffix}
115
120
  make prepare_html
116
- ${DEPLATE} ${DFLAGS} ${HTML_DFLAGS} $< ${OTHER}
121
+ ${DEPLATE} ${DFLAGS} ${OFLAGS} ${HTML_DFLAGS} $< ${OTHER}
117
122
  echo ${HTML_DIR}/$@ > .last_output
118
123
 
124
+ %.xhtml: %#{suffix}
125
+ make prepare_xhtml
126
+ ${DEPLATE} ${DFLAGS} ${OFLAGS} ${XHTML_DFLAGS} $< ${OTHER}
127
+ echo ${XHTML_DIR}/$@ > .last_output
128
+
119
129
  %.text: %#{suffix}
120
130
  make prepare_text
121
- ${DEPLATE} ${DFLAGS} ${TEXT_DFLAGS} $< ${OTHER}
131
+ ${DEPLATE} ${DFLAGS} ${OFLAGS} ${TEXT_DFLAGS} $< ${OTHER}
122
132
  echo ${TEXT_DIR}/$@ > .last_output
123
133
 
124
134
  %.php: %#{suffix}
125
135
  make prepare_php
126
- ${DEPLATE} ${DFLAGS} ${PHP_DFLAGS} $< ${OTHER}
136
+ ${DEPLATE} ${DFLAGS} ${OFLAGS} ${PHP_DFLAGS} $< ${OTHER}
127
137
  echo ${PHP_DIR}/$@ > .last_output
128
138
 
129
139
  %.dbk: %#{suffix}
130
140
  make prepare_dbk
131
- ${DEPLATE} ${DFLAGS} ${DBK_DFLAGS} $< ${OTHER}
141
+ ${DEPLATE} ${DFLAGS} ${OFLAGS} ${DBK_DFLAGS} $< ${OTHER}
132
142
  echo ${DBK_DIR}/$@ > .last_output
133
143
 
134
144
  %.tex: %#{suffix}
135
145
  make prepare_tex
136
- ${DEPLATE} ${DFLAGS} ${TEX_DFLAGS} $< ${OTHER}
146
+ ${DEPLATE} ${DFLAGS} ${OFLAGS} ${TEX_DFLAGS} $< ${OTHER}
137
147
  echo ${TEX_DIR}/$@ > .last_output
138
148
 
139
149
  %.ref: %#{suffix}
140
150
  make prepare_ref
141
- ${DEPLATE} ${DFLAGS} ${REF_DFLAGS} -o $@ $< ${OTHER}
151
+ ${DEPLATE} ${DFLAGS} ${OFLAGS} ${REF_DFLAGS} -o $@ $< ${OTHER}
142
152
  echo ${REF_DIR}/$@ > .last_output
143
153
 
144
154
  %.dvi: %.tex
@@ -3,8 +3,8 @@
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 03-Okt-2004.
6
- # @Last Change: 23-Okt-2005.
7
- # @Revision: 0.12
6
+ # @Last Change: 2007-11-11.
7
+ # @Revision: 0.13
8
8
 
9
9
  class Deplate::Particle::Emphasize < Deplate::SimpleParticle
10
10
  @rx = /^\*\*(.+?)\*\*/
@@ -34,7 +34,7 @@ class Deplate::Macro::Emphasize < Deplate::Macro::FormattedText
34
34
  @@macros["*"] = self
35
35
  end
36
36
 
37
- class Deplate::Macro::Code < Deplate::Macro::FormattedText
37
+ class Deplate::Macro::Code
38
38
  @@macros.delete("'")
39
39
  @@macros["="] = self
40
40
  end
@@ -3,18 +3,22 @@
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 25-M�r-2005.
6
- # @Last Change: 12-Nov-2005.
7
- # @Revision: 0.20
6
+ # @Last Change: 2008-04-14.
7
+ # @Revision: 0.30
8
8
  #
9
9
  # = Description
10
- # This provides a math markup as known from LaTeX: $\latexmarkup$
10
+ # This provides a math markup as known from LaTeX:
11
+ # $\latexmarkup$
12
+ #
13
+ # Support block markup for formulas via: $$\latexmarkup$$
14
+
11
15
 
12
16
  class Deplate::Particle::Math < Deplate::Particle
13
17
  register_particle
14
- set_rx(/^\$(\S.*?)\$/)
18
+ set_rx(/^(\$\$?)(\S.*?)(\$\$?)/)
15
19
 
16
20
  def setup
17
- @proxy = Deplate::Macro::Math.new(@deplate, @container, @context, {}, @alt, get_text)
21
+ @proxy = Deplate::Macro::Math.new(@deplate, @container, @context, {'block' => is_block?}, @alt, get_text)
18
22
  end
19
23
 
20
24
  def process
@@ -22,10 +26,15 @@ class Deplate::Particle::Math < Deplate::Particle
22
26
  end
23
27
 
24
28
  def get_text
25
- @match[1]
29
+ return @match[2]
30
+ end
31
+
32
+ def is_block?
33
+ return @match[1] == '$$'
26
34
  end
27
35
  end
28
36
 
37
+
29
38
  class Deplate::Core
30
39
  def hook_late_require_particle_math
31
40
  register_particle(Deplate::Particle::Math)
@@ -3,8 +3,8 @@
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 24-M�r-2004.
6
- # @Last Change: 2007-09-29.
7
- # @Revision: 0.1922
6
+ # @Last Change: 2008-07-06.
7
+ # @Revision: 0.1925
8
8
 
9
9
  require "uri"
10
10
  require "deplate/common"
@@ -3,8 +3,8 @@
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 08-Mai-2004.
6
- # @Last Change: 2007-09-30.
7
- # @Revision: 0.1752
6
+ # @Last Change: 2008-07-06.
7
+ # @Revision: 0.1770
8
8
 
9
9
  # Description:
10
10
  #
@@ -290,15 +290,28 @@ class Deplate::Regions::Code < Deplate::Regions::Native
290
290
  @@code_idx = 0
291
291
  @general_highlighter = {}
292
292
  @syntax_highlighter = {}
293
+ @options = Hash.new {|h, k| h[k] = {}}
293
294
 
294
295
  class << self
295
- attr_reader :syntax_highlighter, :general_highlighter
296
+ attr_reader :syntax_highlighter, :general_highlighter, :options
297
+
298
+ def highlighter_option(agent, options)
299
+ @options[agent].merge!(options)
300
+ end
301
+
296
302
  def add_highlighter(syntax, format, agent)
297
- if syntax
298
- @syntax_highlighter[syntax] ||= []
299
- @syntax_highlighter[syntax] << [format, agent]
303
+ case syntax
304
+ when Array
305
+ syntax.each do |syn|
306
+ add_highlighter(syn, format, agent)
307
+ end
300
308
  else
301
- @general_highlighter[format] = agent
309
+ if syntax
310
+ @syntax_highlighter[syntax] ||= []
311
+ @syntax_highlighter[syntax] << [format, agent]
312
+ else
313
+ @general_highlighter[format] = agent
314
+ end
302
315
  end
303
316
  end
304
317
  end
@@ -324,8 +337,8 @@ class Deplate::Regions::Code < Deplate::Regions::Native
324
337
  end
325
338
  if @syntax
326
339
  e = nil
340
+ fmt_name = @deplate.formatter.formatter_name
327
341
  @deplate.in_working_dir do
328
- fmt_name = @deplate.formatter.formatter_name
329
342
  id = @args['id']
330
343
  if id
331
344
  id.gsub!(/\W/, '00')
@@ -337,16 +350,37 @@ class Deplate::Regions::Code < Deplate::Regions::Native
337
350
  fcode = @deplate.auxiliary_filename(@deplate.auxiliary_auto_filename('code', @@code_idx, @elt, @syntax))
338
351
  fout = @deplate.auxiliary_filename(@deplate.auxiliary_auto_filename('code', @@code_idx, @elt, fmt_name))
339
352
  end
353
+
354
+ # highlighter_agent = nil
355
+ # specialized_highlighter = self.class.syntax_highlighter[@syntax]
356
+ # if specialized_highlighter
357
+ # specialized_highlighter.each do |fmt, agent|
358
+ # if @deplate.formatter.matches?(fmt)
359
+ # highlighter_agent = agent
360
+ # break
361
+ # end
362
+ # end
363
+ # end
364
+ # unless highlighter_agent
365
+ # highlighter_agent = self.class.general_highlighter[fmt_name]
366
+ # end
367
+ # unless highlighter_agent
368
+ # log(['No highlighter defined', fmt_name], :error)
369
+ # return self
370
+ # end
371
+
340
372
  if Deplate::Region.check_file(self, fout, fcode, @elt)
341
373
  log(["Files exist! Using", fout], :anyway)
342
374
  File.open(fout) {|io| @elt = io.readlines.collect {|l| l.chomp}}
343
375
  return self
344
376
  else
377
+ highlighter_agent = nil
345
378
  begin
346
379
  specialized_highlighter = self.class.syntax_highlighter[@syntax]
347
380
  if specialized_highlighter
348
381
  specialized_highlighter.each do |fmt, agent|
349
382
  if @deplate.formatter.matches?(fmt)
383
+ highlighter_agent = agent
350
384
  e = send(agent, @syntax, @style, text)
351
385
  # p "DBG Code 1 #{e.class}"
352
386
  break if e
@@ -354,14 +388,15 @@ class Deplate::Regions::Code < Deplate::Regions::Native
354
388
  end
355
389
  end
356
390
  unless e
357
- agent = self.class.general_highlighter[fmt_name]
391
+ highlighter_agent = agent = self.class.general_highlighter[fmt_name]
358
392
  e = send(agent, @syntax, @style, text) if agent
359
393
  # p "DBG Code 2 #{e.class}"
360
394
  end
361
- rescue StandardError => e
362
- log("#Code: #{e}", :error)
395
+ rescue StandardError => err
396
+ log("#Code: #{err}", :error)
363
397
  end
364
- if e
398
+ # p "DBG", highlighter_agent, self.class.options[highlighter_agent], self.class.options[highlighter_agent][:no_cache]
399
+ if e and !self.class.options[highlighter_agent][:no_cache]
365
400
  File.open(fcode, "w") {|io| io.puts(text)} if fcode
366
401
  File.open(fout, "w") {|io| io.puts(e)} if fout
367
402
  end
@@ -861,7 +896,7 @@ class Deplate::Regions::R < Deplate::Region
861
896
  mode = :pre
862
897
  for l in @accum
863
898
  xtable_postprocess_text(l)
864
- m = /^\<([^> ]+).*?\>(.*)?(\<\/(\S+)\>)?$/.match(l)
899
+ m = /^\s*\<([^> ]+).*?\>(.*)?(\<\/(\S+)\>)?\s*$/.match(l)
865
900
  if m
866
901
  case m[1]
867
902
  when "!--"
@@ -871,11 +906,11 @@ class Deplate::Regions::R < Deplate::Region
871
906
  when "/TABLE"
872
907
  mode = :post
873
908
  when "TR"
874
- row = l.scan(/\<TH.*?\>(\s+.*?)\<\/TH\>/).flatten
909
+ row = l.scan(/\<TH.*?\>\s*(.*?)\s*<\/TH\>/).flatten
875
910
  unless row.empty?
876
911
  table << "|| #{row.join(" || ")} ||"
877
912
  else
878
- row = l.scan(/\<TD.*?\>(\s+.*?)\<\/TD\>/).flatten
913
+ row = l.scan(/\<TD.*?\>\s*(.*?)\s*\<\/TD\>/).flatten
879
914
  table << "| #{row.join(" | ")} |" unless row.empty?
880
915
  end
881
916
  log(["R xtable: row", row], :debug)
@@ -3,8 +3,8 @@
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 10-Aug-2004.
6
- # @Last Change: 2007-09-28.
7
- # @Revision: 0.550
6
+ # @Last Change: 2008-07-06.
7
+ # @Revision: 0.560
8
8
  #
9
9
  # Description:
10
10
  #
@@ -124,13 +124,17 @@ class Deplate::Template
124
124
  'DOC' => Deplate::Command::VAR,
125
125
  'VAR' => Deplate::Command::VAR,
126
126
  'OPT' => Deplate::Command::OPT,
127
+ 'PROP' => Deplate::Command::OPT,
128
+ 'PP' => Deplate::Command::OPT,
127
129
  'PREMATTER' => Deplate::Command::PREMATTER,
128
130
  'POSTMATTER' => Deplate::Command::POSTMATTER,
129
131
  'BODY' => Deplate::Command::BODY,
132
+ 'WITH' => Deplate::Command::WITH,
130
133
  },
131
134
 
132
135
  :regions => {
133
136
  'Foreach' => Deplate::Regions::Foreach,
137
+ 'For' => Deplate::Regions::Foreach,
134
138
  'Mingle' => Deplate::Regions::Mingle,
135
139
  'Native' => Deplate::Regions::Native,
136
140
  'Ruby' => Deplate::Regions::Ruby,
@@ -156,6 +160,7 @@ class Deplate::Template
156
160
  'doc' => Deplate::Macro::Var,
157
161
  'ruby' => Deplate::Macro::Ruby,
158
162
  'msg' => Deplate::Macro::Msg,
163
+ 'date' => Deplate::Macro::Date,
159
164
  },
160
165
  }
161
166
 
@@ -0,0 +1,29 @@
1
+ body {
2
+ /* font-family: Georgia, Bookman, Times, Serif; */
3
+ font-family: Georgia, Minion Web, Palatino, "Book Antiqua", Utopia, "Times New Roman", serif;
4
+ /* font-size-adjust: .5; */
5
+ font-size: 14px;
6
+ line-height: 1.36em
7
+ }
8
+
9
+ span.steppreview {
10
+ background-color: #f5f5f5;
11
+ /* padding: 1px; */
12
+ /* border: 1px solid #e0e0e0; */
13
+ border: 1px solid #f0f0f0;
14
+ }
15
+
16
+ span.stephighlight {
17
+ background-color: #ffff60;
18
+ /* padding: 1px; */
19
+ border: 1px solid #e0e0e0;
20
+ }
21
+
22
+ span.steplast {
23
+ background-color: #ffff90;
24
+ border: 1px solid #e0540e;
25
+ }
26
+
27
+ /*
28
+ vi: ft=css:tw=72:ts=4
29
+ */