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
@@ -7,7 +7,7 @@ module Docgenerator
7
7
  =begin rdoc
8
8
  Module to collect subclasses of class Element
9
9
  =end
10
- module Elements
10
+ module Elements
11
11
 
12
12
  #
13
13
  #Main document control.
@@ -21,35 +21,35 @@ Create an instance with
21
21
 
22
22
  Head.new( [ attributes, [content]] )
23
23
  =end
24
- class Head < Element
25
- add_html_tag 'head'
26
- add_latex_output '#{@content}'
27
- add_context_output '#{@content}'
28
- add_text_output '#{@content}'
29
- add_wiki_output '#{@content}'
30
- add_creole_output '#{@content}'
31
- end #Head
24
+ class Head < Element
25
+ add_html_tag 'head'
26
+ add_latex_output '#{@content}'
27
+ add_context_output '#{@content}'
28
+ add_text_output '#{@content}'
29
+ add_wiki_output '#{@content}'
30
+ add_creole_output '#{@content}'
31
+ end #Head
32
32
 
33
33
  =begin rdoc
34
34
  Define Docgenerator::Element ':body'
35
35
  =end
36
- class Body < Element
37
- add_attributes HTML_ATTR_CORE
38
- add_attributes HTML_ATTR_I18N
39
- add_attribute :lang, ATTR_LANG
40
- add_attribute :bgcolor, Attribute.create( [ :html ] )
41
- add_attribute :text, Attribute.create( [ :html ] )
42
- add_attribute :link, Attribute.create( [ :html ] )
43
- add_attribute :vlink, Attribute.create( [ :html ] )
44
- add_attribute :alink, Attribute.create( [ :html ] )
45
-
46
- add_html_tag 'body'
47
- add_latex_output '#{@content}'
48
- add_context_output '#{@content}'
49
- add_text_output '#{@content}'
50
- add_wiki_output '#{@content}'
51
- add_creole_output '#{@content}'
52
- end #Body
36
+ class Body < Element
37
+ add_attributes HTML_ATTR_CORE
38
+ add_attributes HTML_ATTR_I18N
39
+ add_attribute :lang, ATTR_LANG
40
+ add_attribute :bgcolor, Attribute.create( [ :html ] )
41
+ add_attribute :text, Attribute.create( [ :html ] )
42
+ add_attribute :link, Attribute.create( [ :html ] )
43
+ add_attribute :vlink, Attribute.create( [ :html ] )
44
+ add_attribute :alink, Attribute.create( [ :html ] )
45
+
46
+ add_html_tag 'body'
47
+ add_latex_output '#{@content}'
48
+ add_context_output '#{@content}'
49
+ add_text_output '#{@content}'
50
+ add_wiki_output '#{@content}'
51
+ add_creole_output '#{@content}'
52
+ end #Body
53
53
 
54
54
  =begin rdoc
55
55
  Define Element :latexdummy, :latexonly
@@ -57,28 +57,28 @@ Define Element :latexdummy, :latexonly
57
57
  Usefull, if you have LaTeX-only text in your document.
58
58
  (e.g. \\newcommands in the header).
59
59
  =end
60
- class Latexdummy < Element
61
- add_id :latexonly
62
- add_html_output ''
63
- add_latex_output '#{@content}'
64
- add_context_output ''
65
- add_text_output ''
66
- add_wiki_output ''
67
- add_creole_output ''
68
- end #Latexdummy
60
+ class Latexdummy < Element
61
+ add_id :latexonly
62
+ add_html_output ''
63
+ add_latex_output '#{@content}'
64
+ add_context_output ''
65
+ add_text_output ''
66
+ add_wiki_output ''
67
+ add_creole_output ''
68
+ end #Latexdummy
69
69
 
70
70
  =begin rdoc
71
71
  Define Element :htmldummy, :htmlonly
72
72
  =end
73
- class Htmldummy < Element
74
- add_id :htmlonly
75
- add_html_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
76
- add_latex_output ''
77
- add_context_output ''
78
- add_text_output ''
79
- add_wiki_output ''
80
- add_creole_output ''
81
- end #Htmldummy
73
+ class Htmldummy < Element
74
+ add_id :htmlonly
75
+ add_html_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
76
+ add_latex_output ''
77
+ add_context_output ''
78
+ add_text_output ''
79
+ add_wiki_output ''
80
+ add_creole_output ''
81
+ end #Htmldummy
82
82
 
83
83
 
84
84
  =begin rdoc
@@ -89,80 +89,96 @@ This parameter are better set with
89
89
  :title => 'title'
90
90
  )
91
91
  =end
92
- class Title < Element
93
- add_attributes HTML_ATTR_ALL
94
- add_attribute :short, Attribute.create( [ :html ], nil, 1 )
92
+ class Title < Element
93
+ add_attributes HTML_ATTR_ALL
94
+ add_attribute :short, Attribute.create( [ :html ], nil, 1 )
95
95
 
96
96
  =begin rdoc
97
97
  Does the LaTeX-class support the shorttitle-option?
98
98
 
99
99
  beamer.sty does it, others not.
100
100
  =end
101
- def shortoption( options = {} )
102
- @attr[:short].content.compact! #delete nils.
103
- return nil if ! @attr[:short].filled?
104
- o = set_option_defaults(options)
105
- o[:log].debug("enter shortoption") if o[:log].debug?
106
- if o[:document]
107
- #Check for known classes, which support the optional short title
108
- case o[:document].template[:latex].template
109
- when /beamer/i, /festodoc/
110
- return "[#{@attr[:short].content.join}]"
111
- else
112
- o[:log].info("No usage of option short in title") if o[:log].info?
113
- end
114
- else #no related document
115
- o[:log].info("No related document for shortoption") if o[:log].info?
116
- end
117
- return nil
118
- end
101
+ def shortoption( options = {} )
102
+ @attr[:short].content.compact! #delete nils.
103
+ return nil if ! @attr[:short].filled?
104
+ o = set_option_defaults(options)
105
+ o[:log].debug("enter shortoption") if o[:log].debug?
106
+ if o[:document]
107
+ #Check for known classes, which support the optional short title
108
+ case o[:document].template[:latex].template
109
+ when /beamer/i, /festodoc/
110
+ return "[#{@attr[:short].content.join}]"
111
+ else
112
+ o[:log].info("No usage of option short in title") if o[:log].info?
113
+ end
114
+ else #no related document
115
+ o[:log].info("No related document for shortoption") if o[:log].info?
116
+ end
117
+ return nil
118
+ end
119
119
  =begin rdoc
120
120
  Add shorttitle as a meta-tag., options should contain :log
121
121
  =end
122
- def shorttitle_html(options = {})
123
- return nil unless @attr[:short].filled?
124
- return element( :meta, {:name => 'shorttitle', :content => @attr[:short].content}).to_html(:log => options[:log])
125
- end
126
-
122
+ def shorttitle_html(options = {})
123
+ return nil unless @attr[:short].filled?
124
+ return element( :meta, {:name => 'shorttitle', :content => @attr[:short].content}).to_html(:log => options[:log])
125
+ end
126
+
127
+ =begin rdoc
128
+ Add subtitle.
129
+
130
+ subtitle is defined in koma script and used for the title page.
131
+ =end
132
+ class Subtitle < Element
133
+ #~ add_id :subtitle
134
+ add_html_output ''
135
+ add_latex_output '#{linebreak(@crbefore)}\\subtitle{#{@content}}#{linebreak(@crafter)}'
136
+ add_context_output ''
137
+ add_text_output ''
138
+ add_wiki_output ''
139
+ add_creole_output ''
140
+ end
141
+
142
+
127
143
  =begin rdoc
128
144
  Define output routines.
129
145
  =end
130
- add_output( :latex, '#{linebreak(@crbefore)}\title#{shortoption(o)}{#{@content}}#{linebreak(@crmid)}\hypersetup{pdftitle={#{@content}}}#{linebreak(@crafter)}')
131
- #~ add_output( :latex, '#{linebreak(@crbefore)}\title{#{@content}}#{linebreak(@crmid)}\hypersetup{pdftitle={#{@content}}}#{linebreak(@crafter)}')
132
- add_output( :html, '#{linebreak(@crbefore)}<title>#{@content}</title>#{linebreak(@crmid) if shorttitle_html(o)}#{shorttitle_html(o)}#{linebreak(@crafter)}')
133
-
134
- add_output( :text, "\n" + '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}' + "\n")
135
- add_output( :wiki, '#{linebreak(@crbefore)}' + '=#{@content}=' + ' #{linebreak(@crafter)}')
136
- add_output( :creole, '#{linebreak(@crbefore)}' + '=#{@content}' + ' #{linebreak(@crafter)}')
137
- end #Title
146
+ add_output( :latex, '#{linebreak(@crbefore)}\title#{shortoption(o)}{#{@content}}#{linebreak(@crmid)}\hypersetup{pdftitle={#{@content}}}#{linebreak(@crafter)}')
147
+ #~ add_output( :latex, '#{linebreak(@crbefore)}\title{#{@content}}#{linebreak(@crmid)}\hypersetup{pdftitle={#{@content}}}#{linebreak(@crafter)}')
148
+ add_output( :html, '#{linebreak(@crbefore)}<title>#{@content}</title>#{linebreak(@crmid) if shorttitle_html(o)}#{shorttitle_html(o)}#{linebreak(@crafter)}')
149
+
150
+ add_output( :text, "\n" + '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}' + "\n")
151
+ add_output( :wiki, '#{linebreak(@crbefore)}' + '=#{@content}=' + ' #{linebreak(@crafter)}')
152
+ add_output( :creole, '#{linebreak(@crbefore)}' + '=#{@content}' + ' #{linebreak(@crafter)}')
153
+ end #Title
138
154
 
