docgenerator 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/examples/creole_example_tabular.rb +95 -0
  2. data/examples/docgenerator_example.rb +5 -5
  3. data/lib/creole/creole2doc.rb +28 -18
  4. data/lib/creole/creole_inclusions.rb +4 -4
  5. data/lib/creole/creole_placeholder.rb +4 -1
  6. data/lib/creole/creole_tabular.rb +173 -155
  7. data/lib/creole/plugins/rail.rb +118 -119
  8. data/lib/creole/plugins/struktex.rb +35 -35
  9. data/lib/creole/plugins/todonotes.rb +8 -1
  10. data/lib/docgenerator/attribute.rb +160 -160
  11. data/lib/docgenerator/characters.rb +343 -311
  12. data/lib/docgenerator/css.rb +167 -167
  13. data/lib/docgenerator/document.rb +525 -511
  14. data/lib/docgenerator/element.rb +316 -316
  15. data/lib/docgenerator/element_meta.rb +114 -114
  16. data/lib/docgenerator/elements.rb +19 -9
  17. data/lib/docgenerator/environments.rb +3 -1
  18. data/lib/docgenerator/lists.rb +177 -174
  19. data/lib/docgenerator/packages/hyperref.rb +74 -70
  20. data/lib/docgenerator/packages/multicol.rb +33 -0
  21. data/lib/docgenerator/packages/scrlettr2.rb +152 -151
  22. data/lib/docgenerator/packages/todonotes.rb +1 -1
  23. data/lib/docgenerator/tabular.rb +463 -400
  24. data/lib/docgenerator/templates/docgenerator_template.rb +94 -84
  25. data/lib/docgenerator/templates/docgenerator_template.yaml +75 -15
  26. data/lib/docgenerator.rb +1 -1
  27. data/lib/wiki2doc/wiki2docgenerator.rb +1 -1
  28. data/meta_test_and_doc/build__meta.rb +125 -0
  29. data/meta_test_and_doc/build_doc.rb +333 -0
  30. data/meta_test_and_doc/build_test.rb +251 -0
  31. data/meta_test_and_doc/manpages/attachfile.rb +389 -0
  32. data/meta_test_and_doc/manpages/caption.rb +133 -0
  33. data/meta_test_and_doc/manpages/characters.rb +3738 -0
  34. data/meta_test_and_doc/manpages/elements.rb +6851 -0
  35. data/meta_test_and_doc/manpages/environments.rb +985 -0
  36. data/meta_test_and_doc/manpages/footnote.rb +439 -0
  37. data/meta_test_and_doc/manpages/hyperref.rb +605 -0
  38. data/meta_test_and_doc/manpages/listings.rb +988 -0
  39. data/meta_test_and_doc/manpages/lists.rb +1463 -0
  40. data/meta_test_and_doc/manpages/others.rb +129 -0
  41. data/meta_test_and_doc/manpages/packages.rb +13 -0
  42. data/meta_test_and_doc/manpages/pdfpages.rb +108 -0
  43. data/meta_test_and_doc/manpages/readme.rdoc +9 -0
  44. data/meta_test_and_doc/manpages/scrlettr2.rb +362 -0
  45. data/meta_test_and_doc/manpages/scrpage2.rb +2028 -0
  46. data/meta_test_and_doc/manpages/sectioning.rb +2467 -0
  47. data/meta_test_and_doc/manpages/tables.rb +2088 -0
  48. data/meta_test_and_doc/manpages/todonotes.rb +235 -0
  49. data/meta_test_and_doc/manpages/wiki2docgenerator.rb +64 -0
  50. data/{readme.rd → readme.rdoc} +18 -1
  51. data/unittest/expected/test_tabular.creole +33 -0
  52. data/unittest/expected_creole/test_creole_creole1.0test.html +3 -3
  53. data/unittest/expected_creole/test_creole_creole1.0test.latex +3 -3
  54. data/unittest/expected_creole/test_creole_creole1.0test.text +3 -3
  55. data/unittest/expected_creole/test_creole_inline_apostroph.html +6 -0
  56. data/unittest/expected_creole/test_creole_inline_apostroph.latex +8 -0
  57. data/unittest/expected_creole/test_creole_inline_apostroph.text +4 -0
  58. data/unittest/expected_creole/test_creole_input.normsource +12 -12
  59. data/unittest/expected_creole/test_creole_input.normsource_1.8 +23 -0
  60. data/unittest/expected_creole/test_creole_links_external_implicit.html +2 -2
  61. data/unittest/expected_creole/test_creole_links_external_implicit.latex +2 -2
  62. data/unittest/expected_creole/test_creole_links_external_implicit.text +2 -2
  63. data/unittest/expected_creole/test_creole_links_implicit_end.html +1 -1
  64. data/unittest/expected_creole/test_creole_links_implicit_end.latex +1 -1
  65. data/unittest/expected_creole/test_creole_list_ul.normsource +42 -42
  66. data/unittest/expected_creole/test_creole_list_ul.normsource_1.8 +83 -0
  67. data/unittest/expected_creole/test_creole_paragraphs.normsource +15 -15
  68. data/unittest/expected_creole/test_creole_paragraphs.normsource_1.8 +27 -0
  69. data/unittest/expected_creole/test_creole_tabular.creole +22 -0
  70. data/unittest/expected_creole/test_creole_tabular_creole.creole +19 -0
  71. data/unittest/expected_creole/test_creole_tabular_css.creole +24 -0
  72. data/unittest/expected_creole/test_creole_tabular_multicols.creole +16 -0
  73. data/unittest/expected_creole/test_creole_tabular_multicols.html +14 -0
  74. data/unittest/expected_creole/test_creole_tabular_multicols.latex +16 -0
  75. data/unittest/expected_creole/test_creole_tabular_with_cell_option.creole +21 -0
  76. data/unittest/expected_creole/test_creole_toc_level_text.html +2 -2
  77. data/unittest/expected_creole/test_creole_toc_level_text.latex +2 -2
  78. data/unittest/expected_packages/test_multicol_3.tex +2 -0
  79. data/unittest/expected_packages/test_multicol_3_titleline.tex +2 -0
  80. data/unittest/expected_templates/test_article.tex +23 -0
  81. data/unittest/expected_templates/test_article_utf8.tex +34 -0
  82. data/unittest/expected_templates/test_context.miv +18 -0
  83. data/unittest/expected_templates/test_creole.creole +8 -0
  84. data/unittest/expected_templates/test_html.html +12 -0
  85. data/unittest/expected_templates/test_html401_strict.html +14 -0
  86. data/unittest/expected_templates/test_html401_trans.html +14 -0
  87. data/unittest/expected_templates/test_html_utf8.html +14 -0
  88. data/unittest/expected_templates/test_include.tex +17 -0
  89. data/unittest/expected_templates/test_include_utf8.tex +17 -0
  90. data/unittest/expected_templates/test_text.txt +6 -0
  91. data/unittest/expected_templates/test_wiki.wiki +6 -0
  92. data/unittest/expected_templates/test_xhtml_strict.html +14 -0
  93. data/unittest/expected_templates/test_xhtml_trans.html +14 -0
  94. data/unittest/unittest_creole.rb +27 -6
  95. data/unittest/unittest_creole_placeholders.rb +1 -123
  96. data/unittest/unittest_creole_tabular.rb +174 -0
  97. data/unittest/unittest_docgenerator.rb +4 -3
  98. data/unittest/unittest_docgenerator_characters.rb +4769 -615
  99. data/unittest/unittest_packages_multicol.rb +84 -0
  100. data/unittest/unittest_rubycode4doc.rb +0 -1
  101. data/unittest/unittest_templates.rb +64 -0
  102. metadata +163 -77
  103. data/build_test_and_doc.rb +0 -505
  104. data/manpage_elements.rb +0 -10411
