docgenerator 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +7 -0
  2. data/examples/creole_example.rb +0 -1
  3. data/examples/creole_example_new_plugin.rb +51 -0
  4. data/examples/creole_example_tabular.rb +3 -1
  5. data/examples/wiki2docgenerator_example.rb +2 -2
  6. data/lib/creole/creole2doc.rb +697 -680
  7. data/lib/creole/creole_characters.rb +90 -26
  8. data/lib/creole/creole_inclusion_and_plugins.rb +25 -43
  9. data/lib/creole/creole_inclusions.rb +87 -75
  10. data/lib/creole/creole_placeholder.rb +87 -89
  11. data/lib/creole/creole_plugins.rb +149 -117
  12. data/lib/creole/creole_tabular.rb +247 -141
  13. data/lib/creole/plugins/todonotes.rb +48 -48
  14. data/lib/docgenerator/characters.rb +106 -8
  15. data/lib/docgenerator/compatibility_v1.rb +7 -1
  16. data/lib/docgenerator/document.rb +34 -19
  17. data/lib/docgenerator/element.rb +1 -0
  18. data/lib/docgenerator/element_meta.rb +1 -1
  19. data/lib/docgenerator/elements.rb +594 -535
  20. data/lib/docgenerator/environments.rb +131 -99
  21. data/lib/docgenerator/index.rb +110 -0
  22. data/lib/docgenerator/lists.rb +2 -1
  23. data/lib/docgenerator/packages/caption.rb +32 -34
  24. data/lib/docgenerator/packages/hyperref.rb +1 -0
  25. data/lib/docgenerator/packages/multicol.rb +3 -2
  26. data/lib/docgenerator/packages/pdfpages.rb +71 -20
  27. data/lib/docgenerator/packages/scrpage2.rb +99 -142
  28. data/lib/docgenerator/packages/url.rb +75 -81
  29. data/lib/docgenerator/sections.rb +98 -98
  30. data/lib/docgenerator/standard.rb +8 -1
  31. data/lib/docgenerator/tabular.rb +44 -25
  32. data/lib/docgenerator/templates/docgenerator_template.yaml +28 -0
  33. data/lib/docgenerator/version.rb +146 -0
  34. data/lib/docgenerator.rb +20 -15
  35. data/meta_test_and_doc/build_doc.rb +39 -10
  36. data/meta_test_and_doc/build_test.rb +34 -12
  37. data/meta_test_and_doc/manpages/characters.rb +452 -20
  38. data/meta_test_and_doc/manpages/elementlist.rb +304 -0
  39. data/meta_test_and_doc/manpages/elements.rb +305 -42
  40. data/meta_test_and_doc/manpages/others.rb +403 -0
  41. data/meta_test_and_doc/manpages/pdfpages.rb +117 -18
  42. data/meta_test_and_doc/manpages/readme.rdoc +3 -1
  43. data/meta_test_and_doc/manpages/scrpage2.rb +0 -80
  44. data/meta_test_and_doc/manpages/tables.rb +6 -6
  45. data/readme.rdoc +11 -120
  46. data/unittest/expected/test_comment.html +1 -0
  47. data/unittest/expected/test_comment.latex +5 -0
  48. data/unittest/expected/test_comment_complex.html +3 -0
  49. data/unittest/expected/test_comment_complex.latex +15 -0
  50. data/unittest/expected_creole/test_creole_characters_all.html +6 -5
  51. data/unittest/expected_creole/test_creole_characters_all.latex +10 -8
  52. data/unittest/expected_creole/test_creole_creole1.0test.latex +5 -5
  53. data/unittest/expected_creole/test_creole_input.normsource +11 -9
  54. data/unittest/expected_creole/test_creole_list_ul.normsource +57 -51
  55. data/unittest/expected_creole/test_creole_list_ulul_without_ul.html +6 -0
  56. data/unittest/expected_creole/test_creole_list_ulul_without_ul.latex +12 -0
  57. data/unittest/expected_creole/test_creole_paragraphs.normsource +12 -10
  58. data/unittest/expected_creole/test_creole_pictures.latex +2 -2
  59. data/unittest/expected_creole/test_creole_pictures_css.latex +2 -2
  60. data/unittest/expected_creole/test_creole_pictures_imgclass.latex +2 -2
  61. data/unittest/expected_creole/test_creole_pictures_width.latex +1 -1
  62. data/unittest/expected_creole/test_creole_tabular.latex +3 -3
  63. data/unittest/expected_creole/test_creole_tabular_creole.latex +2 -2
  64. data/unittest/expected_creole/test_creole_tabular_css.latex +3 -3
  65. data/unittest/expected_creole/test_creole_tabular_row_parameters.latex +22 -0
  66. data/unittest/expected_templates/test_standalone.tex +34 -0
  67. data/unittest/expected_wikimedia/test_wiki_picture.latex +12 -12
  68. data/unittest/unittest_creole.rb +22 -3
  69. data/unittest/unittest_creole_tabular.rb +34 -1
  70. data/unittest/unittest_docgenerator.rb +46 -3
  71. data/unittest/unittest_docgenerator_characters.rb +527 -82
  72. data/unittest/unittest_templates.rb +1 -1
  73. metadata +149 -108