139
155
  =begin rdoc
140
156
  Define Element :meta
141
157
  =end
142
- class Meta < Element
143
- has_no_content false
144
- add_attribute :name, Attribute.create( [ :html, :required ], nil, 1 )
145
- add_attribute :content, Attribute.create( [ :html, :required ], nil, 2 )
146
- add_html_tag 'meta'
147
- add_latex_output ''
148
- add_context_output ''
149
- add_wiki_output ''
150
- add_creole_output ''
151
- add_text_output ''
152
- end #Meta
158
+ class Meta < Element
159
+ has_no_content false
160
+ add_attribute :name, Attribute.create( [ :html, :required ], nil, 1 )
161
+ add_attribute :content, Attribute.create( [ :html, :required ], nil, 2 )
162
+ add_html_tag 'meta'
163
+ add_latex_output ''
164
+ add_context_output ''
165
+ add_wiki_output ''
166
+ add_creole_output ''
167
+ add_text_output ''
168
+ end #Meta
153
169
 
154
170
  =begin rdoc
155
171
  Define Element :meta2
156
172
 
157
173
  Like Meta, but without name.
158
174
  =end
159
- class Meta2 < Element
160
- has_no_content ENDTAG #meta w/o name
161
- add_attribute :"http-equiv", Attribute.create( [ :html, :required ], nil, 1 )
162
- add_attribute :content, Attribute.create( [ :html, :required ], nil, 2 )
163
- add_html_tag 'meta'
164
- add_latex_output ''
165
- end #Meta2
175
+ class Meta2 < Element
176
+ has_no_content ENDTAG #meta w/o name
177
+ add_attribute :"http-equiv", Attribute.create( [ :html, :required ], nil, 1 )
178
+ add_attribute :content, Attribute.create( [ :html, :required ], nil, 2 )
179
+ add_html_tag 'meta'
180
+ add_latex_output ''
181
+ end #Meta2
166
182
 
167
183
  =begin rdoc
168
184
  Define Element :author
@@ -174,10 +190,10 @@ or
174
190
 
175
191
  Attributes are not defined for this element.
176
192
  =end
177
- class Author < Element
178
- add_html_output '<meta name="author" content="#{@content}"> #{linebreak(@crafter)}'
179
- add_latex_output '#{linebreak(@crbefore)}\author{#{@content}}#{linebreak(@crmid)}\hypersetup{pdfauthor={#{@content}}}#{linebreak(@crafter)}'
180
- end #Author
193
+ class Author < Element
194
+ add_html_output '<meta name="author" content="#{@content}"> #{linebreak(@crafter)}'
195
+ add_latex_output '#{linebreak(@crbefore)}\author{#{@content}}#{linebreak(@crmid)}\hypersetup{pdfauthor={#{@content}}}#{linebreak(@crafter)}'
196
+ end #Author
181
197
 
182
198
  =begin rdoc
183
199
  Define Element :date
@@ -187,10 +203,10 @@ Create an instance with
187
203
  or
188
204
  Date.new( [ attributes, [content]] )
189
205
  =end
190
- class Date < Element
191
- add_html_output '<meta name="creation-date" content="#{@content}"> #{linebreak(@crafter)}'
192
- add_latex_output '#{linebreak(@crbefore)}\date{#{@content}}#{linebreak(@crafter)}'
193
- end #Date
206
+ class Date < Element
207
+ add_html_output '<meta name="creation-date" content="#{@content}"> #{linebreak(@crafter)}'
208
+ add_latex_output '#{linebreak(@crbefore)}\date{#{@content}}#{linebreak(@crafter)}'
209
+ end #Date
194
210
 
195
211
  =begin rdoc
196
212
  Define Element :keywords
@@ -202,10 +218,10 @@ or
202
218
 
203
219
  Attributes are not defined for this element.
204
220
  =end
205
- class Keywords < Element
206
- add_html_output '<meta name="keywords" content="#{@content}"> #{linebreak(@crafter)}'
207
- add_latex_output '#{linebreak(@crbefore)}\hypersetup{pdfkeywords={#{@content}}}#{linebreak(@crafter)}'
208
- end #Keywords
221
+ class Keywords < Element
222
+ add_html_output '<meta name="keywords" content="#{@content}"> #{linebreak(@crafter)}'
223
+ add_latex_output '#{linebreak(@crbefore)}\hypersetup{pdfkeywords={#{@content}}}#{linebreak(@crafter)}'
224
+ end #Keywords
209
225
 
210
226
  =begin rdoc
211
227
  Define Element :metadescription
@@ -217,10 +233,10 @@ or
217
233
 
218
234
  Attributes are not defined for this element.
219
235
  =end
220
- class Metadescription < Element
221
- add_html_output '<meta name="description" content="#{@content}"> #{linebreak(@crafter)}'
222
- add_latex_output '#{linebreak(@crbefore)}\hypersetup{pdfsubject={#{@content}}}#{linebreak(@crafter)}'
223
- end #Metadescription
236
+ class Metadescription < Element
237
+ add_html_output '<meta name="description" content="#{@content}"> #{linebreak(@crafter)}'
238
+ add_latex_output '#{linebreak(@crbefore)}\hypersetup{pdfsubject={#{@content}}}#{linebreak(@crafter)}'
239
+ end #Metadescription
224
240
 
225
241
  =begin rdoc
226
242
  Define Element :creator
@@ -231,10 +247,10 @@ or
231
247
  Creator.new( [ attributes, [content]] )
232
248
  Attributes are not defined for this element.
233
249
  =end
234
- class Creator < Element
235
- add_html_output '<meta name="creator" content="#{@content}"> #{linebreak(@crafter)}'
236
- add_latex_output '#{linebreak(@crbefore)}\hypersetup{pdfcreator={#{@content}}}#{linebreak(@crafter)}'
237
- end #Creator
250
+ class Creator < Element
251
+ add_html_output '<meta name="creator" content="#{@content}"> #{linebreak(@crafter)}'
252
+ add_latex_output '#{linebreak(@crbefore)}\hypersetup{pdfcreator={#{@content}}}#{linebreak(@crafter)}'
253
+ end #Creator
238
254
 
239
255
  =begin rdoc
240
256
  Define Element :maketitle
@@ -245,12 +261,12 @@ or
245
261
  Maketitle.new( [ attributes, [content]] )
246
262
  Attributes are not defined for this element.
247
263
  =end
248
- class Maketitle < Element
249
- has_no_content false
250
- add_html_tag 'span'
251
- add_html_output "<!-- maketitle -->\n"
252
- add_latex_output '#{linebreak(@crbefore)}\maketitle #{linebreak(@crafter)}'
253
- end #Maketitle
264
+ class Maketitle < Element
265
+ has_no_content false
266
+ add_html_tag 'span'
267
+ add_html_output "<!-- maketitle -->\n"
268
+ add_latex_output '#{linebreak(@crbefore)}\maketitle #{linebreak(@crafter)}'
269
+ end #Maketitle
254
270
 
255
271
  =begin rdoc
256
272
  Build table of contents.
@@ -259,61 +275,61 @@ This element requires a related document.
259
275
 
260
276
  For LaTeX \tableofcontents is created, with attribute :as_list you can create a list.
261
277
  =end
262
- class Tableofcontents < Element
263
-
264
- add_attributes HTML_ATTR_ALL
265
- add_attribute :level , Attribute.create( [ :html, :latex ], [Fixnum], 1 )
266
- add_attribute :pre , Attribute.create( [ :html, :latex ], nil, 2 )
267
- add_attribute :post , Attribute.create( [ :html, :latex ], nil, 2 )
268
- add_attribute :as_list , Attribute.create( [ :latex ], [true, false], 2 )
269
-
270
- has_no_content false
271
-
272
- def to_doc( target, options = {} )
273
- o = set_option_defaults(options)
274
- o[:log].debug("enter to_doc(#{target}) for #{self.inspect}, options: #{options.keys.inspect}") if o[:log].debug?
275
- tocoptions = {
276
- :level => @attr[:level].content.first,
277
- :pre => @attr[:pre].content,
278
- :post => @attr[:post].content,
279
- :as_list => @attr[:as_list].content.first,
280
- }.update(o)
281
- tocoptions[:level] = 3 unless tocoptions[:level]
282
- case target
283
- when :latex
284
- if @attr[:as_list].content.first
285
- if o[:document]
286
- return o[:document].toc(tocoptions).to_doc(target, options)
287
- else
288
- o[:log].error("No related document for tableofcontents") if o[:log].error?
289
- return ''
290
- end
291
- else
292
- return "#{linebreak(@crbefore)}\\tableofcontents #{linebreak(@crafter)}"
278
+ class Tableofcontents < Element
279
+
280
+ add_attributes HTML_ATTR_ALL
281
+ add_attribute :level , Attribute.create( [ :html, :latex ], [Fixnum], 1 )
282
+ add_attribute :pre , Attribute.create( [ :html, :latex ], nil, 2 )
283
+ add_attribute :post , Attribute.create( [ :html, :latex ], nil, 2 )
284
+ add_attribute :as_list , Attribute.create( [ :latex ], [true, false], 2 )
285
+
286
+ has_no_content false
287
+
288
+ def to_doc( target, options = {} )
289
+ o = set_option_defaults(options)
290
+ o[:log].debug("enter to_doc(#{target}) for #{self.inspect}, options: #{options.keys.inspect}") if o[:log].debug?
291
+ tocoptions = {
292
+ :level => @attr[:level].content.first,
293
+ :pre => @attr[:pre].content,
294
+ :post => @attr[:post].content,
295
+ :as_list => @attr[:as_list].content.first,
296
+ }.update(o)
297
+ tocoptions[:level] = 3 unless tocoptions[:level]
298
+ case target
299
+ when :latex
300
+ if @attr[:as_list].content.first
301
+ if o[:document]
302
+ return o[:document].toc(tocoptions).to_doc(target, options)
303
+ else
304
+ o[:log].error("No related document for tableofcontents") if o[:log].error?
305
+ return ''
306
+ end
307
+ else
308
+ return "#{linebreak(@crbefore)}\\tableofcontents #{linebreak(@crafter)}"
309
+ end
310
+ when :html
311
+ return to_html(tocoptions)
312
+ when :wiki, :text
313
+ if o[:document]
314
+ return o[:document].toc(tocoptions).to_doc(target, options)
315
+ else
316
+ o[:log].error("No related document for tableofcontents") if o[:log].error?
317
+ return ''
318
+ end
293
319
  end