@@ -18,60 +18,60 @@ Details see
18
18
  * Element.add_wiki_output
19
19
  * Element.add_text_output
20
20
  =end
21
- class Element
22
-
23
- #Hash with all ids and their corresponding classes.
24
- @@ids = Hash.new( )
25
-
21
+ class Element
22
+
23
+ #Hash with all ids and their corresponding classes.
24
+ @@ids = Hash.new( )
25
+
26
26
  =begin rdoc
27
27
  Meta-class for metaprogramming
28
28
  =end
29
- class << self #Meta-class Element
29
+ class << self #Meta-class Element
30
30
  =begin rdoc
31
31
  This method is called, when a subclass of this class is defined.
32
32
 
33
33
  The class will be added to the element list with class name, converted to a symbol
34
- (modules are extracted in adcance).
35
- The element ma be created with element-method.
34
+ (modules are extracted in advance).
35
+ The element may be created with element-method.
36
36
  =end
37
- def inherited( subclass )
38
- DOCGENERATOR_LOGGER.info("New Element class: #{subclass}") if DOCGENERATOR_LOGGER.debug?
39
- if subclass.name
40
- subclass.add_id(subclass.name.split('::').last.downcase.to_sym)
41
- else
42
- DOCGENERATOR_LOGGER.warn("New Element class without name: #{subclass}") if DOCGENERATOR_LOGGER.warn?
37
+ def inherited( subclass )
38
+ DOCGENERATOR_LOGGER.info("New Element class: #{subclass}") if DOCGENERATOR_LOGGER.debug?
39
+ if subclass.name
40
+ subclass.add_id(subclass.name.split('::').last.downcase.to_sym)
41
+ else
42
+ DOCGENERATOR_LOGGER.warn("New Element class without name: #{subclass}") if DOCGENERATOR_LOGGER.warn?
43
+ end
43
44
  end