@@ -15,7 +15,7 @@ You can extend Wikis with additional Plugin:
15
15
  #
16
16
 
17
17
  module Docgenerator
18
- module Creole
18
+ module Creole
19
19
 
20
20
  =begin rdoc
21
21
  Creole plugins
@@ -30,21 +30,21 @@ You can extend Wikis with additional Plugin:
30
30
  wiki = Creole.new()
31
31
  wiki.plugin['xxx'] = Creole_plugin_xxx
32
32
  =end
33
- module Plugins
33
+ module Plugins
34
34
 
35
35
  =begin rdoc
36
36
  Default Plugin for Creole.
37
37
  <<xx>>
38
38
  =end
39
- class Creole_default_plugin < Creole_inclusion_and_plugin
40
- def initialize( pluginname, description, options, wiki )
41
- super
42
- @wiki.log.warn("Use Default plugin instead requested #{pluginname}- nothing special done.") if @wiki.log.warn?
43
- end
44
- end
39
+ class Creole_default_plugin < Creole_inclusion_and_plugin
40
+ def initialize( pluginname, description, options, wiki )
41
+ super
42
+ @wiki.log.warn("Use Default plugin instead requested #{pluginname}- nothing special done.") if @wiki.log.warn?
43
+ end
44
+ end
45
45
 
46
- #Collection of Plugins
47
- Collection = Hash.new(Creole_default_plugin)
46
+ #Collection of Plugins
47
+ Collection = Hash.new(Creole_default_plugin)
48
48
 
49
49
 
50
50
  =begin rdoc
@@ -54,28 +54,28 @@ Makes sense for HTML-output.
54
54
 
55
55
  For LaTeX the support of bigfoot/manyfoot... may be an idea.
56
56
  =end
57
- class Creole_footnote_group < Creole_inclusion_and_plugin
58
- #
59
-
60
- Collection['footnotes'] = self
61
-
62
- def initialize( inclusionname, description, options, wiki )
63
- super
64
- description = Footnotegroup::DEFAULTGROUPID unless description
65
- @footnotesgroup = wiki.footnotegroups[description]
66
- wiki.log.error("Footnotesgroup #{description.inspect} not found") if ! @footnotesgroup and wiki.log.error?
67
- end
57
+ class Creole_footnote_group < Creole_inclusion_and_plugin
58
+ #
59
+
60
+ Collection['footnotes'] = self
61
+
62
+ def initialize( inclusionname, description, options, wiki )
63
+ super
64
+ description = Footnotegroup::DEFAULTGROUPID unless description
65
+ @footnotesgroup = wiki.footnotegroups[description]
66
+ wiki.log.error("Footnotesgroup #{description.inspect} not found") if ! @footnotesgroup and wiki.log.error?
67
+ end
68
68
  =begin rdoc
69
69
  Call Docgenerator::Footnotegroup#to_doc
70
70
  =end
71
- def to_doc(target, options = {})
72
- #remove options for Docgenerator::Footnotegroup
73
- l_options = options.dup
74
- l_options.delete(:plugins)
75
- l_options.delete(:inclusions)
76
- @footnotesgroup.to_doc(target, l_options)
77
- end
78
- end #Creole_inclusion_footnote_group
71
+ def to_doc(target, options = {})
72
+ #remove options for Docgenerator::Footnotegroup
73
+ l_options = options.dup
74
+ l_options.delete(:plugins)
75
+ l_options.delete(:inclusions)
76
+ @footnotesgroup.to_doc(target, l_options)
77
+ end
78
+ end #Creole_inclusion_footnote_group
79
79
 