294
- when :html
295
- return to_html(tocoptions)
296
- when :wiki, :text
320
+ end
321
+ #Build toc, if there is a related document.
322
+ def to_html( options = {} )
323
+ o = set_option_defaults(options)
324
+ o[:log].debug("enter to_html for #{self.inspect}, options: #{options.keys.inspect}") if o[:log].debug?
297
325
  if o[:document]
298
- return o[:document].toc(tocoptions).to_doc(target, options)
326
+ return o[:document].toc(options).to_html(options)
299
327
  else
300
328
  o[:log].error("No related document for tableofcontents") if o[:log].error?
301
- return ''
329
+ return "#{linebreak(@crbefore)}<!-- tableofcontents -->#{linebreak(@crafter)}"
302
330
  end
331
+ end
303
332
  end
304
- end
305
- #Build toc, if there is a related document.
306
- def to_html( options = {} )
307
- o = set_option_defaults(options)
308
- o[:log].debug("enter to_html for #{self.inspect}, options: #{options.keys.inspect}") if o[:log].debug?
309
- if o[:document]
310
- return o[:document].toc(options).to_html(options)
311
- else
312
- o[:log].error("No related document for tableofcontents") if o[:log].error?
313
- return "#{linebreak(@crbefore)}<!-- tableofcontents -->#{linebreak(@crafter)}"
314
- end
315
- end
316
- end
317
333
 
318
334
  =begin rdoc
319
335
  Define Element :listoffigures
@@ -324,10 +340,10 @@ or
324
340
  Listoffigures.new( [ attributes, [content]] )
325
341
  Attributes are not defined for this element.
326
342
  =end
327
- class Listoffigures < Element
328
- has_no_content false
329
- add_latex_output '#{linebreak(@crbefore)}\listoffigures #{linebreak(@crafter)}'
330
- end #Listoffigures
343
+ class Listoffigures < Element
344
+ has_no_content false
345
+ add_latex_output '#{linebreak(@crbefore)}\listoffigures #{linebreak(@crafter)}'
346
+ end #Listoffigures
331
347
 
332
348
 
333
349
  =begin rdoc
@@ -341,11 +357,11 @@ Attributes may be:
341
357
  * :file: [ 'toc', 'lof', 'lot' ]
342
358
  * :depth: [ -1, 0,1,2,3,4,5,6]
343
359
  =end
344
- class Addcontentsline < Element
345
- add_attribute :file, Attribute.create( [ :latex, :required ], [ 'toc', 'lof', 'lot' ] )
346
- add_attribute :depth, Attribute.create( [ :latex, :required ], [ -1, 0,1,2,3,4,5,6] )
347
- add_latex_output '#{linebreak(@crbefore)}\addcontentsline{#{@attr[:file]}}{#{@attr[:depth]}}{#{@content}} #{linebreak(@crafter)}'
348
- end #Addcontentsline
360
+ class Addcontentsline < Element
361
+ add_attribute :file, Attribute.create( [ :latex, :required ], [ 'toc', 'lof', 'lot' ] )
362
+ add_attribute :depth, Attribute.create( [ :latex, :required ], [ -1, 0,1,2,3,4,5,6] )
363
+ add_latex_output '#{linebreak(@crbefore)}\addcontentsline{#{@attr[:file]}}{#{@attr[:depth]}}{#{@content}} #{linebreak(@crafter)}'
364
+ end #Addcontentsline
349
365
 
350
366
  =begin rdoc
351
367
  Define Element :addtocontents
@@ -357,10 +373,10 @@ or
357
373
  Attributes may be:
358
374
  * :file: [ 'toc', 'lof', 'lot' ]
359
375
  =end
360
- class Addtocontents < Element
361
- add_attribute :file, Attribute.create( [ :latex, :required ], [ 'toc', 'lof', 'lot' ] )
362
- add_latex_output '#{linebreak(@crbefore)}\addtocontents{#{@attr[:file]}}{#{@content}} #{linebreak(@crafter)}'
363
- end #Addtocontents
376
+ class Addtocontents < Element
377
+ add_attribute :file, Attribute.create( [ :latex, :required ], [ 'toc', 'lof', 'lot' ] )
378
+ add_latex_output '#{linebreak(@crbefore)}\addtocontents{#{@attr[:file]}}{#{@content}} #{linebreak(@crafter)}'
379
+ end #Addtocontents
364
380
 
365
381
  =begin rdoc
366
382
  Define Element :par, :p
@@ -378,19 +394,19 @@ Attributes may be:
378
394
  * HTML_ATTR_EVENTS
379
395
  * :lang, ATTR_LANG
380
396
  =end
381
- class Par < Element
382
- add_id :p
383
- add_attributes HTML_ATTR_CORE
384
- add_attributes HTML_ATTR_I18N
385
- add_attributes HTML_ATTR_EVENTS
386
- add_attribute :lang, ATTR_LANG
387
- add_html_tag 'p'
388
- add_latex_output "\n\n" + '#{@content}' + "\n\n"
389
- add_context_output "\n\n" + '#{@content}' + "\n\n"
390
- add_text_output "\n" + '#{@content}' + "\n"
391
- add_wiki_output "\n" + '#{@content}' + "\n"
392
- add_creole_output "\n" + '#{@content}' + "\n\n"
393
- end #Par
397
+ class Par < Element
398
+ add_id :p
399
+ add_attributes HTML_ATTR_CORE
400
+ add_attributes HTML_ATTR_I18N
401
+ add_attributes HTML_ATTR_EVENTS
402
+ add_attribute :lang, ATTR_LANG
403
+ add_html_tag 'p'
404
+ add_latex_output "\n\n" + '#{@content}' + "\n\n"
405
+ add_context_output "\n\n" + '#{@content}' + "\n\n"
406
+ add_text_output "\n" + '#{@content}' + "\n"
407
+ add_wiki_output "\n" + '#{@content}' + "\n"
408
+ add_creole_output "\n" + '#{@content}' + "\n\n"
409
+ end #Par
394
410
 
395
411
  =begin rdoc
396
412
  Define Element :nobr
@@ -405,14 +421,14 @@ Attributes may be:
405
421
  * HTML_ATTR_EVENTS
406
422
  * :lang, ATTR_LANG
407
423
  =end
408
- class Nobr < Element
409
- add_attributes HTML_ATTR_CORE
410
- add_attributes HTML_ATTR_I18N
411
- add_attributes HTML_ATTR_EVENTS
412
- add_attribute :lang, ATTR_LANG
413
- add_html_tag 'nobr'
414
- add_latex_output '#{linebreak(@crbefore)}\mbox{#{@content}}#{linebreak(@crafter)}'
415
- end #Nobr
424
+ class Nobr < Element
425
+ add_attributes HTML_ATTR_CORE
426
+ add_attributes HTML_ATTR_I18N
427
+ add_attributes HTML_ATTR_EVENTS
428
+ add_attribute :lang, ATTR_LANG
429
+ add_html_tag 'nobr'
430
+ add_latex_output '#{linebreak(@crbefore)}\mbox{#{@content}}#{linebreak(@crafter)}'
431
+ end #Nobr
416
432
 
417
433
  =begin rdoc
418
434
  Define Element :br, "br/", "br", :newline
@@ -427,18 +443,18 @@ or
427
443
  Attributes may be:
428
444
  * :clear: ['all']
429
445
  =end
430
- class Newline < Element
431
- add_id "br/"
432
- add_id "br"
433
- add_id :br
434
- has_no_content ENDTAG #br
435
- add_attribute :clear, Attribute.create( [ :html ], ['all'] )
436
- add_html_tag 'br'
437
- add_latex_output '#{linebreak(@crbefore)}\newline #{linebreak(@crafter)}'
438
- add_text_output "\n"
439
- add_wiki_output '{{newline}}#{linebreak(@crafter)}'
440
- add_creole_output '\\\\#{linebreak(@crafter)}'
441
- end #Br
446
+ class Newline < Element
447
+ add_id "br/"
448
+ add_id "br"
449
+ add_id :br
450
+ has_no_content ENDTAG #br
451
+ add_attribute :clear, Attribute.create( [ :html ], ['all'] )
452
+ add_html_tag 'br'
453
+ add_latex_output '#{linebreak(@crbefore)}\newline #{linebreak(@crafter)}'
454
+ add_text_output "\n"
455
+ add_wiki_output '{{newline}}#{linebreak(@crafter)}'
456
+ add_creole_output '\\\\#{linebreak(@crafter)}'
457
+ end #Br
442
458
 
443
459
  =begin rdoc
444
460
  Define Element :hr, "hr/", "hr", :hrulefill
@@ -453,18 +469,50 @@ or
453
469
  Attributes may be:
454
470
  * :clear:
455
471
  =end