44
- end
45
45
  =begin rdoc
46
46
  Define meta/class accessor to element_ids.
47
47
 
48
48
  @element_ids isd defined in Element.add_id
49
49
 
50
50
  =end
51
- def element_ids; @element_ids; end
51
+ def element_ids; @element_ids; end
52
52
  =begin rdoc
53
53
  Add a new element class or assign another name (synonym) for a class.
54
54
  The initial call is made by Element.inherited.
55
55
  =end
56
- def add_id(id)
57
- @element_ids ||= []
58
- if @@ids[ id ] == nil
59
- DOCGENERATOR_LOGGER.debug("Element id '#{id}' is new for #{self}") if DOCGENERATOR_LOGGER.debug?
60
- #All new ids are collected
61
- @@ids[ id ] = self
62
- @element_ids << id
63
- elsif @@ids[ id ] == self
64
- DOCGENERATOR_LOGGER.warn("Element class '#{id}' is defined double: #{self}") if DOCGENERATOR_LOGGER.warn?
65
- else
66
- DOCGENERATOR_LOGGER.error("Error: ID '#{id}' is redefined #{@@ids[id]} -> #{self}") if DOCGENERATOR_LOGGER.error?
67
- @@ids[id] = self
68
- @element_ids << id
56
+ def add_id(id)
57
+ @element_ids ||= []
58
+ if @@ids[ id ] == nil
59
+ DOCGENERATOR_LOGGER.debug("Element id '#{id}' is new for #{self}") if DOCGENERATOR_LOGGER.debug?
60
+ #All new ids are collected
61
+ @@ids[ id ] = self
62
+ @element_ids << id
63
+ elsif @@ids[ id ] == self
64
+ DOCGENERATOR_LOGGER.warn("Element class '#{id}' is defined double: #{self}") if DOCGENERATOR_LOGGER.warn?
65
+ else
66
+ DOCGENERATOR_LOGGER.error("Error: ID '#{id}' is redefined #{@@ids[id]} -> #{self}") if DOCGENERATOR_LOGGER.error?
67
+ @@ids[id] = self
68
+ @element_ids << id
69
+ end
70
+ end
71
+ #Return a element class.
72
+ def get( name )
73
+ return @@ids[name]
69
74
  end
70
- end
71
- #Return a element class.
72
- def get( name )
73
- return @@ids[name]
74
- end
75
75
 
76
76
  =begin rdoc
77
77
  Set flag, that the element does not support content.
@@ -110,11 +110,11 @@ Example:
110
110
  }
111
111
  end
112
112
  =end
113
- def add_attributes( attr )
114
- attr.each{ |k,a |
115
- self.add_attribute(k,a)
116
- }
117
- end
113
+ def add_attributes( attr )
114
+ attr.each{ |k,a |
115
+ self.add_attribute(k,a)
116
+ }
117
+ end
118
118
  =begin rdoc
119
119
  Return the attributes for the metaclass.
120
120
  =end
@@ -126,9 +126,9 @@ Return the attributes for the metaclass.
126
126
  Returns list of attributes.
127
127
  Can be used for copying attributes from one class to another class.
128
128
  =end
129
- def get_attribute_list()
130
- return self.attributes
131
- end
129
+ def get_attribute_list()
130
+ return self.attributes
131
+ end
132
132
 