80
80
  =begin rdoc
81
81
  One footnote
@@ -91,43 +91,77 @@ Solution:
91
91
  * LaTeX: no problem, LaTeX has it's own output mechanism.
92
92
  * HTML: Use grouping.
93
93
  =end
94
- class Creole_footnote < Creole_inclusion_and_plugin
95
- Collection['footnote'] = self
96
-
97
- def initialize( inclusionname, description, options, wiki )
98
- super
99
-
100
- @groupid = Footnotegroup::DEFAULTGROUPID
101
- label = nil
102
-
103
- options.each{|option|
104
- case option
105
- when /label\s*=\s*(.*)/
106
- label = $1
107
- when /groupid\s*=\s*(.*)/
108
- @groupid = $1
109
- else
110
- @wiki.log.warn("Footnote with unknown option #{option.inspect} not found") if @wiki.log.warn?
111
- end
112
- }
113
-
114
- if ! wiki.footnotegroups[@groupid]
115
- wiki.footnotegroups[@groupid] = Footnotegroup.new(@groupid)
116
- end
117
-
118
- group = wiki.footnotegroups[@groupid]
119
-
120
- @footnote = element(:footnote,{
121
- :group => group,
122
- :label => label,
123
- }, description )
124
-
125
-
126
- end
127
- def to_doc(target, options ={})
128
- @footnote.to_doc(target, options)
129
- end
130
- end #Creole_inclusion_footnote
94
+ class Creole_footnote < Creole_inclusion_and_plugin
95
+ Collection['footnote'] = self
96
+
97
+ def initialize( inclusionname, description, options, wiki )
98
+ super
99
+
100
+ @groupid = Footnotegroup::DEFAULTGROUPID
101
+ label = nil
102
+
103
+ options.each{|option|
104
+ case option
105
+ when /label\s*=\s*(.*)/
106
+ label = $1
107
+ when /groupid\s*=\s*(.*)/
108
+ @groupid = $1
109
+ else
110
+ @wiki.log.warn("Footnote with unknown option #{option.inspect} not found") if @wiki.log.warn?
111
+ end
112
+ }
113
+
114
+ if ! wiki.footnotegroups[@groupid]
115
+ wiki.footnotegroups[@groupid] = Footnotegroup.new(@groupid)
116
+ end
117
+
118
+ group = wiki.footnotegroups[@groupid]
119
+
120
+ @footnote = element(:footnote,{
121
+ :group => group,
122
+ :label => label,
123
+ }, description )
124
+
125
+
126
+ end
127
+ def to_doc(target, options ={})
128
+ @footnote.to_doc(target, options)
129
+ end
130
+ end #Creole_inclusion_footnote
131
+
132
+ =begin rdoc
133
+ Some short latex
134
+
135
+ Usage:
136
+ <<latex|code>>
137
+
138
+ Note:
139
+ There is also a placeholder for larger latex:
140
+ <<<latex
141
+ content
142
+ >>>
143
+ =end
144
+ class Creole_short_latex < Creole_inclusion_and_plugin
145
+ #We don't use it as inclusion. Closing } from latex may be confusing as in:
146
+ # {{latex|\texttt{kursuiv}}}
147
+ set_plugin_key 'latex'
148
+
149
+ def initialize( inclusionname, description, options, wiki )
150
+ super
151
+ options.each{|option|
152
+ #~ case option
153
+ #~ else
154
+ @wiki.log.warn("latex with unknown option #{option.inspect} not found") if @wiki.log.warn?
155
+ #~ end
156
+ }
157
+ @source = description
158
+
159
+ end
160
+ #Return content only for latex
161
+ def to_doc( target, options = {})
162
+ target == :latex ? @source.to_doc( target, options ) : ''
163
+ end
164
+ end #Creole_short_latex
131
165
 
132
166
 
133
167
  =begin rdoc
@@ -136,28 +170,28 @@ Eval the given ruby-code and put it as "raw text".
136
170
 