456
- class Hrulefill < Element
457
- add_id "hr/"
458
- add_id "hr"
459
- add_id :hr
460
- has_no_content ENDTAG #hr
461
- add_attribute :clear, Attribute.create( [ :html ], ['all'] )
462
- add_html_tag 'hr'
463
- add_wiki_output '----'
464
- add_text_output '-------------------------'
465
- add_latex_output '#{linebreak(@crbefore)}\hrulefill #{linebreak(@crafter)}'
466
- end #Hr
472
+ class Hrulefill < Element
473
+ add_id "hr/"
474
+ add_id "hr"
475
+ add_id :hr
476
+ has_no_content ENDTAG #hr
477
+ add_attribute :clear, Attribute.create( [ :html ], ['all'] )
478
+ add_html_tag 'hr'
479
+ add_wiki_output '----'
480
+ add_text_output '-------------------------'
481
+ add_latex_output '#{linebreak(@crbefore)}\hrulefill #{linebreak(@crafter)}'
482
+ end #Hr
467
483
 
484
+ =begin rdoc
485
+ Define Element :pagestyle
486
+
487
+ Create an instance with
488
+ element( :pagestyle, [ attributes, [content]] )
489
+ or
490
+ Pagestyle.new( [ attributes, [content]] )
491
+ Attributes are not defined for this element.
492
+
493
+ See also Docgenerator::Packages::Scrpage2
494
+ =end
495
+ class Pagestyle < Element
496
+ #fixme check content only scrheadings, scrplain
497
+ add_latex_output '#{linebreak(@crbefore)}\pagestyle{#{@content}}#{linebreak(@crafter)}'
498
+ end #Pagestyle
499
+
500
+ =begin rdoc
501
+ Define Element :pagestyle
502
+
503
+ Create an instance with
504
+ element( :pagestyle, [ attributes, [content]] )
505
+ or
506
+ Pagestyle.new( [ attributes, [content]] )
507
+ Attributes are not defined for this element.
508
+
509
+ See also Docgenerator::Packages::Scrpage2
510
+ =end
511
+ class Thispagestyle < Element
512
+ #fixme check content only headings, plain...
513
+ add_latex_output '#{linebreak(@crbefore)}\thispagestyle{#{@content}}#{linebreak(@crafter)}'
514
+ end #Pagestyle
515
+
468
516
  =begin rdoc
469
517
  Define Element :vspace
470
518
 
@@ -474,12 +522,12 @@ or
474
522
  Vspace.new( [ attributes, [content]] )
475
523
  Attributes are not defined for this element.
476
524
  =end
477
- class Vspace < Element
478
- add_latex_output '#{linebreak(@crbefore)}\vspace{#{@content}} #{linebreak(@crafter)}'
479
- #:htmltag => 'hr',
480
- #~ :wiki => '----',
481
- #~ :text => '-' * 25,
482
- end #Vspace
525
+ class Vspace < Element
526
+ add_latex_output '#{linebreak(@crbefore)}\vspace{#{@content}} #{linebreak(@crafter)}'
527
+ #:htmltag => 'hr',
528
+ #~ :wiki => '----',
529
+ #~ :text => '-' * 25,
530
+ end #Vspace
483
531
 
484
532
  =begin rdoc
485
533
  Define Element :hspace
@@ -492,9 +540,9 @@ Attributes are not defined for this element.
492
540
 
493
541
  Only for LaTeX
494
542
  =end
495
- class Hspace < Element
496
- add_latex_output '#{linebreak(@crbefore)}\hspace{#{@content}} #{linebreak(@crafter)}'
497
- end #Hspace
543
+ class Hspace < Element
544
+ add_latex_output '#{linebreak(@crbefore)}\hspace{#{@content}} #{linebreak(@crafter)}'
545
+ end #Hspace
498
546
 
499
547
  =begin rdoc
500
548
  Define Element :vfill
@@ -507,10 +555,10 @@ Attributes are not defined for this element.
507
555
 
508
556
  Only for LaTeX
509
557
  =end
510
- class Vfill < Element
511
- has_no_content
512
- add_latex_output '#{linebreak(@crbefore)}\vfill #{linebreak(@crafter)}'
513
- end #Vfill
558
+ class Vfill < Element
559
+ has_no_content
560
+ add_latex_output '#{linebreak(@crbefore)}\vfill #{linebreak(@crafter)}'
561
+ end #Vfill
514
562
 
515
563
  =begin rdoc
516
564
  Define Element :hfill
@@ -523,10 +571,10 @@ Attributes are not defined for this element.
523
571
 
524
572
  Only for LaTeX
525
573
  =end
526
- class Hfill < Element
527
- has_no_content false
528
- add_latex_output '#{linebreak(@crbefore)}\hfill #{linebreak(@crafter)}'
529
- end #Hfill
574
+ class Hfill < Element
575
+ has_no_content false
576
+ add_latex_output '#{linebreak(@crbefore)}\hfill #{linebreak(@crafter)}'
577
+ end #Hfill
530
578
 
531
579
  =begin rdoc
532
580
  Define Element :relax
@@ -537,11 +585,11 @@ or
537
585
  Relax.new( [ attributes, [content]] )
538
586
  Attributes are not defined for this element.
539
587
  =end
540
- class Relax < Element
541
- has_no_content
542
- add_html_tag nil
543
- add_latex_output '#{linebreak(@crbefore)}\relax #{linebreak(@crafter)}'
544
- end #Relax
588
+ class Relax < Element
589
+ has_no_content
590
+ add_html_tag nil
591
+ add_latex_output '#{linebreak(@crbefore)}\relax #{linebreak(@crafter)}'
592
+ end #Relax
545
593
 
546
594
 
547
595
  =begin rdoc
@@ -557,12 +605,12 @@ or
557
605
  Attributes may be:
558
606
  * HTML_ATTR_CORE
559
607
  =end
560
- class Span < Element
561
- add_id :group
562
- add_attributes HTML_ATTR_CORE
563
- add_html_tag 'span'
564
- add_latex_output '#{linebreak(@crbefore)}\bgroup #{linebreak(@crmid)}#{@content}#{linebreak(@crmid)}\egroup #{linebreak(@crafter)}'
565
- end #Span
608
+ class Span < Element
609
+ add_id :group
610
+ add_attributes HTML_ATTR_CORE
611
+ add_html_tag 'span'
612
+ add_latex_output '#{linebreak(@crbefore)}\bgroup #{linebreak(@crmid)}#{@content}#{linebreak(@crmid)}\egroup #{linebreak(@crafter)}'
613
+ end #Span
566
614
 
567
615
  =begin rdoc
568
616
  Define Element :div, :Group
@@ -579,16 +627,16 @@ Attributes may be:
579
627
  * :style:
580
628
  * :title:
581
629
  =end
582
- class Div < Element
583
- add_id :Group
584
- add_attributes HTML_ATTR_CORE
585
- add_attribute :align, HTML_ATTR_ALIGN
586
- add_html_tag 'div'
587
- add_latex_output '#{linebreak(@crbefore)}\begingroup #{linebreak(@crmid)}#{@content}#{linebreak(@crmid)}\endgroup #{linebreak(@crafter)}'
588
- add_text_output '#{@content}'
589
- add_wiki_output '#{@content}'
590
- add_creole_output '#{@content}'
591
- end #Div
630
+ class Div < Element
631
+ add_id :Group
632
+ add_attributes HTML_ATTR_CORE
633
+ add_attribute :align, HTML_ATTR_ALIGN
634
+ add_html_tag 'div'
635
+ add_latex_output '#{linebreak(@crbefore)}\begingroup #{linebreak(@crmid)}#{@content}#{linebreak(@crmid)}\endgroup #{linebreak(@crafter)}'
636
+ add_text_output '#{@content}'
637
+ add_wiki_output '#{@content}'
638
+ add_creole_output '#{@content}'
639
+ end #Div
592
640
 
593
641
 
594
642
  =begin rdoc
@@ -602,11 +650,11 @@ or
602
650
  Sepline.new( [ attributes, [content]] )
603
651
  Attributes are not defined for this element.
604
652
  =end
605
- class Sepline < Element
606
- has_no_content false
607
- add_html_output "\n<!--" + '-' * 50 + " -->\n"
608
- add_latex_output "\n%" + '-' * 50 + "\n"
609
- end #Sepline
653
+ class Sepline < Element
654
+ has_no_content false
655
+ add_html_output "\n<!--" + '-' * 50 + " -->\n"
656
+ add_latex_output "\n%" + '-' * 50 + "\n"
657
+ end #Sepline
610
658
 
611
659
  =begin rdoc
612
660
  Define Element :comment
@@ -619,10 +667,23 @@ or
619
667
  Comment.new( [ attributes, [content]] )
620
668
  Attributes are not defined for this element.
621
669
  =end
622
- class Comment < Element
623
- add_html_tag '<!-- #{@content} -->'
624
- add_latex_output '#{linebreak(@crbefore)}% ------- #{@content} ------- #{linebreak(@crafter)}'
625
- end #Comment
670
+ class Comment < Element
671
+ add_html_output '<!-- #{@content} -->'
672
+ #~ add_latex_output '#{linebreak(@crbefore)}#{@content.gsub(/^/, "%")}#{linebreak(@crafter)}'
673
+ def to_latex( options = {} )
674
+ cmd = linebreak(@crbefore)
675
+ cmd << "%"
676
+ content = @content.to_latex(options)
677
+ if content =~ /\n/
678
+ cmd << content.gsub(/\n/, "\n%")
679
+ else
680
+ cmd << content
681
+ end
682
+ cmd << "\n"
683
+ cmd << linebreak(@crafter)
684
+ end
685
+
686
+ end #Comment
626
687
 
627
688
  =begin rdoc
628
689
  Define Element :url
@@ -641,15 +702,15 @@ Attributes may be:
641
702
  * HTML_ATTR_EVENTS