133
133
  =begin rdoc
134
134
  Add an output routine.
@@ -189,115 +189,115 @@ Attributes can be accessed with @attr[:key]
189
189
  #texkeyval add all attributes with flag :texkeyval. (see Attribute#texkeyval?)
190
190
 
191
191
  =end
192
- def add_output( target, string = nil, &proc )
193
-
194
- if ! [ :latex, :context, :html, :text, :wiki, :creole ].include?(target)
195
- DOCGENERATOR_LOGGER.error("#{self}: Undefined target format #{target}") if DOCGENERATOR_LOGGER.error?
196
- end
197
-
198
- if block_given?
199
- if string
200
- DOCGENERATOR_LOGGER.error("add_output #{target} contains result string and block. Use the block definietion #{self.inspect}") if DOCGENERATOR_LOGGER.error?
192
+ def add_output( target, string = nil, &proc )
193
+
194
+ if ! [ :latex, :context, :html, :text, :wiki, :creole ].include?(target)
195
+ DOCGENERATOR_LOGGER.error("#{self}: Undefined target format #{target}") if DOCGENERATOR_LOGGER.error?
201
196
  end
202
- #The (optional) parameter should be {} by default.
203
- if proc.respond_to?(:parameters) #since ruby 1.9.2
204
- if proc.parameters.size != 1 #Proc#parameters introduced with ruby 1.9.2
205
- DOCGENERATOR_LOGGER.error("add_output #{target}: Arity of block not 1 but #{proc.parameters.inspect} #{self.inspect}") if DOCGENERATOR_LOGGER.error?
206
- elsif proc.parameters.first.first != :opt
207
- DOCGENERATOR_LOGGER.error("add_output #{target}: Block parameter is not optional #{proc.parameters.inspect} #{self.inspect}") if DOCGENERATOR_LOGGER.error?
208
- #the optional parameter should have the default {}
209
- #no way to test it, see http://forum.ruby-portal.de/viewtopic.php?f=22&t=12384
197
+
198
+ if block_given?
199
+ if string
200
+ DOCGENERATOR_LOGGER.error("add_output #{target} contains result string and block. Use the block definietion #{self.inspect}") if DOCGENERATOR_LOGGER.error?
210
201
  end
211
- else #Proc#parameters not supported
212
- if proc.arity > 1 #makes arity 0 also for optional parameters.
213
- DOCGENERATOR_LOGGER.error("add_output #{target}: Arity of block not 1 but #{proc.arity} #{self.inspect}") if DOCGENERATOR_LOGGER.error?
202
+ #The (optional) parameter should be {} by default.
203
+ if proc.respond_to?(:parameters) #since ruby 1.9.2
204
+ if proc.parameters.size != 1 #Proc#parameters introduced with ruby 1.9.2
205
+ DOCGENERATOR_LOGGER.error("add_output #{target}: Arity of block not 1 but #{proc.parameters.inspect} #{self.inspect}") if DOCGENERATOR_LOGGER.error?
206
+ elsif proc.parameters.first.first != :opt
207
+ DOCGENERATOR_LOGGER.error("add_output #{target}: Block parameter is not optional #{proc.parameters.inspect} #{self.inspect}") if DOCGENERATOR_LOGGER.error?
208
+ #the optional parameter should have the default {}
209
+ #no way to test it, see http://forum.ruby-portal.de/viewtopic.php?f=22&t=12384
210
+ end
211
+ else #Proc#parameters not supported
212
+ if proc.arity > 1 #makes arity 0 also for optional parameters.
213
+ DOCGENERATOR_LOGGER.error("add_output #{target}: Arity of block not 1 but #{proc.arity} #{self.inspect}") if DOCGENERATOR_LOGGER.error?
214
+ end
214
215
  end
215
- end
216
- #Define the method.
217
- define_method( "to_#{target}".to_sym, &proc )
218
- else #block_given?
216
+ #Define the method.
217
+ define_method( "to_#{target}".to_sym, &proc )
218
+ else #block_given?
219
219
  =begin
220
220
  Define the output routine, based on a string.
221
221
  =end
