docgenerator 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/examples/creole_example.rb +0 -1
- data/examples/creole_example_new_plugin.rb +51 -0
- data/examples/creole_example_tabular.rb +3 -1
- data/examples/wiki2docgenerator_example.rb +2 -2
- data/lib/creole/creole2doc.rb +697 -680
- data/lib/creole/creole_characters.rb +90 -26
- data/lib/creole/creole_inclusion_and_plugins.rb +25 -43
- data/lib/creole/creole_inclusions.rb +87 -75
- data/lib/creole/creole_placeholder.rb +87 -89
- data/lib/creole/creole_plugins.rb +149 -117
- data/lib/creole/creole_tabular.rb +247 -141
- data/lib/creole/plugins/todonotes.rb +48 -48
- data/lib/docgenerator/characters.rb +106 -8
- data/lib/docgenerator/compatibility_v1.rb +7 -1
- data/lib/docgenerator/document.rb +34 -19
- data/lib/docgenerator/element.rb +1 -0
- data/lib/docgenerator/element_meta.rb +1 -1
- data/lib/docgenerator/elements.rb +594 -535
- data/lib/docgenerator/environments.rb +131 -99
- data/lib/docgenerator/index.rb +110 -0
- data/lib/docgenerator/lists.rb +2 -1
- data/lib/docgenerator/packages/caption.rb +32 -34
- data/lib/docgenerator/packages/hyperref.rb +1 -0
- data/lib/docgenerator/packages/multicol.rb +3 -2
- data/lib/docgenerator/packages/pdfpages.rb +71 -20
- data/lib/docgenerator/packages/scrpage2.rb +99 -142
- data/lib/docgenerator/packages/url.rb +75 -81
- data/lib/docgenerator/sections.rb +98 -98
- data/lib/docgenerator/standard.rb +8 -1
- data/lib/docgenerator/tabular.rb +44 -25
- data/lib/docgenerator/templates/docgenerator_template.yaml +28 -0
- data/lib/docgenerator/version.rb +146 -0
- data/lib/docgenerator.rb +20 -15
- data/meta_test_and_doc/build_doc.rb +39 -10
- data/meta_test_and_doc/build_test.rb +34 -12
- data/meta_test_and_doc/manpages/characters.rb +452 -20
- data/meta_test_and_doc/manpages/elementlist.rb +304 -0
- data/meta_test_and_doc/manpages/elements.rb +305 -42
- data/meta_test_and_doc/manpages/others.rb +403 -0
- data/meta_test_and_doc/manpages/pdfpages.rb +117 -18
- data/meta_test_and_doc/manpages/readme.rdoc +3 -1
- data/meta_test_and_doc/manpages/scrpage2.rb +0 -80
- data/meta_test_and_doc/manpages/tables.rb +6 -6
- data/readme.rdoc +11 -120
- data/unittest/expected/test_comment.html +1 -0
- data/unittest/expected/test_comment.latex +5 -0
- data/unittest/expected/test_comment_complex.html +3 -0
- data/unittest/expected/test_comment_complex.latex +15 -0
- data/unittest/expected_creole/test_creole_characters_all.html +6 -5
- data/unittest/expected_creole/test_creole_characters_all.latex +10 -8
- data/unittest/expected_creole/test_creole_creole1.0test.latex +5 -5
- data/unittest/expected_creole/test_creole_input.normsource +11 -9
- data/unittest/expected_creole/test_creole_list_ul.normsource +57 -51
- data/unittest/expected_creole/test_creole_list_ulul_without_ul.html +6 -0
- data/unittest/expected_creole/test_creole_list_ulul_without_ul.latex +12 -0
- data/unittest/expected_creole/test_creole_paragraphs.normsource +12 -10
- data/unittest/expected_creole/test_creole_pictures.latex +2 -2
- data/unittest/expected_creole/test_creole_pictures_css.latex +2 -2
- data/unittest/expected_creole/test_creole_pictures_imgclass.latex +2 -2
- data/unittest/expected_creole/test_creole_pictures_width.latex +1 -1
- data/unittest/expected_creole/test_creole_tabular.latex +3 -3
- data/unittest/expected_creole/test_creole_tabular_creole.latex +2 -2
- data/unittest/expected_creole/test_creole_tabular_css.latex +3 -3
- data/unittest/expected_creole/test_creole_tabular_row_parameters.latex +22 -0
- data/unittest/expected_templates/test_standalone.tex +34 -0
- data/unittest/expected_wikimedia/test_wiki_picture.latex +12 -12
- data/unittest/unittest_creole.rb +22 -3
- data/unittest/unittest_creole_tabular.rb +34 -1
- data/unittest/unittest_docgenerator.rb +46 -3
- data/unittest/unittest_docgenerator_characters.rb +527 -82
- data/unittest/unittest_templates.rb +1 -1
- metadata +149 -108
@@ -1,21 +1,9 @@
|
|
1
1
|
#encoding: UTF-8
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
- .* = (.*): Used for CSS
|
8
|
-
newline-options
|
9
|
-
- toprule
|
10
|
-
- midrule
|
11
|
-
- hline
|
12
|
-
- .* = (.*): Used for CSS
|
13
|
-
lineoptions:
|
14
|
-
- colspan =
|
15
|
-
- pos
|
16
|
-
- .* = (.*): Used for CSS
|
17
|
-
fixme
|
18
|
-
|
3
|
+
if $0 == __FILE__ #for immediate tests
|
4
|
+
$:.unshift('..')
|
5
|
+
require 'creole/creole2doc.rb'
|
6
|
+
end
|
19
7
|
|
20
8
|
module Docgenerator
|
21
9
|
module Creole
|
@@ -74,7 +62,6 @@ Usage:
|
|
74
62
|
content.each{|line|
|
75
63
|
@tab << row = element(:row).cr
|
76
64
|
line.each{|cell|
|
77
|
-
#fixme cell to wiki/creole
|
78
65
|
row << element(cell.type,{}, cell.content).cr
|
79
66
|
}
|
80
67
|
}
|
@@ -117,11 +104,30 @@ You can add additional settings to cells:
|
|
117
104
|
|||class=empty
|
118
105
|
>>>
|
119
106
|
=end
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
107
|
+
class Creole_tabular < Placeholder
|
108
|
+
set_placeholder_key 'tabular'
|
109
|
+
|
110
|
+
#Define a container for cells
|
111
|
+
class Row
|
112
|
+
#Flag for hline
|
113
|
+
attr_accessor :hline
|
114
|
+
#Flag for toprule
|
115
|
+
attr_accessor :toprule
|
116
|
+
#Flag for midrule
|
117
|
+
attr_accessor :midrule
|
118
|
+
#Add a cell to a row
|
119
|
+
def << (cell)
|
120
|
+
@cells = [] unless @cells
|
121
|
+
@cells << cell
|
122
|
+
end
|
123
|
+
def each
|
124
|
+
@cells.each{|cell| yield cell }
|
125
|
+
end
|
126
|
+
#Return number of cells
|
127
|
+
def size; @cells.size; end
|
128
|
+
end
|
129
|
+
#Extend the class by a little structure
|
130
|
+
class Cell
|
125
131
|
=begin rdoc
|
126
132
|
The content of a cell is separated from settings by two ||
|
127
133
|
|
@@ -132,148 +138,246 @@ Supported additional settings:
|
|
132
138
|
* class= define HTML-class
|
133
139
|
* title= define a title (results in popup during mouse-over)
|
134
140
|
=end
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
141
|
+
def initialize( content, type, wiki, local_options )
|
142
|
+
@content, options = content.split(/\|\|/,2)
|
143
|
+
@content = '' unless @content #just in case of empty content
|
144
|
+
@options = {}
|
145
|
+
options.split(/\|/).each{|option|
|
146
|
+
case option
|
147
|
+
when /class\s*=\s*/
|
148
|
+
@options[:class] = $~.post_match
|
149
|
+
when /css\s*=\s*/
|
150
|
+
@options[:style] = $~.post_match
|
151
|
+
when /title\s*=\s*/
|
152
|
+
@options[:title] = $~.post_match
|
153
|
+
when /pos\s*=\s*/ #only for multicol
|
154
|
+
@options[:pos] = $~.post_match
|
155
|
+
when /columns\s*=\s*/
|
156
|
+
wiki.log.debug("Creole_tabular::Cell #{type} converted to multicol")
|
157
|
+
type = :multicolumn #loose th/td-information -- fixme
|
158
|
+
@options[:colspan] = $~.post_match.to_i
|
159
|
+
when '' #ignore them
|
160
|
+
else
|
161
|
+
wiki.log.warn("Creole_tabular::Cell: Undefined option #{option.inspect}")
|
162
|
+
end
|
163
|
+
} if options
|
164
|
+
@type = type #:td or :th
|
165
|
+
@wiki = wiki
|
166
|
+
@local_options = local_options
|
167
|
+
end
|
168
|
+
#Return the content as a element.
|
169
|
+
def cell_element()
|
170
|
+
element(@type,@options, @wiki.inline(@content, @local_options)).cr
|
171
|
+
end
|
172
|
+
end #class Cell
|
173
|
+
|
174
|
+
#Build the tabular.
|
175
|
+
def close()
|
176
|
+
#~ fixme:
|
177
|
+
#~ *CSS-format
|
178
|
+
#~ *generelle def
|
179
|
+
|
180
|
+
step = 0 #start
|
181
|
+
head = []
|
182
|
+
content = [Row.new]
|
183
|
+
|
184
|
+
options = { :log => @log }
|
185
|
+
local_options = {
|
186
|
+
:log => @log,
|
187
|
+
:inclusions => @wiki.inclusions,
|
188
|
+
:plugins => @wiki.plugins.dup
|
189
|
+
}
|
190
|
+
#No footnotes inside tabulars
|
191
|
+
local_options[:plugins].delete('footnote')
|
192
|
+
local_options[:plugins].delete('footnotes')
|
193
|
+
|
194
|
+
tab_css = CSS.new( :log => @log )
|
195
|
+
@source.each{|cell|
|
196
|
+
case cell
|
197
|
+
when /^\|!/ #generell cell definition
|
198
|
+
case $~.post_match().strip
|
199
|
+
when /columns\s*=\s*(.*)/
|
200
|
+
options[:columns] = $1.to_i
|
201
|
+
when /border\s*=\s*(.*)/
|
202
|
+
options[:border] = $1
|
203
|
+
when /columndescription\s*=\s*(.*)/
|
204
|
+
options[:columndescription] = $1
|
205
|
+
when /css\s*=\s*(.*)\s*:\s*(.*)/
|
206
|
+
tab_css[$1] = $2
|
207
|
+
when '' #
|
208
|
+
else
|
209
|
+
@log.warn("#{self}: Unknown tabular option #{$1}") if @log.warn?
|
210
|
+
end
|
211
|
+
when /^\|-(.*)/ #new line
|
212
|
+
if $1 #there are options for the row
|
213
|
+
$1.split(/\|/).each{|option|
|
214
|
+
case option
|
215
|
+
when /hline/; content.last.hline = true
|
216
|
+
when /toprule/; content.last.toprule = true
|
217
|
+
when /midrule/; content.last.midrule = true
|
218
|
+
when /\A\s*\Z/, nil
|
219
|
+
else
|
220
|
+
@log.warn("#{self}: Unknown row option #{option.inspect}") if @log.warn?
|
221
|
+
end
|
222
|
+
}
|
223
|
+
end
|
224
|
+
content << Row.new #Start new row
|
225
|
+
when /^\|=/ #header cell
|
226
|
+
#~ content.last << Cell.new(@wiki.inline($~.post_match.strip, local_options), :th)
|
227
|
+
content.last << Cell.new($~.post_match.strip, :th, @wiki, local_options)
|
228
|
+
when /^\|/ #content of a cell
|
229
|
+
#~ content.last << Cell.new(@wiki.inline($~.post_match.strip, local_options), :td)
|
230
|
+
content.last << Cell.new($~.post_match.strip, :td, @wiki, local_options)
|
231
|
+
else #error!
|
232
|
+
raise "cell/log-warning in #{cell.inspect}"
|
156
233
|
end
|
157
|
-
}
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
234
|
+
}
|
235
|
+
|
236
|
+
max_size = 0
|
237
|
+
content.each{|line|
|
238
|
+
max_size = [max_size, line.size].max
|
239
|
+
}
|
240
|
+
|
241
|
+
if options[:columns] and options[:columns] < max_size
|
242
|
+
@log.warn("Creole-tabular: Defined size #{options[:columns]} < no of columns (#{max_size})") if @log.warn?
|
243
|
+
end
|
244
|
+
|
245
|
+
if self.is_a?(Docgenerator::Creole::Creole_longtable)
|
246
|
+
@tab = element(:longtable, { :style => tab_css,
|
247
|
+
}.merge(options) ).cR
|
248
|
+
#~ elsif self.is_a?(Docgenerator::Creole::Creole_supertabular) #Not supported
|
249
|
+
#~ @tab = element(:supertabular, { :style => tab_css,
|
250
|
+
#~ }.merge(options) ).cR
|
251
|
+
elsif self.is_a?(Docgenerator::Creole::Creole_tabular)
|
252
|
+
@tab = element(:tabular, { :style => tab_css,
|
253
|
+
}.merge(options) ).cR
|
254
|
+
else
|
255
|
+
raise ArgumentError, "Unsupported tabular-class #{self.class}"
|
256
|
+
end
|
257
|
+
|
258
|
+
content.each{|line|
|
259
|
+
@tab << row = element(:row).cr
|
260
|
+
row.hline if line.hline
|
261
|
+
row.toprule if line.toprule
|
262
|
+
row.midrule if line.midrule
|
263
|
+
line.each{|cell|
|
264
|
+
row << cell.cell_element.cr
|
265
|
+
}
|
266
|
+
}
|
267
|
+
end
|
268
|
+
def to_doc( target, options = {})
|
269
|
+
@tab.to_doc( target, options )
|
165
270
|
end
|
166
|
-
end #
|
271
|
+
end #Creole_tabular
|
272
|
+
|
273
|
+
class Creole_longtable < Creole_tabular
|
274
|
+
set_placeholder_key 'longtable'
|
275
|
+
end
|
167
276
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
when /^\|=/ #header cell
|
208
|
-
#~ content.last << Cell.new(@wiki.inline($~.post_match.strip, local_options), :th)
|
209
|
-
content.last << Cell.new($~.post_match.strip, :th, @wiki, local_options)
|
210
|
-
when /^\|/ #content of a cell
|
211
|
-
#~ content.last << Cell.new(@wiki.inline($~.post_match.strip, local_options), :td)
|
212
|
-
content.last << Cell.new($~.post_match.strip, :td, @wiki, local_options)
|
213
|
-
else #error!
|
214
|
-
raise "cell/log-warning in #{cell.inspect}"
|
277
|
+
#~ class Creole_supertabular < Creole_tabular ##Not supported
|
278
|
+
#~ set_placeholder_key 'supertabular'
|
279
|
+
#~ end
|
280
|
+
=begin rdoc
|
281
|
+
This class needs the CSV-package (the user is responsible to load it).
|
282
|
+
|
283
|
+
The LaTeX document needs the booktabs-package
|
284
|
+
|
285
|
+
Options:
|
286
|
+
* headers=false: Firest line contains headers (default: true)
|
287
|
+
* format or columndescription: LaTeX header description
|
288
|
+
|
289
|
+
Fixmes:
|
290
|
+
* More parameters:
|
291
|
+
** toprule, hline,
|
292
|
+
** Other table (supertabular...)
|
293
|
+
* Bug: CSV without header returns Array of array
|
294
|
+
|
295
|
+
=end
|
296
|
+
class Creole_tabular_csv < Placeholder
|
297
|
+
set_placeholder_key 'tabular_csv'
|
298
|
+
def to_doc( target, options = {})
|
299
|
+
if ! defined? CSV
|
300
|
+
@log.fatal("tabular_csv needs CSV-package")
|
301
|
+
raise "tabular_csv needs CSV-package"
|
302
|
+
end
|
303
|
+
@log.fatal("tabular_csv needs parameters (format, col_sep)") unless @parameters.respond_to? :split
|
304
|
+
columndescription = nil
|
305
|
+
headers = true #first CSV-line contains
|
306
|
+
colsep = ';'
|
307
|
+
@parameters.split(/[|;]/).each{|parameter|
|
308
|
+
case parameter
|
309
|
+
when /headers=false/; headers = false
|
310
|
+
when /(format|columndescription)=(.*)/; columndescription = $2
|
311
|
+
#Some separator get a name. This is made especially, of the separator is also used as parameter separator.
|
312
|
+
when /(col_sep)=(.*)/; colsep = {'semicolon' => ';', 'tab' => "\t", 'bar' => '|'}[$2] || $2
|
313
|
+
@log.warn("tabular_csv with undefined separator (use semicolon, tab or bar)" % parameter) unless colsep
|
314
|
+
else
|
315
|
+
@log.warn("tabular_csv with unknown option %s" % parameter)
|
215
316
|
end
|
216
|
-
}
|
217
|
-
|
218
|
-
max_size = 0
|
219
|
-
content.each{|line|
|
220
|
-
max_size = [max_size, line.size].max
|
221
|
-
}
|
222
|
-
|
223
|
-
if options[:columns] and options[:columns] < max_size
|
224
|
-
@log.warn("Creole-tabular: Defined size #{options[:columns]} < no of columns (#{max_size})") if @log.warn?
|
225
|
-
end
|
226
|
-
|
227
|
-
if self.is_a?(Docgenerator::Creole::Creole_longtable)
|
228
|
-
@tab = element(:longtable, { :style => tab_css,
|
229
|
-
}.merge(options) ).cR
|
230
|
-
elsif self.is_a?(Docgenerator::Creole::Creole_tabular)
|
231
|
-
@tab = element(:tabular, { :style => tab_css,
|
232
|
-
}.merge(options) ).cR
|
233
|
-
else
|
234
|
-
raise ArgumentError, "Unsupported tabular-class #{self.class}"
|
235
|
-
end
|
236
|
-
|
237
|
-
content.each{|line|
|
238
|
-
@tab << row = element(:row).cr
|
239
|
-
line.each{|cell|
|
240
|
-
row << cell.cell_element.cr
|
241
317
|
}
|
242
|
-
}
|
243
|
-
end
|
244
|
-
def to_doc( target, options = {})
|
245
|
-
@tab.to_doc( target, options )
|
246
|
-
end
|
247
|
-
end #Creole_tabular
|
248
318
|
|
249
|
-
|
250
|
-
|
251
|
-
|
319
|
+
csv = CSV.parse(@source.join, :col_sep => colsep, :headers => true)
|
320
|
+
if ! columndescription
|
321
|
+
columndescription = 'c' * csv.headers.size
|
322
|
+
@log.warn("tabular_csv without LaTeX columndescription. Use %s" % columndescription)
|
323
|
+
end
|
324
|
+
tab = element(:tabular, { :columns => csv.headers.size, :columndescription => columndescription }).cR
|
325
|
+
tab << row = element(:row).cr.toprule
|
326
|
+
csv.headers.each{|title|row << element(:th,{}, title) }
|
327
|
+
csv.each{|line|
|
328
|
+
tab << row = element(:row).cr
|
329
|
+
line.each{|cell|
|
330
|
+
row << element(:td,{}, cell.last)
|
331
|
+
}
|
332
|
+
}
|
333
|
+
tab.to_doc( target, options )
|
334
|
+
end
|
335
|
+
end
|
252
336
|
|
253
337
|
end #module Creole
|
338
|
+
|
254
339
|
end #module Docgenerator
|
255
340
|
|
256
341
|
|
257
342
|
if $0 == __FILE__
|
258
|
-
|
343
|
+
|
344
|
+
creole = Docgenerator::Creole::Creole.new(
|
259
345
|
:name => 'tabular_creole',
|
260
346
|
:content => <<'creole'
|
261
347
|
<<<tabular
|
262
|
-
|
348
|
+
|!columns=3
|
349
|
+
|!columndescription=ccc
|
350
|
+
|=a
|
351
|
+
|=b
|
352
|
+
|=c
|
353
|
+
|-
|
354
|
+
|a
|
355
|
+
|b
|
356
|
+
|c
|
263
357
|
>>>
|
264
358
|
creole
|
265
359
|
)
|
266
|
-
|
360
|
+
require 'csv'
|
361
|
+
creole = Docgenerator::Creole::Creole.new(
|
362
|
+
:name => 'tabular_creole',
|
363
|
+
:content => <<'creole'
|
364
|
+
<<<tabular_csv|columndescription=rrr|col_sep=semicolon
|
365
|
+
1;2;3
|
366
|
+
yy;yy;yy;
|
367
|
+
xx;xx;xx;
|
368
|
+
>>>
|
369
|
+
creole
|
370
|
+
) #if false
|
371
|
+
|
372
|
+
puts creole.to_html #testcode
|
373
|
+
puts creole.to_latex #testcode
|
267
374
|
end
|
268
375
|
__END__
|
269
376
|
|
270
377
|
class Creole_tabular_cvs
|
271
378
|
include Placeholder
|
272
|
-
|
273
|
-
|
274
|
-
|! implizit columns
|
275
|
-
|! border=1px
|
276
|
-
|= -> th
|
379
|
+
|
380
|
+
<<<tabular_csv|CSV-Options
|
277
381
|
yy;yy;yy;
|
278
382
|
yy;yy;yy;
|
279
383
|
yy;yy;yy;
|
@@ -293,3 +397,5 @@ Die Syntax:
|
|
293
397
|
**hline: Zusätzlicher Trennstrich über der Zeile
|
294
398
|
**toprule, midrule, bottomrule: Zusätzlicher Trennstrich über der Zeile (erfordert booktabs.sty)
|
295
399
|
*|} beendet eine Tabelle
|
400
|
+
|
401
|
+
|
@@ -1,77 +1,77 @@
|
|
1
1
|
require 'docgenerator/packages/todonotes.rb'
|
2
2
|
|
3
3
|
module Docgenerator
|
4
|
-
module Creole
|
4
|
+
module Creole
|
5
5
|
|
6
6
|
=begin rdoc
|
7
7
|
Classes to provide support for the todonotes-package.
|
8
8
|
|
9
9
|
* http://ctan.org/tex-archive/macros/latex/contrib/todonotes/
|
10
10
|
=end
|
11
|
-
module Todo
|
11
|
+
module Todo
|
12
12
|
|
13
|
-
class Creole_todolist < Creole_inclusion_and_plugin
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
13
|
+
class Creole_todolist < Creole_inclusion_and_plugin
|
14
|
+
set_plugin_key('listoftodos') #use <<todo|..>>
|
15
|
+
def to_doc(target, options = {})
|
16
|
+
element(:listoftodos, options).to_doc(target, options)
|
17
|
+
end
|
18
|
+
end
|
19
19
|
=begin rdoc
|
20
20
|
Define a plugin for the todonotes-package.
|
21
21
|
=end
|
22
|
-
class Creole_todo < Creole_inclusion_and_plugin
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
class Creole_todo < Creole_inclusion_and_plugin
|
23
|
+
|
24
|
+
set_plugin_key('todo') #use <<todo|..>>
|
25
|
+
|
26
|
+
#define default options for todonotes. may be redefined for children of this class.
|
27
|
+
def default_options; {}; end
|
28
28
|
|
29
29
|
=begin rdoc
|
30
30
|
Usage:
|
31
31
|
<<todo|what to do|color=red>>
|
32
32
|
=end
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
33
|
+
def initialize( inclusionname, description, options, wiki )
|
34
|
+
#~ @inclusionname = inclusionname #fix 'todo'
|
35
|
+
@description = description
|
36
|
+
@options = default_options.dup
|
37
|
+
options.each{|opt|
|
38
|
+
case opt
|
39
|
+
when /color\s*=\s*/
|
40
|
+
@options[:color] = $~.post_match
|
41
|
+
when /inline/
|
42
|
+
@options[:inline] = true
|
43
|
+
else
|
44
|
+
wiki.log.warn("Todo #{@description} with undefined option #{opt}")
|
45
|
+
end
|
46
|
+
}
|
47
|
+
@wiki = wiki
|
48
|
+
|
49
|
+
raise "Inclusion received no wiki but #{wiki.inspect}" unless wiki.is_a?(Creole)
|
45
50
|
end
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
def to_doc(target, options = {})
|
53
|
-
element(:todo, @options, @description).to_doc(target, options)
|
54
|
-
end
|
55
|
-
end #Creole_todo
|
51
|
+
|
52
|
+
def to_doc(target, options = {})
|
53
|
+
element(:todo, @options, @description).to_doc(target, options)
|
54
|
+
end
|
55
|
+
end #Creole_todo
|
56
56
|
|
57
57
|
=begin rdoc
|
58
58
|
A variant of Creole_todo with green color.
|
59
59
|
=end
|
60
|
-
class Creole_todo_green < Creole_todo
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
end
|
60
|
+
class Creole_todo_green < Creole_todo
|
61
|
+
set_plugin_key('todo_green') #use <<todo_green|..>>
|
62
|
+
#define default options for todonotes. may be redefined for children of this class.
|
63
|
+
def default_options; {:color => 'green'}; end
|
64
|
+
end
|
65
65
|
|
66
66
|
=begin rdoc
|
67
67
|
A variant of Creole_todo with inline-layout.
|
68
68
|
=end
|
69
|
-
class Creole_todo_inline < Creole_todo
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
end
|
69
|
+
class Creole_todo_inline < Creole_todo
|
70
|
+
set_plugin_key('todo_inline') #use <<todo_inline|..>>
|
71
|
+
#define default options for todonotes. may be redefined for children of this class.
|
72
|
+
def default_options; {:inline => true}; end
|
73
|
+
end
|
74
74
|
|
75
|
-
end #module Todo
|
76
|
-
end #module Creole
|
75
|
+
end #module Todo
|
76
|
+
end #module Creole
|
77
77
|
end #module Docgenerator
|