642
703
  * ATTR_LANG
643
704
  =end
644
- class Url < Element
645
- add_attributes HTML_ATTR_CORE
646
- add_attributes HTML_ATTR_I18N
647
- add_attributes HTML_ATTR_EVENTS
648
- add_attribute :lang, ATTR_LANG
649
- add_html_output '#{linebreak(@crbefore)}<a href = "#{@content}">#{@content}</a>#{linebreak(@crafter)}'
650
- add_latex_output '#{linebreak(@crbefore)}\url{#{@content}}#{linebreak(@crafter)}'
651
- add_text_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
652
- end #Url
705
+ class Url < Element
706
+ add_attributes HTML_ATTR_CORE
707
+ add_attributes HTML_ATTR_I18N
708
+ add_attributes HTML_ATTR_EVENTS
709
+ add_attribute :lang, ATTR_LANG
710
+ add_html_output '#{linebreak(@crbefore)}<a href = "#{@content}">#{@content}</a>#{linebreak(@crafter)}'
711
+ add_latex_output '#{linebreak(@crbefore)}\url{#{@content}}#{linebreak(@crafter)}'
712
+ add_text_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
713
+ end #Url
653
714
 
654
715
  =begin rdoc
655
716
  Define Element :ensuremath
@@ -660,11 +721,11 @@ or
660
721
  Ensuremath.new( [ attributes, [content]] )
661
722
  Attributes are not defined for this element.
662
723
  =end
663
- class Ensuremath < Element
664
- add_html_output '#{@content}'
665
- add_latex_output '\ensuremath{#{@content}}'
666
- add_context_output '\math{#{@content}}' #http://www.ntg.nl/pipermail/ntg-context/2010/051451.html
667
- end #Ensuremath
724
+ class Ensuremath < Element
725
+ add_html_output '#{@content}'
726
+ add_latex_output '\ensuremath{#{@content}}'
727
+ add_context_output '\math{#{@content}}' #http://www.ntg.nl/pipermail/ntg-context/2010/051451.html
728
+ end #Ensuremath
668
729
 
669
730
  =begin rdoc
670
731
  Internal reference
@@ -673,46 +734,46 @@ The corresponding label should be defined in the same document/file.
673
734
 
674
735
  For external links use :href.
675
736
  =end