222
- if ! string.kind_of?( String )
223
- DOCGENERATOR_LOGGER.error("<#{self.inspect}>#add_output: #{string.inspect} is no String")
224
- end
225
- cmd = <<-code
226
- def to_#{target}(options = {})
227
- o = set_option_defaults(options)
228
- o[:log].debug("enter to_doc(#{target}) for #{self.inspect}, options: \#{options.keys.inspect}") if o[:log].debug?
229
- code
230
- template = string.gsub(/\\/, '\\\\\\')
231
- template.gsub!(/"/, '\"')
232
- #define recursive to_doc for content.
233
- #the closing \} is important. Else you replace '@content.to_latex' with @content.to_doc.to_latex'
234
- template.gsub!(/@content\}/, "@content.to_doc(#{target.inspect}, o)}")
235
- cmd << " \"#{template}\"\n"
236
- cmd << "end\n"
237
- class_eval( cmd )
238
- cmd #return cmd for unit test
239
- end #block_given?
240
- end
222
+ if ! string.kind_of?( String )
223
+ DOCGENERATOR_LOGGER.error("<#{self.inspect}>#add_output: #{string.inspect} is no String")
224
+ end
225
+ cmd = <<-code
226
+ def to_#{target}(options = {})
227
+ o = set_option_defaults(options)
228
+ o[:log].debug("enter to_doc(#{target}) for #{self.inspect}, options: \#{options.keys.inspect}") if o[:log].debug?
229
+ code
230
+ template = string.gsub(/\\/, '\\\\\\')
231
+ template.gsub!(/"/, '\"')
232
+ #define recursive to_doc for content.
233
+ #the closing \} is important. Else you replace '@content.to_latex' with @content.to_doc.to_latex'
234
+ template.gsub!(/@content\}/, "@content.to_doc(#{target.inspect}, o)}")
235
+ cmd << " \"#{template}\"\n"
236
+ cmd << "end\n"
237
+ class_eval( cmd )
238
+ cmd #return cmd for unit test
239
+ end #block_given?
240
+ end
241
241
  =begin rdoc
242
242
  Define the HTML-tag for the to_html method.
243
243
  =end
244
- def add_html_tag( tag )
245
- self.class_eval( "def htmltag()\n'#{tag}'\nend" )
246
- end
244
+ def add_html_tag( tag )
245
+ self.class_eval( "def htmltag()\n'#{tag}'\nend" )
246
+ end
247
247
  =begin rdoc
248
248
  Define the output routine for html.
249
249
  See Element.add_output for details.
250
250
  =end
251
- def add_html_output( output = nil, &cmd )
252
- self.add_output(:html, output, &cmd )
253
- end
251
+ def add_html_output( output = nil, &cmd )
252
+ self.add_output(:html, output, &cmd )
253
+ end
254
254
  =begin rdoc
255
255
  Define the output routine for LaTeX.
256
256
  See Element.add_output for details.
257
257
  =end
258
- def add_latex_output( output = nil, &cmd )
259
- self.add_output(:latex, output, &cmd )
260
- end
258
+ def add_latex_output( output = nil, &cmd )
259
+ self.add_output(:latex, output, &cmd )
260
+ end
261
261
  =begin rdoc
262
262
  Define the output routine for conTeXt.
263
263
  See Element.add_output for details.
264
264
  =end
265
- def add_context_output( output = nil, &cmd )
266
- self.add_output(:context, output, &cmd )
267
- end
265
+ def add_context_output( output = nil, &cmd )
266
+ self.add_output(:context, output, &cmd )
267
+ end
268
268
  =begin rdoc
269
269
  Define the output routine for text.
270
270
  See Element.add_output for details.
271
271
  =end
272
- def add_text_output( output = nil, &cmd )
273
- self.add_output(:text, output, &cmd )
274
- end
272
+ def add_text_output( output = nil, &cmd )
273
+ self.add_output(:text, output, &cmd )
274
+ end
275
275
  =begin rdoc
276
276
  Define the output routine for wiki.
277
277
  See Element.add_output for details.
278
278
  =end
279
- def add_wiki_output( output = nil, &cmd )
280
- self.add_output(:wiki, output, &cmd )
281
- end
279
+ def add_wiki_output( output = nil, &cmd )
280
+ self.add_output(:wiki, output, &cmd )
281
+ end
282
282
  =begin rdoc
283
283
  Define the output routine for creole.
284
284
  See Element.add_output for details.
285
285
  =end
