docgenerator 2.1.0 → 2.1.1
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.
- 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,11 +1,11 @@
|
|
1
1
|
module Docgenerator
|
2
|
-
module Packages
|
2
|
+
module Packages
|
3
3
|
=begin rdoc
|
4
4
|
Support for scrpage2.sty (Koma-Script)
|
5
5
|
|
6
6
|
* http://www.ctan.org/tex-archive/macros/latex/contrib/koma-script/
|
7
7
|
=end
|
8
|
-
module Scrpage2
|
8
|
+
module Scrpage2
|
9
9
|
|
10
10
|
=begin rdoc
|
11
11
|
Define Element :clearscrheadings
|
@@ -16,10 +16,10 @@ or
|
|
16
16
|
Clearscrheadings.new( [ attributes, [content]] )
|
17
17
|
Attributes are not defined for this element.
|
18
18
|
=end
|
19
|
-
class Clearscrheadings < Element
|
20
|
-
|
21
|
-
|
22
|
-
end #Clearscrheadings
|
19
|
+
class Clearscrheadings < Element
|
20
|
+
has_no_content false
|
21
|
+
add_latex_output '#{linebreak(@crbefore)}\clearscrheadings #{linebreak(@crafter)}'
|
22
|
+
end #Clearscrheadings
|
23
23
|
|
24
24
|
=begin rdoc
|
25
25
|
Define Element :clearscrheadfoot
|
@@ -30,10 +30,10 @@ or
|
|
30
30
|
Clearscrheadfoot.new( [ attributes, [content]] )
|
31
31
|
Attributes are not defined for this element.
|
32
32
|
=end
|
33
|
-
class Clearscrheadfoot < Element
|
34
|
-
|
35
|
-
|
36
|
-
end #Clearscrheadfoot
|
33
|
+
class Clearscrheadfoot < Element
|
34
|
+
has_no_content false
|
35
|
+
add_latex_output '#{linebreak(@crbefore)}\clearscrheadfoot #{linebreak(@crafter)}'
|
36
|
+
end #Clearscrheadfoot
|
37
37
|
|
38
38
|
=begin rdoc
|
39
39
|
Define Element :clearscrplain
|
@@ -44,27 +44,10 @@ or
|
|
44
44
|
Clearscrplain.new( [ attributes, [content]] )
|
45
45
|
Attributes are not defined for this element.
|
46
46
|
=end
|
47
|
-
class Clearscrplain < Element
|
48
|
-
|
49
|
-
|
50
|
-
end #Clearscrplain
|
51
|
-
|
52
|
-
=begin rdoc
|
53
|
-
Define Element :pagestyle
|
54
|
-
|
55
|
-
Create an instance with
|
56
|
-
element( :pagestyle, [ attributes, [content]] )
|
57
|
-
or
|
58
|
-
Pagestyle.new( [ attributes, [content]] )
|
59
|
-
Attributes are not defined for this element.
|
60
|
-
|
61
|
-
Values: scrheadings, scrplain
|
62
|
-
|
63
|
-
=end
|
64
|
-
class Pagestyle < Element
|
65
|
-
#fixme check content only scrheadings, scrplain
|
66
|
-
add_latex_output '#{linebreak(@crbefore)}\pagestyle{#{@content}}#{linebreak(@crafter)}'
|
67
|
-
end #Pagestyle
|
47
|
+
class Clearscrplain < Element
|
48
|
+
has_no_content false
|
49
|
+
add_latex_output '#{linebreak(@crbefore)}\clearscrplain #{linebreak(@crafter)}'
|
50
|
+
end #Clearscrplain
|
68
51
|
|
69
52
|
=begin rdoc
|
70
53
|
Define Element :manualmark
|
@@ -75,10 +58,10 @@ or
|
|
75
58
|
Manualmark.new( [ attributes, [content]] )
|
76
59
|
Attributes are not defined for this element.
|
77
60
|
=end
|
78
|
-
class Manualmark < Element
|
79
|
-
|
80
|
-
|
81
|
-
end #Manualmark
|
61
|
+
class Manualmark < Element
|
62
|
+
has_no_content false
|
63
|
+
add_latex_output '#{linebreak(@crbefore)}\manualmark #{linebreak(@crafter)}'
|
64
|
+
end #Manualmark
|
82
65
|
|
83
66
|
=begin rdoc
|
84
67
|
Define Element :automark
|
@@ -90,10 +73,10 @@ or
|
|
90
73
|
Attributes may be:
|
91
74
|
* :rightmark:
|
92
75
|
=end
|
93
|
-
class Automark < Element
|
94
|
-
|
95
|
-
|
96
|
-
end #Automark
|
76
|
+
class Automark < Element
|
77
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
78
|
+
add_latex_output '#{linebreak(@crbefore)}\automark#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
79
|
+
end #Automark
|
97
80
|
|
98
81
|
=begin rdoc
|
99
82
|
Define Element :lehead
|
@@ -105,10 +88,10 @@ or
|
|
105
88
|
Attributes may be:
|
106
89
|
* :rightmark:
|
107
90
|
=end
|
108
|
-
class Lehead < Element
|
109
|
-
|
110
|
-
|
111
|
-
end #Lehead
|
91
|
+
class Lehead < Element
|
92
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
93
|
+
add_latex_output '#{linebreak(@crbefore)}\lehead#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
94
|
+
end #Lehead
|
112
95
|
|
113
96
|
=begin rdoc
|
114
97
|
Define Element :cehead
|
@@ -120,10 +103,10 @@ or
|
|
120
103
|
Attributes may be:
|
121
104
|
* :rightmark:
|
122
105
|
=end
|
123
|
-
class Cehead < Element
|
124
|
-
|
125
|
-
|
126
|
-
end #Cehead
|
106
|
+
class Cehead < Element
|
107
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
108
|
+
add_latex_output '#{linebreak(@crbefore)}\cehead#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
109
|
+
end #Cehead
|
127
110
|
|
128
111
|
=begin rdoc
|
129
112
|
Define Element :rehead
|
@@ -135,10 +118,10 @@ or
|
|
135
118
|
Attributes may be:
|
136
119
|
* :rightmark:
|
137
120
|
=end
|
138
|
-
class Rehead < Element
|
139
|
-
|
140
|
-
|
141
|
-
end #Rehead
|
121
|
+
class Rehead < Element
|
122
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
123
|
+
add_latex_output '#{linebreak(@crbefore)}\rehead#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
124
|
+
end #Rehead
|
142
125
|
|
143
126
|
=begin rdoc
|
144
127
|
Define Element :lefoot
|
@@ -150,10 +133,10 @@ or
|
|
150
133
|
Attributes may be:
|
151
134
|
* :rightmark:
|
152
135
|
=end
|
153
|
-
class Lefoot < Element
|
154
|
-
|
155
|
-
|
156
|
-
end #Lefoot
|
136
|
+
class Lefoot < Element
|
137
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
138
|
+
add_latex_output '#{linebreak(@crbefore)}\lefoot#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
139
|
+
end #Lefoot
|
157
140
|
|
158
141
|
=begin rdoc
|
159
142
|
Define Element :cefoot
|
@@ -165,10 +148,10 @@ or
|
|
165
148
|
Attributes may be:
|
166
149
|
* :rightmark:
|
167
150
|
=end
|
168
|
-
class Cefoot < Element
|
169
|
-
|
170
|
-
|
171
|
-
end #Cefoot
|
151
|
+
class Cefoot < Element
|
152
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
153
|
+
add_latex_output '#{linebreak(@crbefore)}\cefoot#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
154
|
+
end #Cefoot
|
172
155
|
|
173
156
|
=begin rdoc
|
174
157
|
Define Element :refoot
|
@@ -180,10 +163,10 @@ or
|
|
180
163
|
Attributes may be:
|
181
164
|
* :rightmark:
|
182
165
|
=end
|
183
|
-
class Refoot < Element
|
184
|
-
|
185
|
-
|
186
|
-
end #Refoot
|
166
|
+
class Refoot < Element
|
167
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
168
|
+
add_latex_output '#{linebreak(@crbefore)}\refoot#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
169
|
+
end #Refoot
|
187
170
|
|
188
171
|
=begin rdoc
|
189
172
|
Define Element :lohead
|
@@ -195,10 +178,10 @@ or
|
|
195
178
|
Attributes may be:
|
196
179
|
* :rightmark:
|
197
180
|
=end
|
198
|
-
class Lohead < Element
|
199
|
-
|
200
|
-
|
201
|
-
end #Lohead
|
181
|
+
class Lohead < Element
|
182
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
183
|
+
add_latex_output '#{linebreak(@crbefore)}\lohead#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
184
|
+
end #Lohead
|
202
185
|
|
203
186
|
=begin rdoc
|
204
187
|
Define Element :cohead
|
@@ -210,10 +193,10 @@ or
|
|
210
193
|
Attributes may be:
|
211
194
|
* :rightmark:
|
212
195
|
=end
|
213
|
-
class Cohead < Element
|
214
|
-
|
215
|
-
|
216
|
-
end #Cohead
|
196
|
+
class Cohead < Element
|
197
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
198
|
+
add_latex_output '#{linebreak(@crbefore)}\cohead#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
199
|
+
end #Cohead
|
217
200
|
|
218
201
|
=begin rdoc
|
219
202
|
Define Element :rohead
|
@@ -225,10 +208,10 @@ or
|
|
225
208
|
Attributes may be:
|
226
209
|
* :rightmark:
|
227
210
|
=end
|
228
|
-
class Rohead < Element
|
229
|
-
|
230
|
-
|
231
|
-
end #Rohead
|
211
|
+
class Rohead < Element
|
212
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
213
|
+
add_latex_output '#{linebreak(@crbefore)}\rohead#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
214
|
+
end #Rohead
|
232
215
|
|
233
216
|
|
234
217
|
=begin rdoc
|
@@ -241,10 +224,10 @@ or
|
|
241
224
|
Attributes may be:
|
242
225
|
* :rightmark:
|
243
226
|
=end
|
244
|
-
class Lofoot < Element
|
245
|
-
|
246
|
-
|
247
|
-
end #Lofoot
|
227
|
+
class Lofoot < Element
|
228
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
229
|
+
add_latex_output '#{linebreak(@crbefore)}\lofoot#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
230
|
+
end #Lofoot
|
248
231
|
|
249
232
|
=begin rdoc
|
250
233
|
Define Element :cofoot
|
@@ -256,10 +239,10 @@ or
|
|
256
239
|
Attributes may be:
|
257
240
|
* :rightmark:
|
258
241
|
=end
|
259
|
-
class Cofoot < Element
|
260
|
-
|
261
|
-
|
262
|
-
end #Cofoot
|
242
|
+
class Cofoot < Element
|
243
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
244
|
+
add_latex_output '#{linebreak(@crbefore)}\cofoot#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
245
|
+
end #Cofoot
|
263
246
|
|
264
247
|
=begin rdoc
|
265
248
|
Define Element :rofoot
|
@@ -271,10 +254,10 @@ or
|
|
271
254
|
Attributes may be:
|
272
255
|
* :rightmark:
|
273
256
|
=end
|
274
|
-
class Rofoot < Element
|
275
|
-
|
276
|
-
|
277
|
-
end #Rofoot
|
257
|
+
class Rofoot < Element
|
258
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
259
|
+
add_latex_output '#{linebreak(@crbefore)}\rofoot#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
260
|
+
end #Rofoot
|
278
261
|
|
279
262
|
=begin rdoc
|
280
263
|
Define Element :ihead
|
@@ -286,10 +269,10 @@ or
|
|
286
269
|
Attributes may be:
|
287
270
|
* :rightmark:
|
288
271
|
=end
|
289
|
-
class Ihead < Element
|
290
|
-
|
291
|
-
|
292
|
-
end #Ihead
|
272
|
+
class Ihead < Element
|
273
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
274
|
+
add_latex_output '#{linebreak(@crbefore)}\ihead#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
275
|
+
end #Ihead
|
293
276
|
|
294
277
|
=begin rdoc
|
295
278
|
Define Element :chead
|
@@ -301,10 +284,10 @@ or
|
|
301
284
|
Attributes may be:
|
302
285
|
* :rightmark:
|
303
286
|
=end
|
304
|
-
class Chead < Element
|
305
|
-
|
306
|
-
|
307
|
-
end #Chead
|
287
|
+
class Chead < Element
|
288
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
289
|
+
add_latex_output '#{linebreak(@crbefore)}\chead#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
290
|
+
end #Chead
|
308
291
|
|
309
292
|
=begin rdoc
|
310
293
|
Define Element :ohead
|
@@ -316,10 +299,10 @@ or
|
|
316
299
|
Attributes may be:
|
317
300
|
* :rightmark:
|
318
301
|
=end
|
319
|
-
class Ohead < Element
|
320
|
-
|
321
|
-
|
322
|
-
end #Ohead
|
302
|
+
class Ohead < Element
|
303
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
304
|
+
add_latex_output '#{linebreak(@crbefore)}\ohead#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
305
|
+
end #Ohead
|
323
306
|
|
324
307
|
=begin rdoc
|
325
308
|
Define Element :ifoot
|
@@ -331,10 +314,10 @@ or
|
|
331
314
|
Attributes may be:
|
332
315
|
* :rightmark:
|
333
316
|
=end
|
334
|
-
class Ifoot < Element
|
335
|
-
|
336
|
-
|
337
|
-
end #Ifoot
|
317
|
+
class Ifoot < Element
|
318
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
319
|
+
add_latex_output '#{linebreak(@crbefore)}\ifoot#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
320
|
+
end #Ifoot
|
338
321
|
|
339
322
|
=begin rdoc
|
340
323
|
Define Element :cfoot
|
@@ -346,10 +329,10 @@ or
|
|
346
329
|
Attributes may be:
|
347
330
|
* :rightmark:
|
348
331
|
=end
|
349
|
-
class Cfoot < Element
|
350
|
-
|
351
|
-
|
352
|
-
end #Cfoot
|
332
|
+
class Cfoot < Element
|
333
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
334
|
+
add_latex_output '#{linebreak(@crbefore)}\cfoot#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
335
|
+
end #Cfoot
|
353
336
|
|
354
337
|
=begin rdoc
|
355
338
|
Define Element :ofoot
|
@@ -361,41 +344,15 @@ or
|
|
361
344
|
Attributes may be:
|
362
345
|
* :rightmark:
|
363
346
|
=end
|
364
|
-
class Ofoot < Element
|
365
|
-
|
366
|
-
|
367
|
-
end #Ofoot
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
#~ Element.add( [:captionof], Captionof)
|
374
|
-
#~ add_attributes( HTML_ATTR_ALL )
|
375
|
-
#~ add_attributes( {
|
376
|
-
#~ :float_type => Attribute.create( [ :latex, :required ], [ 'figure', 'table' ] ),
|
377
|
-
#~ :lst_entry => Attribute.create( [ ], [ String ] ),
|
378
|
-
#~ } )
|
379
|
-
|
380
|
-
#~ #Redefine standard output.
|
381
|
-
#~ #Options are given, if an option is avalaible.
|
382
|
-
#~ def to_latex()
|
383
|
-
#~ cmd = linebreak(@crbefore)
|
384
|
-
#~ cmd << "\\captionof{#{@attr[:float_type]}}"
|
385
|
-
#~ #Empty [] would return empty entry for list of figures,
|
386
|
-
#~ cmd << "[#{@attr[:lst_entry]}]" if @attr[:lst_entry].content?
|
387
|
-
#~ cmd << "{#{@content}}"
|
388
|
-
#~ cmd << linebreak(@crafter)
|
389
|
-
#~ return cmd
|
390
|
-
#~ end
|
391
|
-
#~ def htmltag(); 'span'; end #fixme
|
392
|
-
#~ def to_html()
|
393
|
-
#~ return ''
|
394
|
-
#~ end
|
395
|
-
#~ end #
|
396
|
-
|
397
|
-
end #module Scrpage2
|
398
|
-
end #module Packages
|
347
|
+
class Ofoot < Element
|
348
|
+
add_attribute :rightmark, Attribute.create( [ :latex ], [ String ] )
|
349
|
+
add_latex_output '#{linebreak(@crbefore)}\ofoot#{texoptional(:rightmark)}{#{@content}}#{linebreak(@crafter)}'
|
350
|
+
end #Ofoot
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
end #module Scrpage2
|
355
|
+
end #module Packages
|
399
356
|
end #module Docgenerator
|
400
357
|
__END__
|
401
358
|
pdf.head << element(:usepackage,{}, 'scrpage2' ).cr
|
@@ -1,83 +1,77 @@
|
|
1
|
-
#if ! $".include?('docgenerator.rb')
|
2
|
-
if ! defined?( Document )
|
3
|
-
require 'docgenerator'
|
4
|
-
end
|
5
|
-
|
6
1
|
module Docgenerator
|
7
|
-
module Packages
|
8
|
-
|
9
|
-
#
|
10
|
-
#
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
82
|
-
end #module Packages
|
2
|
+
module Packages
|
3
|
+
#
|
4
|
+
#Small Administration class for websites and their description
|
5
|
+
#
|
6
|
+
class Url
|
7
|
+
def initialize( url, short=url, descr=nil, lastvisit = nil )
|
8
|
+
@url = url
|
9
|
+
@short = short
|
10
|
+
@short = url if ! @short
|
11
|
+
@descr = descr
|
12
|
+
@lastvisit = lastvisit
|
13
|
+
@mirrors = []
|
14
|
+
@@all << self
|
15
|
+
end
|
16
|
+
@@all = []
|
17
|
+
#Refresh the list of all URL.
|
18
|
+
def self.clear()
|
19
|
+
@@all = []
|
20
|
+
end
|
21
|
+
#Uri of the website
|
22
|
+
attr_accessor :url
|
23
|
+
#Short description
|
24
|
+
attr_accessor :short
|
25
|
+
#Description of the content
|
26
|
+
attr_accessor :descr
|
27
|
+
#Date of last visit/check
|
28
|
+
attr_accessor :lastvisit
|
29
|
+
#Short description is used as linktext
|
30
|
+
alias :linktext :short
|
31
|
+
|
32
|
+
def to_s()
|
33
|
+
return "#{self.url()}"
|
34
|
+
end
|
35
|
+
def to_doc(target, attr = {})
|
36
|
+
return element(:a, {:href=>self.url}, self.linktext()).to_doc(target, attr)
|
37
|
+
end
|
38
|
+
#Output with all details.
|
39
|
+
#The ctrl-hash contains all elements which should be included.
|
40
|
+
def to_element_long( ctrl_in = {} )
|
41
|
+
ctrl = { :lastvisit => true,
|
42
|
+
:descr => :br,
|
43
|
+
:attach => nil,
|
44
|
+
}.update(ctrl_in)
|
45
|
+
|
46
|
+
el_long = [ self.to_element() ]
|
47
|
+
if ctrl[:lastvisit] and self.lastvisit
|
48
|
+
if self.lastvisit.respond_to?( :strftime )
|
49
|
+
el_long << " (#{self.lastvisit.strftime( '%Y-%m-%d' )})"
|
50
|
+
elsif self.lastvisit
|
51
|
+
el_long << " (#{self.lastvisit})"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
if ctrl[:descr] and self.descr()
|
55
|
+
if element( ctrl[:descr] ).content?
|
56
|
+
el_long << element(ctrl[:descr], {}, self.descr ).cr
|
57
|
+
else
|
58
|
+
el_long << element(ctrl[:br]).cr if ctrl.include?(:br)
|
59
|
+
el_long << self.descr()
|
60
|
+
end
|
61
|
+
end
|
62
|
+
el_long << ctrl[:attach]
|
63
|
+
return el_long
|
64
|
+
end
|
65
|
+
#Return URL for usage inside a list.
|
66
|
+
def to_element_li()
|
67
|
+
return element(:li, {}, self.to_element_long() ).cr
|
68
|
+
end
|
69
|
+
#Return all collected URL in a docgenerator-list
|
70
|
+
def self.list( listtype = :ul, list = @@all )
|
71
|
+
li_list = element( listtype ).cr
|
72
|
+
list.each{|url| li_list << url.to_element_li }
|
73
|
+
return li_list
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end #module Packages
|
83
77
|
end #module Docgenerator
|