676
- class Href < Element
677
- add_id :a
678
- add_attribute :href, Attribute.create( [ :html, :required ], [String], 1 )
679
- add_attribute :hreflang, ATTR_LANG
680
- add_attribute :alt, Attribute.create( [ :html ], [String], 2 )
681
- add_attribute :name, Attribute.create( [ :html ], [String] )
682
- add_attribute :longdesc, Attribute.create( [ :html ], [String] )
683
- add_attribute :value, Attribute.create( [ :html ] )
684
- add_attribute :shape, Attribute.create( [ :html ] )
685
- add_attribute :coords,Attribute.create( [ :html ] )
686
- add_attribute :target, Attribute.create( [ :html ], [ '_blank', '_parent', '_self', '_top' ] )
687
- add_attributes HTML_ATTR_ALL
688
- add_html_tag 'a'
689
- def to_wiki( options = {} )
690
- "[#{@attr[:href].to_s} #{@content.to_doc(:wiki, options)}]"
691
- end
692
- def to_creole( options = {} )
693
- "[[#{@attr[:href].to_s}|#{@content.to_doc(:creole, options)}]]"
694
- end
695
- def to_latex( options = {} )
696
- cmd = linebreak(@crbefore)
697
- reference = @attr[:href].to_s
698
- if reference.sub!(/\A\#/, '') #Internal reference
699
- cmd << "\\hyperlink{#{reference}}{#{@content.to_doc(:latex, options)}}"
700
- else #external reference
701
- #reference may not contain unmasked % or #
702
- cmd << "\\href{#{reference}}{#{@content.to_doc(:latex, options)}}"
703
- end
704
- cmd << linebreak(@crafter)
705
- cmd
706
- end
707
- def to_text( options = {} )
708
- if @attr[:href].to_s == @content
709
- @content.to_doc(:text, options)
710
- else
711
- #~ "<#{@attr[:href].to_s} #{@content}>" --> Problem: Wird gerne als komplette URL interpreitert
712
- "#{@content.to_doc(:text, options)} (#{@attr[:href].to_s})"
737
+ class Href < Element
738
+ add_id :a
739
+ add_attribute :href, Attribute.create( [ :html, :required ], [String], 1 )
740
+ add_attribute :hreflang, ATTR_LANG
741
+ add_attribute :alt, Attribute.create( [ :html ], [String], 2 )
742
+ add_attribute :name, Attribute.create( [ :html ], [String] )
743
+ add_attribute :longdesc, Attribute.create( [ :html ], [String] )
744
+ add_attribute :value, Attribute.create( [ :html ] )
745
+ add_attribute :shape, Attribute.create( [ :html ] )
746
+ add_attribute :coords,Attribute.create( [ :html ] )
747
+ add_attribute :target, Attribute.create( [ :html ], [ '_blank', '_parent', '_self', '_top' ] )
748
+ add_attributes HTML_ATTR_ALL
749
+ add_html_tag 'a'
750
+ def to_wiki( options = {} )
751
+ "[#{@attr[:href].to_s} #{@content.to_doc(:wiki, options)}]"
752
+ end
753
+ def to_creole( options = {} )
754
+ "[[#{@attr[:href].to_s}|#{@content.to_doc(:creole, options)}]]"
755
+ end
756
+ def to_latex( options = {} )
757
+ cmd = linebreak(@crbefore)
758
+ reference = @attr[:href].to_s
759
+ if reference.sub!(/\A\#/, '') #Internal reference
760
+ cmd << "\\hyperlink{#{reference}}{#{@content.to_doc(:latex, options)}}"
761
+ else #external reference
762
+ #reference may not contain unmasked % or #
763
+ cmd << "\\href{#{reference}}{#{@content.to_doc(:latex, options)}}"
764
+ end
765
+ cmd << linebreak(@crafter)
766
+ cmd
767
+ end
768
+ def to_text( options = {} )
769
+ if @attr[:href].to_s == @content
770
+ @content.to_doc(:text, options)
771
+ else
772
+ #~ "<#{@attr[:href].to_s} #{@content}>" --> Problem: Wird gerne als komplette URL interpreitert
773
+ "#{@content.to_doc(:text, options)} (#{@attr[:href].to_s})"
774
+ end
775
+ end
713
776
  end
714
- end
715
- end
716
777
 
717
778
  =begin rdoc
718
779
  Define Element :label
@@ -728,17 +789,17 @@ Attributes may be:
728
789
  * HTML_ATTR_EVENTS
729
790
  * ATTR_LANG
730
791
  =end
731
- class Label < Element
732
- add_attributes HTML_ATTR_CORE
733
- add_attributes HTML_ATTR_I18N
734
- add_attributes HTML_ATTR_EVENTS
735
- add_attribute :lang, ATTR_LANG
736
- add_attribute :name, Attribute.create( [ :html, :latex, :required ] )
737
- add_html_output '#{linebreak(@crbefore)}<a name="#{@attr[:name]}">#{linebreak(@crmid)}#{@content}</a>#{linebreak(@crafter)}'
738
- add_latex_output '#{linebreak(@crbefore)}\label{#{@attr[:name]}}#{linebreak(@crmid)}\hypertarget{#{@attr[:name]}}{#{@content}}#{linebreak(@crafter)}'
739
- add_text_output '(#{@attr[:name]}) #{@content}'
740
- add_wiki_output '#{linebreak(@crbefore)}[[??#{@attr[:name]}]]#{@content}#{linebreak(@crafter)}'
741
- end #Label
792
+ class Label < Element
793
+ add_attributes HTML_ATTR_CORE
794
+ add_attributes HTML_ATTR_I18N
795
+ add_attributes HTML_ATTR_EVENTS
796
+ add_attribute :lang, ATTR_LANG
797
+ add_attribute :name, Attribute.create( [ :html, :latex, :required ] )
798
+ add_html_output '#{linebreak(@crbefore)}<a name="#{@attr[:name]}">#{linebreak(@crmid)}#{@content}</a>#{linebreak(@crafter)}'
799
+ add_latex_output '#{linebreak(@crbefore)}\label{#{@attr[:name]}}#{linebreak(@crmid)}\hypertarget{#{@attr[:name]}}{#{@content}}#{linebreak(@crafter)}'
800
+ add_text_output '(#{@attr[:name]}) #{@content}'
801
+ add_wiki_output '#{linebreak(@crbefore)}[[??#{@attr[:name]}]]#{@content}#{linebreak(@crafter)}'
802
+ end #Label
742
803
 
743
804
  =begin rdoc
744
805
  Define Element :hypertarget
@@ -759,19 +820,19 @@ Attributes may be:
759
820
  * HTML_ATTR_EVENTS
760
821
  * ATTR_LANG
761
822
  =end
762
- class Hypertarget < Element
763
- add_attributes HTML_ATTR_CORE
764
- add_attributes HTML_ATTR_I18N
765
- add_attributes HTML_ATTR_EVENTS
766
- add_attribute :lang, ATTR_LANG
767
- add_attribute :href, Attribute.create( [ :html, :required ] )
768
- add_attribute :alt, Attribute.create( [ :html ] )
769
- add_attribute :longdesc, Attribute.create( [ :html ] )
770
- add_attribute :value, Attribute.create( [ :html ] )
771
- add_attribute :shape, Attribute.create( [ :html ] )
772
- add_attribute :coords, Attribute.create( [ :html ] )
773
- add_latex_output '#{linebreak(@crbefore)}\hypertarget{#{@attr[:href]}}{#{@content}}#{linebreak(@crafter)}'
774
- end #Hypertarget
823
+ class Hypertarget < Element
824
+ add_attributes HTML_ATTR_CORE
825
+ add_attributes HTML_ATTR_I18N
826
+ add_attributes HTML_ATTR_EVENTS
827
+ add_attribute :lang, ATTR_LANG
828
+ add_attribute :href, Attribute.create( [ :html, :required ] )
829
+ add_attribute :alt, Attribute.create( [ :html ] )
830
+ add_attribute :longdesc, Attribute.create( [ :html ] )
831
+ add_attribute :value, Attribute.create( [ :html ] )
832
+ add_attribute :shape, Attribute.create( [ :html ] )
833
+ add_attribute :coords, Attribute.create( [ :html ] )
834
+ add_latex_output '#{linebreak(@crbefore)}\hypertarget{#{@attr[:href]}}{#{@content}}#{linebreak(@crafter)}'
835
+ end #Hypertarget
775
836
 
776
837
 
777
838
  =begin rdoc
@@ -792,18 +853,18 @@ Attributes may be:
792
853
  * HTML_ATTR_EVENTS
793
854
  * ATTR_LANG
794
855
  =end
795
- class Link < Element
796
- has_no_content
797
- add_attributes HTML_ATTR_CORE
798
- add_attributes HTML_ATTR_I18N
799
- add_attributes HTML_ATTR_EVENTS
800
- add_attribute :lang, ATTR_LANG
801
- add_attribute :href, Attribute.create( [ :html, :required ], nil, 1 )
802
- add_attribute :rel, Attribute.create( [ :html ], [String], 2 )
803
- add_attribute :title, Attribute.create( [ :html ], nil, 3 )
804
- add_attribute :type, Attribute.create( [ :html ], nil, 4 )
805
- add_html_tag 'link'
806
- end #Link
856
+ class Link < Element
857
+ has_no_content
858
+ add_attributes HTML_ATTR_CORE
859
+ add_attributes HTML_ATTR_I18N
860
+ add_attributes HTML_ATTR_EVENTS
861
+ add_attribute :lang, ATTR_LANG
862
+ add_attribute :href, Attribute.create( [ :html, :required ], nil, 1 )
863
+ add_attribute :rel, Attribute.create( [ :html ], [String], 2 )
864
+ add_attribute :title, Attribute.create( [ :html ], nil, 3 )
865
+ add_attribute :type, Attribute.create( [ :html ], nil, 4 )
866
+ add_html_tag 'link'
867
+ end #Link
807
868
 
808
869
  #
809
870
 
@@ -813,53 +874,53 @@ Add a TeX-Makro usepackage.
813
874
  This method tries to load the package specific definitions in a file
814
875
  docgenerator_<<packagename>>
815
876
  =end
816
- class Usepackage < Element
817
- #~ add_attributes( HTML_ATTR_ALL )
818
- add_attribute :option, Attribute.create( )
877
+ class Usepackage < Element
878
+ #~ add_attributes( HTML_ATTR_ALL )
879
+ add_attribute :option, Attribute.create( )
819
880
 
820
881
  =begin rdoc
821
882
  With usepackage additional command may be defined.
822
883
 
823
884
  Here we load this special commands/elements if available.
824
885
  =end
825
- def << ( content )
826
- @content << content
827
- #Load new additionals makros if available
828
- makrodefinitions = 'docgenerator/packages/' + content + '.rb'
829
- begin
830
- @log.debug("usepackage: Try to load #{makrodefinitions}") if @log.debug?
831
- require makrodefinitions
832
- rescue LoadError
833
- @log.info("usepackage: No supporting definitions #{makrodefinitions} found") if @log.info?
834
- end
835
- end
886
+ def << ( content )
887
+ @content << content
888
+ #Load new additionals makros if available
889
+ makrodefinitions = 'docgenerator/packages/' + content + '.rb'
890
+ begin
891
+ @log.debug("usepackage: Try to load #{makrodefinitions}") if @log.debug?
892
+ require makrodefinitions
893
+ rescue LoadError
894
+ @log.info("usepackage: No supporting definitions #{makrodefinitions} found") if @log.info?
895
+ end
896
+ end
836
897
 
837
898
  =begin rdoc
838
899
  Redefine standard output.
839
900
  Options are given, if an option is available.
840
901
  =end
841
- #~ add_latex_output '\usepackage[#{@attr[:option]}]{#{@content}}'
842
- def to_latex( options = {} )
843
- cmd = linebreak(@crbefore)
844
- cmd << '\usepackage'
845
- opt = @attr[:option].content
846
- cmd << '[' + opt.join(',') + ']' if opt.size > 0
847
- cmd << "{#{@content.join}}"
848
- cmd << linebreak(@crafter)
849
- return cmd
850
- end
902
+ #~ add_latex_output '\usepackage[#{@attr[:option]}]{#{@content}}'
903
+ def to_latex( options = {} )
904
+ cmd = linebreak(@crbefore)
905
+ cmd << '\usepackage'
906
+ opt = @attr[:option].content
907
+ cmd << '[' + opt.join(',') + ']' if opt.size > 0
908
+ cmd << "{#{@content.join}}"
909
+ cmd << linebreak(@crafter)
910
+ return cmd
911
+ end
851
912
  =begin rdoc
852
913
  Not used in HTML
853
914
  =end
854
- def to_html( options = {} )
855
- return ''
856
- end
857
- end #Usepackage
915
+ def to_html( options = {} )
916
+ return ''
917
+ end
918
+ end #Usepackage
858
919
 
859
920
 
860
921
 
861
- #~ :em => {}, #complete it
862
- #~ :code => {}, #complete it
922
+ #~ :em => {}, #complete it
923
+ #~ :code => {}, #complete it
863
924
 
864
925
  =begin rdoc
865
926
  Define Element :font
@@ -871,10 +932,10 @@ or
871
932
  Attributes may be:
872
933
  * :size:
873
934
  =end
874
- class Font < Element
875
- add_attribute :size, Attribute.create([:html], [ Fixnum ])
876
- add_html_tag 'font'
877
- end #Font
935
+ class Font < Element
936
+ add_attribute :size, Attribute.create([:html], [ Fixnum ])
937
+ add_html_tag 'font'
938
+ end #Font
878
939
 
879
940
  =begin rdoc
880
941
  Define Element :tiny
@@ -885,10 +946,10 @@ or
885
946
  Tiny.new( [ attributes, [content]] )
886
947
  Attributes are not defined for this element.
887
948
  =end
888
- class Tiny < Element
889
- add_html_output '<span style="font-size:xx-small">#{@content}</span>'
890
- add_latex_output '#{linebreak(@crbefore)}{\tiny #{@content}}#{linebreak(@crafter)}'
891
- end #Tiny
949
+ class Tiny < Element
950
+ add_html_output '<span style="font-size:xx-small">#{@content}</span>'
951
+ add_latex_output '#{linebreak(@crbefore)}{\tiny #{@content}}#{linebreak(@crafter)}'
952
+ end #Tiny
892
953
 
893
954
  =begin rdoc
894
955
  Define Element :scriptsize
@@ -899,10 +960,10 @@ or
899
960
  Scriptsize.new( [ attributes, [content]] )
900
961
  Attributes are not defined for this element.
901
962
  =end
902
- class Scriptsize < Element
903
- add_html_output '<span style="font-size:x-small">#{@content}</span>'
904
- add_latex_output '#{linebreak(@crbefore)}{\scriptsize #{@content}}#{linebreak(@crafter)}'
905
- end #Scriptsize
963
+ class Scriptsize < Element
964
+ add_html_output '<span style="font-size:x-small">#{@content}</span>'
965
+ add_latex_output '#{linebreak(@crbefore)}{\scriptsize #{@content}}#{linebreak(@crafter)}'
966
+ end #Scriptsize
906
967
 
907
968
  =begin rdoc
908
969
  Define Element :footnotesize
@@ -913,10 +974,10 @@ or
913
974
  Footnotesize.new( [ attributes, [content]] )
914
975
  Attributes are not defined for this element.
915
976
  =end
916
- class Footnotesize < Element
917
- add_html_output '<span style="font-size:x-small">#{@content}</span>'
918
- add_latex_output '#{linebreak(@crbefore)}{\footnotesize #{@content}}#{linebreak(@crafter)}'
919
- end #Footnotesize
977
+ class Footnotesize < Element
978
+ add_html_output '<span style="font-size:x-small">#{@content}</span>'
979
+ add_latex_output '#{linebreak(@crbefore)}{\footnotesize #{@content}}#{linebreak(@crafter)}'
980
+ end #Footnotesize
920
981
 
921
982
  =begin rdoc
922
983
  Define Element :small
@@ -927,10 +988,10 @@ or
927
988
  Small.new( [ attributes, [content]] )
928
989
  Attributes are not defined for this element.
929
990
  =end
930
- class Small < Element
931
- add_html_tag 'small'
932
- add_latex_output '#{linebreak(@crbefore)}{\small #{@content}}#{linebreak(@crafter)}'
933
- end #Small
991
+ class Small < Element
992
+ add_html_tag 'small'
993
+ add_latex_output '#{linebreak(@crbefore)}{\small #{@content}}#{linebreak(@crafter)}'
994
+ end #Small
934
995
 
935
996
  =begin rdoc
936
997
  Define Element :normalsize
@@ -941,10 +1002,10 @@ or
941
1002
  Normalsize.new( [ attributes, [content]] )
942
1003
  Attributes are not defined for this element.
943
1004
  =end
944
- class Normalsize < Element
945
- add_html_output '<span style="font-size:medium">#{@content}</span>'
946
- add_latex_output '#{linebreak(@crbefore)}{\normalsize #{@content}}#{linebreak(@crafter)}'
947
- end #Normalsize
1005
+ class Normalsize < Element
1006
+ add_html_output '<span style="font-size:medium">#{@content}</span>'
1007
+ add_latex_output '#{linebreak(@crbefore)}{\normalsize #{@content}}#{linebreak(@crafter)}'
1008
+ end #Normalsize
948
1009
 
949
1010
  =begin rdoc
950
1011
  Define Element :large
@@ -955,10 +1016,10 @@ or
955
1016
  Large.new( [ attributes, [content]] )
956
1017
  Attributes are not defined for this element.
957
1018
  =end
958
- class Large < Element
959
- add_html_output '<span style="font-size:large">#{@content}</span>'
960
- add_latex_output '#{linebreak(@crbefore)}{\large #{@content}}#{linebreak(@crafter)}'
961
- end #Large
1019
+ class Large < Element
1020
+ add_html_output '<span style="font-size:large">#{@content}</span>'
1021
+ add_latex_output '#{linebreak(@crbefore)}{\large #{@content}}#{linebreak(@crafter)}'
1022
+ end #Large
962
1023
 
963
1024
  =begin rdoc
964
1025
  Define Element :Large
@@ -969,11 +1030,11 @@ or
969
1030
  LLarge.new( [ attributes, [content]] )
970
1031
  Attributes are not defined for this element.
971
1032
  =end
972
- class LLarge < Element
973
- add_id :Large
974
- add_html_output '<span style="font-size:x-large">#{@content}</span>'
975
- add_latex_output '#{linebreak(@crbefore)}{\Large #{@content}}#{linebreak(@crafter)}'
976
- end #Large
1033
+ class LLarge < Element
1034
+ add_id :Large
1035
+ add_html_output '<span style="font-size:x-large">#{@content}</span>'
1036
+ add_latex_output '#{linebreak(@crbefore)}{\Large #{@content}}#{linebreak(@crafter)}'
1037
+ end #Large
977
1038
 
978
1039
  =begin rdoc
979
1040
  Define Element :huge
@@ -984,10 +1045,10 @@ or
984
1045
  Huge.new( [ attributes, [content]] )
985
1046
  Attributes are not defined for this element.
986
1047
  =end
987
- class Huge < Element
988
- add_html_output '<span style="font-size:xx-large">#{@content}</span>'
989
- add_latex_output '#{linebreak(@crbefore)}{\huge #{@content}}#{linebreak(@crafter)}'
990
- end #Huge
1048
+ class Huge < Element
1049
+ add_html_output '<span style="font-size:xx-large">#{@content}</span>'
1050
+ add_latex_output '#{linebreak(@crbefore)}{\huge #{@content}}#{linebreak(@crafter)}'
1051
+ end #Huge
991
1052
 
992
1053
  =begin rdoc
993
1054
  Define Element :Huge
@@ -998,11 +1059,11 @@ or
998
1059
  Huge.new( [ attributes, [content]] )
999
1060
  Attributes are not defined for this element.
1000
1061
  =end
1001
- class HHuge < Element
1002
- add_id :Huge
1003
- add_html_output '<span style="font-size:xx-large">#{@content}</span>'
1004
- add_latex_output '#{linebreak(@crbefore)}{\Huge #{@content}}#{linebreak(@crafter)}'
1005
- end #Huge
1062
+ class HHuge < Element
1063
+ add_id :Huge
1064
+ add_html_output '<span style="font-size:xx-large">#{@content}</span>'
1065
+ add_latex_output '#{linebreak(@crbefore)}{\Huge #{@content}}#{linebreak(@crafter)}'
1066
+ end #Huge
1006
1067
 
1007
1068
  =begin rdoc
1008
1069
  Define Element :textbf, :strong
@@ -1014,15 +1075,15 @@ or
1014
1075
  Textbf.new( [ attributes, [content]] )
1015
1076
  Attributes are not defined for this element.
1016
1077
  =end
1017
- class Textbf < Element
1018
- add_id :strong
1019
- add_html_tag 'strong'
1020
- add_latex_output '#{linebreak(@crbefore)}\textbf{#{@content}}#{linebreak(@crafter)}'
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)}'
1024
- add_text_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
1025
- end #Textbf
1078
+ class Textbf < Element
1079
+ add_id :strong
1080
+ add_html_tag 'strong'
1081
+ add_latex_output '#{linebreak(@crbefore)}\textbf{#{@content}}#{linebreak(@crafter)}'
1082
+ add_wiki_output '#{linebreak(@crbefore)}'''#{@content}'''#{linebreak(@crafter)}'
1083
+ #The additional space is wanted (else ** may be a itemize-list)
1084
+ add_creole_output '#{linebreak(@crbefore)} **#{@content}**#{linebreak(@crafter)}'
1085
+ add_text_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
1086
+ end #Textbf
1026
1087
 