286
- def add_creole_output( output = nil, &cmd )
287
- self.add_output(:creole, output, &cmd )
288
- end
289
-
290
- end #Meta-class Element
286
+ def add_creole_output( output = nil, &cmd )
287
+ self.add_output(:creole, output, &cmd )
288
+ end
289
+
290
+ end #Meta-class Element
291
291
 
292
292
  =begin rdoc
293
293
  Return all id's of the class.
294
294
  The ids are filled via Element.add_id
295
295
  =end
296
- def element_ids()
297
- #~ myids = []
298
- #~ @@ids.each{|k,v| myids << k if v == self.class and k.class != Class }
299
- return self.class.element_ids
300
- end
296
+ def element_ids()
297
+ #~ myids = []
298
+ #~ @@ids.each{|k,v| myids << k if v == self.class and k.class != Class }
299
+ return self.class.element_ids
300
+ end
301
301
 
302
- end #Element
302
+ end #Element
303
303
  end #Docgenerator
@@ -72,7 +72,7 @@ Define Element :htmldummy, :htmlonly
72
72
  =end
73
73
  class Htmldummy < Element
74
74
  add_id :htmlonly
75
- add_html_output '#{@content}'
75
+ add_html_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
76
76
  add_latex_output ''
77
77
  add_context_output ''
78
78
  add_text_output ''
@@ -157,7 +157,7 @@ Define Element :meta2
157
157
  Like Meta, but without name.
158
158
  =end
159
159
  class Meta2 < Element
160
- has_no_content ENDTAG
160
+ has_no_content ENDTAG #meta w/o name
161
161
  add_attribute :"http-equiv", Attribute.create( [ :html, :required ], nil, 1 )
162
162
  add_attribute :content, Attribute.create( [ :html, :required ], nil, 2 )
163
163
  add_html_tag 'meta'
@@ -431,7 +431,7 @@ class Newline < Element
431
431
  add_id "br/"
432
432
  add_id "br"
433
433
  add_id :br
434
- has_no_content ENDTAG
434
+ has_no_content ENDTAG #br
435
435
  add_attribute :clear, Attribute.create( [ :html ], ['all'] )
436
436
  add_html_tag 'br'
437
437
  add_latex_output '#{linebreak(@crbefore)}\newline #{linebreak(@crafter)}'
@@ -457,7 +457,7 @@ class Hrulefill < Element
457
457
  add_id "hr/"
458
458
  add_id "hr"
459
459
  add_id :hr
460
- has_no_content ENDTAG
460
+ has_no_content ENDTAG #hr
461
461
  add_attribute :clear, Attribute.create( [ :html ], ['all'] )
462
462
  add_html_tag 'hr'
463
463
  add_wiki_output '----'
@@ -587,6 +587,7 @@ class Div < Element
587
587
  add_latex_output '#{linebreak(@crbefore)}\begingroup #{linebreak(@crmid)}#{@content}#{linebreak(@crmid)}\endgroup #{linebreak(@crafter)}'
588
588
  add_text_output '#{@content}'
589
589
  add_wiki_output '#{@content}'
590
+ add_creole_output '#{@content}'
590
591
  end #Div
591
592
 
592
593
 
@@ -645,8 +646,9 @@ class Url < Element
645
646
  add_attributes HTML_ATTR_I18N
646
647
  add_attributes HTML_ATTR_EVENTS
647
648
  add_attribute :lang, ATTR_LANG
648
- add_html_output '#{linebreak(@crbefore)}<a href="#{@content}">#{@content}</a>#{linebreak(@crafter)}'
649
+ add_html_output '#{linebreak(@crbefore)}<a href = "#{@content}">#{@content}</a>#{linebreak(@crafter)}'
649
650
  add_latex_output '#{linebreak(@crbefore)}\url{#{@content}}#{linebreak(@crafter)}'
651
+ add_text_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
650
652
  end #Url
651
653
 
652
654
  =begin rdoc
@@ -687,12 +689,16 @@ class Href < Element
687
689
  def to_wiki( options = {} )
688
690
  "[#{@attr[:href].to_s} #{@content.to_doc(:wiki, options)}]"
689
691
  end
692
+ def to_creole( options = {} )
693
+ "[[#{@attr[:href].to_s}|#{@content.to_doc(:creole, options)}]]"
694
+ end
690
695
  def to_latex( options = {} )
691
696
  cmd = linebreak(@crbefore)
692
697
  reference = @attr[:href].to_s