137
171
  This is defined as a plugin.
138
172
  =end
139
- class Creole_plugin_ruby_raw < Creole_inclusion_and_plugin
140
- set_plugin_key 'ruby_raw'
141
-
142
- def initialize( inclusionname, description, options, wiki )
143
- #The ruby-code may contain | - so we have to ad it again
144
- description << "|#{options.join('|')}" unless options.empty?
145
- options = nil
146
- super
147
- @code = description
148
- begin
149
- @result = eval(@code)
150
- rescue => bang
151
- wiki.log.error("Plugin ruby_raw: <#{@code}> results in #{bang.class}/#{bang}") if wiki.log.error?
152
- end
153
- end #initioliaze
154
- def to_doc(target, options ={})
155
- @result.to_s
156
- end
157
- def inspect()
158
- "#<Creole_plugin_ruby_raw:#{@code}>"
159
- end
160
- end #Creole_plugin_ruby
173
+ class Creole_plugin_ruby_raw < Creole_inclusion_and_plugin
174
+ set_plugin_key 'ruby_raw'
175
+
176
+ def initialize( inclusionname, description, options, wiki )
177
+ #The ruby-code may contain | - so we have to ad it again
178
+ description << "|#{options.join('|')}" unless options.empty?
179
+ options = nil
180
+ super
181
+ @code = description
182
+ begin
183
+ @result = eval(@code)
184
+ rescue => bang
185
+ wiki.log.error("Plugin ruby_raw: <#{@code}> results in #{bang.class}/#{bang}") if wiki.log.error?
186
+ end
187
+ end #initialize
188
+ def to_doc(target, options ={})
189
+ @result.to_s
190
+ end
191
+ def inspect()
192
+ "#<Creole_plugin_ruby_raw:#{@code}>"
193
+ end
194
+ end #Creole_plugin_ruby
161
195
 
162
196
  =begin rdoc
163
197
  Eval the given ruby-code and add it as a interpreted code.
@@ -166,33 +200,31 @@ This is defined as a plugin.
166
200
 
167
201
  Ideas for further development: eval later, at doc generation.
168
202
  =end
169
- class Creole_plugin_ruby < Creole_inclusion_and_plugin
170
- set_plugin_key 'ruby'
171
-
172
- def initialize( inclusionname, description, options, wiki )
173
- #The ruby-code may contain | - so we have to ad it again
174
- description << "|#{options.join('|')}" unless options.empty?
175
- options = nil
176
- super
177
-
178
- @code = description
179
- begin
180
- @result = eval(@code)
181
- rescue => bang
182
- wiki.log.error("Plugin ruby: <#{@code}> results in #{bang.class}/#{bang}") if wiki.log.error?
183
- end
184
- end #initioliaze
185
- def to_doc(target, options = {})
186
- @wiki.normsource2elements(
187
- @wiki.parse(@result.to_s ), options
188
- ).to_doc(target, options )
189
- end
190
- def inspect()
191
- "#<Creole_plugin_ruby:#{@code}>"
192
- end
193
- end #Creole_plugin_ruby
194
-
195
-
196
- end #module Plugins
197
- end #module Creole
203
+ class Creole_plugin_ruby < Creole_inclusion_and_plugin
204
+ set_plugin_key 'ruby'
205
+
206
+ def initialize( inclusionname, description, options, wiki )
207
+ #The ruby-code may contain | - so we have to ad it again
208
+ description << "|#{options.join('|')}" unless options.empty?
209
+ options = nil
210
+ super
211
+
212
+ @code = description
213
+ begin
214
+ @result = eval(@code)
215
+ rescue => bang
216
+ wiki.log.error("Plugin ruby: <#{@code}> results in #{bang.class}/#{bang}") if wiki.log.error?
217
+ end
218
+ end #initialize
219
+ def to_doc(target, options = {})
220
+ @wiki.normsource2elements(
221
+ @wiki.parse(@result.to_s ), options
222
+ ).to_doc(target, options )
223
+ end
224
+ def inspect()
225
+ "#<Creole_plugin_ruby:#{@code}>"
226
+ end
227
+ end #Creole_plugin_ruby
228
+ end #module Plugins
229
+ end #module Creole
198
230
  end #module Docgenerator