1027
1088
  =begin rdoc
1028
1089
  Define Element :emph
@@ -1033,13 +1094,13 @@ or
1033
1094
  Emph.new( [ attributes, [content]] )
1034
1095
  Attributes are not defined for this element.
1035
1096
  =end
1036
- class Emph < Element
1037
- add_html_tag 'em'
1038
- add_latex_output '#{linebreak(@crbefore)}\emph{#{@content}}#{linebreak(@crafter)}'
1039
- #~ add_wiki_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
1040
- add_creole_output '#{linebreak(@crbefore)}//#{@content}//#{linebreak(@crafter)}'
1041
- add_text_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
1042
- end #Emph
1097
+ class Emph < Element
1098
+ add_html_tag 'em'
1099
+ add_latex_output '#{linebreak(@crbefore)}\emph{#{@content}}#{linebreak(@crafter)}'
1100
+ #~ add_wiki_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
1101
+ add_creole_output '#{linebreak(@crbefore)}//#{@content}//#{linebreak(@crafter)}'
1102
+ add_text_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
1103
+ end #Emph
1043
1104
 
1044
1105
  =begin rdoc
1045
1106
  Define Element :stroke
@@ -1052,9 +1113,9 @@ Attributes are not defined for this element.
1052
1113
 
1053
1114
  Not defined for LaTeX (use of xout-package?)
1054
1115
  =end
1055
- class Stroke < Element
1056
- add_html_tag 's'
1057
- end #Stroke
1116
+ class Stroke < Element
1117
+ add_html_tag 's'
1118
+ end #Stroke
1058
1119
 
1059
1120
  =begin rdoc
1060
1121
  Define Element :underline
@@ -1065,10 +1126,10 @@ or
1065
1126
  Underline.new( [ attributes, [content]] )
1066
1127
  Attributes are not defined for this element.
1067
1128
  =end
1068
- class Underline < Element
1069
- add_html_tag 'u'
1070
- add_latex_output '#{linebreak(@crbefore)}\underline{#{@content}}#{linebreak(@crafter)}'
1071
- end #Underline
1129
+ class Underline < Element
1130
+ add_html_tag 'u'
1131
+ add_latex_output '#{linebreak(@crbefore)}\underline{#{@content}}#{linebreak(@crafter)}'
1132
+ end #Underline
1072
1133
 
1073
1134
  =begin rdoc
1074
1135
  Define Element :sup, :textsuperscript
@@ -1082,17 +1143,17 @@ Attributes may be:
1082
1143
  * :lang:
1083
1144
  * HTML_ATTR_CORE, HTML_ATTR_I18N, HTML_ATTR_EVENTS
1084
1145
  =end
1085
- class Sup < Element
1086
- add_id :textsuperscript
1087
- add_attributes HTML_ATTR_CORE
1088
- add_attributes HTML_ATTR_I18N
1089
- add_attributes HTML_ATTR_EVENTS
1090
- add_attribute :lang, ATTR_LANG
1091
- add_html_tag 'sup'
1092
- add_latex_output '#{linebreak(@crbefore)}\textsuperscript{#{@content}}#{linebreak(@crafter)}'
1093
- add_wiki_output '#{linebreak(@crbefore)}^#{@content}^#{linebreak(@crafter)}'
1094
- add_text_output '#{linebreak(@crbefore)}^#{@content}^#{linebreak(@crafter)}'
1095
- end #Sup
1146
+ class Sup < Element
1147
+ add_id :textsuperscript
1148
+ add_attributes HTML_ATTR_CORE
1149
+ add_attributes HTML_ATTR_I18N
1150
+ add_attributes HTML_ATTR_EVENTS
1151
+ add_attribute :lang, ATTR_LANG
1152
+ add_html_tag 'sup'
1153
+ add_latex_output '#{linebreak(@crbefore)}\textsuperscript{#{@content}}#{linebreak(@crafter)}'
1154
+ add_wiki_output '#{linebreak(@crbefore)}^#{@content}^#{linebreak(@crafter)}'
1155
+ add_text_output '#{linebreak(@crbefore)}^#{@content}^#{linebreak(@crafter)}'
1156
+ end #Sup
1096
1157
  =begin rdoc
1097
1158
  Define Element :sub
1098
1159
 
@@ -1104,13 +1165,13 @@ Attributes may be:
1104
1165
  * :lang:
1105
1166
  * HTML_ATTR_CORE, HTML_ATTR_I18N, HTML_ATTR_EVENTS
1106
1167
  =end
1107
- class Sub < Element
1108
- add_attributes HTML_ATTR_CORE
1109
- add_attributes HTML_ATTR_I18N
1110
- add_attributes HTML_ATTR_EVENTS
1111
- add_attribute :lang, ATTR_LANG
1112
- add_html_tag 'sub'
1113
- end #Sub
1168
+ class Sub < Element
1169
+ add_attributes HTML_ATTR_CORE
1170
+ add_attributes HTML_ATTR_I18N
1171
+ add_attributes HTML_ATTR_EVENTS
1172
+ add_attribute :lang, ATTR_LANG
1173
+ add_html_tag 'sub'
1174
+ end #Sub
1114
1175
 