693
- if reference.sub!(/\#/, '') #Internal reference
698
+ if reference.sub!(/\A\#/, '') #Internal reference
694
699
  cmd << "\\hyperlink{#{reference}}{#{@content.to_doc(:latex, options)}}"
695
700
  else #external reference
701
+ #reference may not contain unmasked % or #
696
702
  cmd << "\\href{#{reference}}{#{@content.to_doc(:latex, options)}}"
697
703
  end
698
704
  cmd << linebreak(@crafter)
@@ -1013,6 +1019,8 @@ class Textbf < Element
1013
1019
  add_html_tag 'strong'
1014
1020
  add_latex_output '#{linebreak(@crbefore)}\textbf{#{@content}}#{linebreak(@crafter)}'
1015
1021
  add_wiki_output '#{linebreak(@crbefore)}'''#{@content}'''#{linebreak(@crafter)}'
1022
+ #The additional space is wanted (else ** may be a itemize-list)
1023
+ add_creole_output '#{linebreak(@crbefore)} **#{@content}**#{linebreak(@crafter)}'
1016
1024
  add_text_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
1017
1025
  end #Textbf
1018
1026
 
@@ -1028,7 +1036,8 @@ Attributes are not defined for this element.
1028
1036
  class Emph < Element
1029
1037
  add_html_tag 'em'
1030
1038
  add_latex_output '#{linebreak(@crbefore)}\emph{#{@content}}#{linebreak(@crafter)}'
1031
- add_wiki_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
1039
+ #~ add_wiki_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
1040
+ add_creole_output '#{linebreak(@crbefore)}//#{@content}//#{linebreak(@crafter)}'
1032
1041
  add_text_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
1033
1042
  end #Emph
1034
1043
 
@@ -1221,7 +1230,7 @@ Attributes may be:
1221
1230
  =end
1222
1231
  class Img < Element
1223
1232
  add_id :includegraphics
1224
- has_no_content ENDTAG
1233
+ has_no_content ENDTAG #img"
1225
1234
  add_attributes HTML_ATTR_CORE
1226
1235
  add_attribute :align, HTML_ATTR_ALIGN
1227
1236
  add_attribute :src, Attribute.create([:html, :latex, :required], [ String ], 1)
@@ -1259,7 +1268,8 @@ class Verb < Element
1259
1268
  #fixme font tt
1260
1269
  #~ :html => '#{linebreak(@crbefore)}<span style = "display: inline;white-space:pre;font-family:monospace">#{@content}</span>#{linebreak(@crafter)}',
1261
1270
  add_html_output '#{linebreak(@crbefore)}<span style = "display: inline;white-space:pre;font-family:monospace">#{@content.join.gsub(/</, \'&lt;\').gsub(/>/, \'&gt;\')}</span>#{linebreak(@crafter)}'
1262
- add_latex_output '#{linebreak(@crbefore)}\verb|#{@content}|#{linebreak(@crafter)}'
1271
+ add_latex_output '#{linebreak(@crbefore)}\verb|#{@content}|#{linebreak(@crafter)}' #\verb| |
1272
+ #~ add_latex_output '#{linebreak(@crbefore)}\verb{#{@content}}#{linebreak(@crafter)}' #\verb{ }
1263
1273
  add_text_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
1264
1274
  end #Verb
1265
1275
 
@@ -76,12 +76,14 @@ or
76
76
  Minipage.new( [ attributes, [content]] )
77
77
  Attributes may be:
78
78
  * :width:
79
+ * :pos: Optional position for LaTeX
79
80
  =end
80
81
  class Minipage < Element
81
82
  add_attribute :width, Attribute.create( [ :latex, :html ], [ String ] )
83
+ add_attribute :pos, Attribute.create( [ :latex ], [ 'b', 't' ] )
82
84
  add_html_tag 'div'
83
85
  add_latex_output '#{linebreak(@crbefore)}' +
84
- '\begin{minipage}{#{@attr[:width]}}' + '#{linebreak(@crmid)}' +
86
+ '\begin{minipage}[#{@attr[:pos]}]{#{@attr[:width]}}' + '#{linebreak(@crmid)}' +
85
87
  '#{@content}' + '#{linebreak(@crmid)}' +
86
88
  '\end{minipage}' + '#{linebreak(@crafter)}'
87
89
  end #Minipage