1115
1176
  =begin rdoc
1116
1177
  Define Element :newpage
@@ -1121,10 +1182,10 @@ or
1121
1182
  Newpage.new( [ attributes, [content]] )
1122
1183
  Attributes are not defined for this element.
1123
1184
  =end
1124
- class Newpage < Element
1125
- has_no_content
1126
- add_latex_output '#{linebreak(@crbefore)}\newpage #{linebreak(@crafter)}'
1127
- end #Newpage
1185
+ class Newpage < Element
1186
+ has_no_content
1187
+ add_latex_output '#{linebreak(@crbefore)}\newpage #{linebreak(@crafter)}'
1188
+ end #Newpage
1128
1189
 
1129
1190
  =begin rdoc
1130
1191
  Define Element :clearpage
@@ -1135,10 +1196,10 @@ or
1135
1196
  Clearpage.new( [ attributes, [content]] )
1136
1197
  Attributes are not defined for this element.
1137
1198
  =end
1138
- class Clearpage < Element
1139
- has_no_content
1140
- add_latex_output '#{linebreak(@crbefore)}\clearpage #{linebreak(@crafter)}'
1141
- end #Clearpage
1199
+ class Clearpage < Element
1200
+ has_no_content
1201
+ add_latex_output '#{linebreak(@crbefore)}\clearpage #{linebreak(@crafter)}'
1202
+ end #Clearpage
1142
1203
 
1143
1204
  =begin rdoc
1144
1205
  Define Element :twocolumn
@@ -1149,10 +1210,10 @@ or
1149
1210
  Twocolumn.new( [ attributes, [content]] )
1150
1211
  Attributes are not defined for this element.
1151
1212
  =end
1152
- class Twocolumn < Element
1153
- has_no_content
1154
- add_latex_output '#{linebreak(@crbefore)}\twocolumn #{linebreak(@crafter)}'
1155
- end #Twocolumn
1213
+ class Twocolumn < Element
1214
+ has_no_content
1215
+ add_latex_output '#{linebreak(@crbefore)}\twocolumn #{linebreak(@crafter)}'
1216
+ end #Twocolumn
1156
1217
 
1157
1218
  =begin rdoc
1158
1219
  Define Element :centering
@@ -1169,11 +1230,11 @@ Attributes are not defined for this element.
1169
1230
 
1170
1231
  fixme: TeX kein content, HTML hat content
1171
1232
  =end
1172
- class Centering < Element
1173
- has_no_content false
1174
- add_html_tag 'center'
1175
- add_latex_output '\centering #{linebreak(@crafter)}'
1176
- end #Centering
1233
+ class Centering < Element
1234
+ has_no_content false
1235
+ add_html_tag 'center'
1236
+ add_latex_output '\centering #{linebreak(@crafter)}'
1237
+ end #Centering
1177
1238
 
1178
1239
 
1179
1240
  =begin rdoc
@@ -1187,9 +1248,9 @@ or
1187
1248
  Input.new( [ attributes, [content]] )
1188
1249
  Attributes are not defined for this element.
1189
1250
  =end
1190
- class Input < Element
1191
- add_latex_output '#{linebreak(@crbefore)}\input{#{@content}}#{linebreak(@crafter)}'
1192
- end #Input
1251
+ class Input < Element
1252
+ add_latex_output '#{linebreak(@crbefore)}\input{#{@content}}#{linebreak(@crafter)}'
1253
+ end #Input
1193
1254
 
1194
1255
  =begin rdoc
1195
1256
  Define Element :include
@@ -1200,9 +1261,9 @@ or
1200
1261
  Include.new( [ attributes, [content]] )
1201
1262
  Attributes are not defined for this element.
1202
1263
  =end
1203
- class Include < Element
1204
- add_latex_output '#{linebreak(@crbefore)}\include{#{@content}}#{linebreak(@crafter)}'
1205
- end #Include
1264
+ class Include < Element
1265
+ add_latex_output '#{linebreak(@crbefore)}\include{#{@content}}#{linebreak(@crafter)}'
1266
+ end #Include
1206
1267
 
1207
1268
  =begin rdoc
1208
1269
  Define Element :img, :includegraphics
@@ -1228,24 +1289,25 @@ Attributes may be:
1228
1289
  * :title:
1229
1290
  * HTML_ATTR_CORE
1230
1291
  =end
1231
- class Img < Element
1232
- add_id :includegraphics
1233
- has_no_content ENDTAG #img"
1234
- add_attributes HTML_ATTR_CORE
1235
- add_attribute :align, HTML_ATTR_ALIGN
1236
- add_attribute :src, Attribute.create([:html, :latex, :required], [ String ], 1)
1237
- add_attribute :alt, Attribute.create([:html], [String], 2 )
1238
- add_attribute :width, Attribute.create([:texkeyval], [Integer, String] )#String for \textwidth... for HTML use CSS
1239
- add_attribute :height, Attribute.create([:texkeyval], [Integer, String] )
1240
- add_attribute :border, Attribute.create([:html], [Integer] )
1241
- add_attribute :longdesc, Attribute.create([:html], [String] )
1242
- add_attribute :usemap, Attribute.create([:html], [String] )
1243
- add_attribute :name, Attribute.create([:html], [String] )
1244
- add_attribute :angle, Attribute.create([:texkeyval], [Integer] )
1245
- add_attribute :align, HTML_ATTR_ALIGN
1246
- add_html_tag 'img'
1247
- add_latex_output '#{linebreak(@crbefore)}\includegraphics[#{texkeyval}]{#{@attr[:src]}}#{linebreak(@crafter)}'
1248
- end #Img
1292
+ class Img < Element
1293
+ add_id :includegraphics
1294
+ has_no_content ENDTAG #img"
1295
+ add_attributes HTML_ATTR_CORE
1296
+ add_attribute :align, HTML_ATTR_ALIGN
1297
+ add_attribute :src, Attribute.create([:html, :latex, :required], [ String ], 1)
1298
+ add_attribute :alt, Attribute.create([:html], [String], 2 )
1299
+ add_attribute :width, Attribute.create([:texkeyval], [Integer, String] )#String for \textwidth... for HTML use CSS
1300
+ add_attribute :height, Attribute.create([:texkeyval], [Integer, String] )
1301
+ add_attribute :border, Attribute.create([:html], [Integer] )
1302
+ add_attribute :longdesc, Attribute.create([:html], [String] )
1303
+ add_attribute :usemap, Attribute.create([:html], [String] )
1304
+ add_attribute :name, Attribute.create([:html], [String] )
1305
+ add_attribute :angle, Attribute.create([:texkeyval], [Integer] )
1306
+ add_attribute :align, HTML_ATTR_ALIGN
1307
+ add_attribute :texoption, Attribute.create([:latex], [ String ])
1308
+ add_html_tag 'img'
1309
+ add_latex_output '#{linebreak(@crbefore)}\includegraphics[#{texkeyval},#{@attr[:texoption]}]{#{@attr[:src]}}#{linebreak(@crafter)}'
1310
+ end #Img
1249
1311
 
1250
1312
  =begin rdoc
1251
1313
  Define Element :verb
@@ -1259,21 +1321,18 @@ Attributes may be:
1259
1321
 
1260
1322
  See also Environments::Verbatim
1261
1323
  =end
1262
- class Verb < Element
1263
- add_attributes HTML_ATTR_CORE
1264
- #This builds a new block
1265
- #~ :htmltag => 'pre',
1266
- #With "display: inline" the element is continued correct, but <pre starts on new line.
1267
- #~ :html => '#{linebreak(@crbefore)}<pre style = "display: inline">#{@content}</pre>#{linebreak(@crafter)}',
1268
- #fixme font tt
1269
- #~ :html => '#{linebreak(@crbefore)}<span style = "display: inline;white-space:pre;font-family:monospace">#{@content}</span>#{linebreak(@crafter)}',
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)}'
1271
- add_latex_output '#{linebreak(@crbefore)}\verb|#{@content}|#{linebreak(@crafter)}' #\verb| |
1272
- #~ add_latex_output '#{linebreak(@crbefore)}\verb{#{@content}}#{linebreak(@crafter)}' #\verb{ }
1273
- add_text_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
1274
- end #Verb
1275
-
1276
-
1277
-
1278
- end #module Elements
1324
+ class Verb < Element
1325
+ add_attributes HTML_ATTR_CORE
1326
+ #This builds a new block
1327
+ #~ :htmltag => 'pre',
1328
+ #With "display: inline" the element is continued correct, but <pre starts on new line.
1329
+ #~ :html => '#{linebreak(@crbefore)}<pre style = "display: inline">#{@content}</pre>#{linebreak(@crafter)}',
1330
+ #fixme font tt
1331
+ #~ :html => '#{linebreak(@crbefore)}<span style = "display: inline;white-space:pre;font-family:monospace">#{@content}</span>#{linebreak(@crafter)}',
1332
+ add_html_output '#{linebreak(@crbefore)}<span style = "display: inline;white-space:pre;font-family:monospace">#{@content.join.gsub(/</, \'&lt;\').gsub(/>/, \'&gt;\')}</span>#{linebreak(@crafter)}'
1333
+ add_latex_output '#{linebreak(@crbefore)}\verb|#{@content}|#{linebreak(@crafter)}' #\verb| |
1334
+ #~ add_latex_output '#{linebreak(@crbefore)}\verb{#{@content}}#{linebreak(@crafter)}' #\verb{ }
1335
+ add_text_output '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}'
1336
+ end #Verb
1337
+ end #module Elements
1279
1338
  end #module Docgenerator