docgenerator 1.0.4 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (231) hide show
  1. data/lib/creole/creole2doc.rb +777 -0
  2. data/lib/creole/creole_inclusion_and_plugins.rb +236 -0
  3. data/lib/creole/creole_placeholder.rb +74 -0
  4. data/lib/creole/creole_tabular.rb +170 -0
  5. data/lib/docgenerator.rb +15 -6
  6. data/lib/docgenerator_attribute.rb +2 -2
  7. data/lib/docgenerator_characters.rb +20 -4
  8. data/lib/docgenerator_document.rb +132 -42
  9. data/lib/docgenerator_element.rb +531 -524
  10. data/lib/docgenerator_elements.rb +408 -399
  11. data/lib/docgenerator_environments.rb +28 -2
  12. data/lib/docgenerator_footnote.rb +72 -79
  13. data/lib/docgenerator_sections.rb +1 -1
  14. data/lib/docgenerator_tabular.rb +8 -3
  15. data/lib/packages/docgenerator_beamer.rb +253 -0
  16. data/lib/packages/docgenerator_scrlettr2.rb +53 -9
  17. data/lib/templates/docgenerator_template_css.rb +4 -0
  18. data/lib/wiki2doc/wiki2docgenerator.rb +1087 -970
  19. data/lib/yaml2presentation/yaml2presentation.rb +1091 -0
  20. data/self_docgenerator.rb +8 -6
  21. data/unittest/Red_Flower.jpg +0 -0
  22. data/unittest/creole1.0test.txt +128 -0
  23. data/unittest/expected/beamer_01_doc.html +1 -1
  24. data/unittest/expected/beamer_02_doc.html +1 -1
  25. data/unittest/expected/beamer_doc_html_overview_with_detailpic_and_text_doc.html +34 -0
  26. data/unittest/expected/beamer_doc_html_overview_with_detailpic_doc.html +34 -0
  27. data/unittest/expected/beamer_doc_key_doc.html +1 -1
  28. data/unittest/expected/beamer_doc_note_doc.html +1 -1
  29. data/unittest/expected/beamer_doc_pic_bottom_doc.html +1 -1
  30. data/unittest/expected/beamer_doc_pic_doc.html +1 -1
  31. data/unittest/expected/beamer_doc_pic_left_doc.html +1 -1
  32. data/unittest/expected/beamer_doc_pic_right_doc.html +1 -1
  33. data/unittest/expected/beamer_doc_pic_top_doc.html +1 -1
  34. data/unittest/expected/test_footnote.html +2 -2
  35. data/unittest/expected/test_footnote.latex +1 -1
  36. data/unittest/expected/test_footnote_group.html +3 -3
  37. data/unittest/expected/test_footnote_group.latex +2 -2
  38. data/unittest/expected_creole/test_creole.html +3 -0
  39. data/unittest/expected_creole/test_creole_characters_all.html +10 -0
  40. data/unittest/expected_creole/test_creole_characters_all.latex +20 -0
  41. data/unittest/expected_creole/test_creole_characters_special.html +10 -0
  42. data/unittest/expected_creole/test_creole_characters_special.latex +18 -0
  43. data/unittest/expected_creole/test_creole_countdown.html +3 -0
  44. data/unittest/expected_creole/test_creole_countdown.latex +4 -0
  45. data/unittest/expected_creole/test_creole_creole1.0test.html +182 -0
  46. data/unittest/expected_creole/test_creole_creole1.0test.latex +253 -0
  47. data/unittest/expected_creole/test_creole_creole1.0test.text +160 -0
  48. data/unittest/expected_creole/test_creole_footnotes.html +9 -0
  49. data/unittest/expected_creole/test_creole_footnotes.latex +14 -0
  50. data/unittest/expected_creole/test_creole_footnotes_label.html +9 -0
  51. data/unittest/expected_creole/test_creole_headings.html +17 -0
  52. data/unittest/expected_creole/test_creole_headings.latex +19 -0
  53. data/unittest/expected_creole/test_creole_headings.text +48 -0
  54. data/unittest/expected_creole/test_creole_headings.wiki +37 -0
  55. data/unittest/expected_creole/test_creole_hr.html +7 -0
  56. data/unittest/expected_creole/test_creole_hr.latex +9 -0
  57. data/unittest/expected_creole/test_creole_hr.text +4 -0
  58. data/unittest/expected_creole/test_creole_inline.html +3 -0
  59. data/unittest/expected_creole/test_creole_inline.latex +4 -0
  60. data/unittest/expected_creole/test_creole_inline.text +2 -0
  61. data/unittest/expected_creole/test_creole_inline_ruby.html +12 -0
  62. data/unittest/expected_creole/test_creole_inline_ruby.latex +20 -0
  63. data/unittest/expected_creole/test_creole_inline_ruby_raw.html +6 -0
  64. data/unittest/expected_creole/test_creole_inline_ruby_raw.latex +8 -0
  65. data/unittest/expected_creole/test_creole_input.normsource +23 -0
  66. data/unittest/expected_creole/test_creole_label.html +12 -0
  67. data/unittest/expected_creole/test_creole_label.latex +15 -0
  68. data/unittest/expected_creole/test_creole_line_break.html +6 -0
  69. data/unittest/expected_creole/test_creole_line_break.latex +8 -0
  70. data/unittest/expected_creole/test_creole_links_explicit_internal.html +6 -0
  71. data/unittest/expected_creole/test_creole_links_explicit_internal.text +4 -0
  72. data/unittest/expected_creole/test_creole_links_explicit_with_em.html +3 -0
  73. data/unittest/expected_creole/test_creole_links_explicit_with_em.latex +4 -0
  74. data/unittest/expected_creole/test_creole_links_explicit_with_em.text +2 -0
  75. data/unittest/expected_creole/test_creole_links_external.html +6 -0
  76. data/unittest/expected_creole/test_creole_links_external.latex +8 -0
  77. data/unittest/expected_creole/test_creole_links_external.text +4 -0
  78. data/unittest/expected_creole/test_creole_links_external_implicit.html +9 -0
  79. data/unittest/expected_creole/test_creole_links_external_implicit.latex +12 -0
  80. data/unittest/expected_creole/test_creole_links_external_implicit.text +6 -0
  81. data/unittest/expected_creole/test_creole_links_file.html +6 -0
  82. data/unittest/expected_creole/test_creole_links_file.latex +8 -0
  83. data/unittest/expected_creole/test_creole_links_file.text +4 -0
  84. data/unittest/expected_creole/test_creole_list_ol.html +12 -0
  85. data/unittest/expected_creole/test_creole_list_ol.latex +22 -0
  86. data/unittest/expected_creole/test_creole_list_ol_after_ul.html +12 -0
  87. data/unittest/expected_creole/test_creole_list_ol_after_ul.latex +20 -0
  88. data/unittest/expected_creole/test_creole_list_ol_after_ul.text +6 -0
  89. data/unittest/expected_creole/test_creole_list_ol_ul.html +15 -0
  90. data/unittest/expected_creole/test_creole_list_ol_ul.latex +26 -0
  91. data/unittest/expected_creole/test_creole_list_ul.html +22 -0
  92. data/unittest/expected_creole/test_creole_list_ul.latex +40 -0
  93. data/unittest/expected_creole/test_creole_list_ul.normsource +83 -0
  94. data/unittest/expected_creole/test_creole_list_ul_too_much.html +24 -0
  95. data/unittest/expected_creole/test_creole_list_ul_too_much.latex +44 -0
  96. data/unittest/expected_creole/test_creole_newline.html +9 -0
  97. data/unittest/expected_creole/test_creole_newline.latex +11 -0
  98. data/unittest/expected_creole/test_creole_newline.text +7 -0
  99. data/unittest/expected_creole/test_creole_paragraphs.html +6 -0
  100. data/unittest/expected_creole/test_creole_paragraphs.latex +8 -0
  101. data/unittest/expected_creole/test_creole_paragraphs.normsource +27 -0
  102. data/unittest/expected_creole/test_creole_paragraphs.text +4 -0
  103. data/unittest/expected_creole/test_creole_paragraphs.wiki +4 -0
  104. data/unittest/expected_creole/test_creole_paragraphs_wrap.html +5 -0
  105. data/unittest/expected_creole/test_creole_paragraphs_wrap.latex +6 -0
  106. data/unittest/expected_creole/test_creole_paragraphs_wrap.text +4 -0
  107. data/unittest/expected_creole/test_creole_paragraphs_wrap.wiki +4 -0
  108. data/unittest/expected_creole/test_creole_paragraphs_wrap0.html +9 -0
  109. data/unittest/expected_creole/test_creole_paragraphs_wrap0.latex +11 -0
  110. data/unittest/expected_creole/test_creole_paragraphs_wrap0.text +7 -0
  111. data/unittest/expected_creole/test_creole_paragraphs_wrap0.wiki +7 -0
  112. data/unittest/expected_creole/test_creole_paragraphs_wrap60.html +5 -0
  113. data/unittest/expected_creole/test_creole_paragraphs_wrap60.latex +6 -0
  114. data/unittest/expected_creole/test_creole_paragraphs_wrap60.text +4 -0
  115. data/unittest/expected_creole/test_creole_paragraphs_wrap60.wiki +4 -0
  116. data/unittest/expected_creole/test_creole_picture_link.html +6 -0
  117. data/unittest/expected_creole/test_creole_pictures.html +10 -0
  118. data/unittest/expected_creole/test_creole_pictures.latex +13 -0
  119. data/unittest/expected_creole/test_creole_pictures_css.html +3 -0
  120. data/unittest/expected_creole/test_creole_pictures_css.latex +4 -0
  121. data/unittest/expected_creole/test_creole_pictures_imgclass.html +6 -0
  122. data/unittest/expected_creole/test_creole_pictures_imgclass.latex +8 -0
  123. data/unittest/expected_creole/test_creole_placeholders_html.html +7 -0
  124. data/unittest/expected_creole/test_creole_placeholders_html.latex +8 -0
  125. data/unittest/expected_creole/test_creole_placeholders_html.text +4 -0
  126. data/unittest/expected_creole/test_creole_placeholders_latex.html +6 -0
  127. data/unittest/expected_creole/test_creole_placeholders_latex.latex +9 -0
  128. data/unittest/expected_creole/test_creole_placeholders_latex.text +4 -0
  129. data/unittest/expected_creole/test_creole_tabular.html +20 -0
  130. data/unittest/expected_creole/test_creole_tabular.latex +22 -0
  131. data/unittest/expected_creole/test_creole_tabular_creole.html +18 -0
  132. data/unittest/expected_creole/test_creole_tabular_creole.latex +19 -0
  133. data/unittest/expected_creole/test_creole_tabular_css.html +20 -0
  134. data/unittest/expected_creole/test_creole_tabular_css.latex +22 -0
  135. data/unittest/expected_creole/test_creole_toc.html +11 -0
  136. data/unittest/expected_creole/test_creole_toc.latex +22 -0
  137. data/unittest/expected_creole/test_creole_toc.text +4 -0
  138. data/unittest/expected_creole/test_creole_toc_text.html +5 -0
  139. data/unittest/expected_creole/test_creole_toc_text.latex +5 -0
  140. data/unittest/expected_creole/test_creole_ul_multiple_line.html +7 -0
  141. data/unittest/expected_creole/test_creole_ul_multiple_line.latex +14 -0
  142. data/unittest/expected_creole/test_creole_ul_with_blank.html +11 -0
  143. data/unittest/expected_creole/test_creole_ul_with_blank.latex +20 -0
  144. data/unittest/expected_creole/test_creole_ul_with_bold.creole +0 -0
  145. data/unittest/expected_creole/test_creole_ul_with_bold.html +11 -0
  146. data/unittest/expected_creole/test_creole_ul_with_bold.latex +18 -0
  147. data/unittest/expected_creole/test_creole_ul_with_bold.text +7 -0
  148. data/unittest/expected_creole/test_creole_verbatim.html +25 -0
  149. data/unittest/expected_creole/test_creole_verbatim.latex +33 -0
  150. data/unittest/expected_creole/test_creole_verbatim.text +17 -0
  151. data/unittest/expected_creole/test_creole_verbatim_inline.html +6 -0
  152. data/unittest/expected_creole/test_creole_verbatim_inline.latex +8 -0
  153. data/unittest/expected_creole/test_creole_verbatim_inline_at_start.html +6 -0
  154. data/unittest/expected_creole/test_creole_verbatim_inline_at_start.latex +8 -0
  155. data/unittest/expected_privat/test_creole_test_document.html +6 -0
  156. data/unittest/{expected → expected_wiki}/test_wiki.html +0 -0
  157. data/unittest/{expected → expected_wiki}/test_wiki.latex +0 -0
  158. data/unittest/{expected → expected_wiki}/test_wiki.text +0 -0
  159. data/unittest/{expected → expected_wiki}/test_wiki.wiki +0 -0
  160. data/unittest/{expected → expected_wiki}/test_wiki_amazon.html +0 -0
  161. data/unittest/{expected → expected_wiki}/test_wiki_description.html +0 -0
  162. data/unittest/{expected → expected_wiki}/test_wiki_description.latex +0 -0
  163. data/unittest/{expected → expected_wiki}/test_wiki_description.text +0 -0
  164. data/unittest/{expected → expected_wiki}/test_wiki_description.wiki +0 -0
  165. data/unittest/expected_wiki/test_wiki_footnote.html +8 -0
  166. data/unittest/expected_wiki/test_wiki_footnote.latex +17 -0
  167. data/unittest/{expected → expected_wiki}/test_wiki_footnote.text +2 -4
  168. data/unittest/expected_wiki/test_wiki_footnote.wiki +10 -0
  169. data/unittest/expected_wiki/test_wiki_footnote_2.html +8 -0
  170. data/unittest/expected_wiki/test_wiki_footnote_groupid.html +21 -0
  171. data/unittest/{expected → expected_wiki}/test_wiki_html_code.html +0 -0
  172. data/unittest/{expected → expected_wiki}/test_wiki_html_code.latex +0 -0
  173. data/unittest/{expected → expected_wiki}/test_wiki_html_code.text +0 -0
  174. data/unittest/{expected → expected_wiki}/test_wiki_html_code.wiki +0 -0
  175. data/unittest/{expected → expected_wiki}/test_wiki_inline.html +0 -0
  176. data/unittest/{expected → expected_wiki}/test_wiki_inline.latex +0 -0
  177. data/unittest/{expected → expected_wiki}/test_wiki_inline.text +0 -0
  178. data/unittest/{expected → expected_wiki}/test_wiki_inline.wiki +0 -0
  179. data/unittest/{expected → expected_wiki}/test_wiki_label.html +0 -0
  180. data/unittest/{expected → expected_wiki}/test_wiki_link.html +0 -0
  181. data/unittest/{expected → expected_wiki}/test_wiki_link.latex +0 -0
  182. data/unittest/{expected → expected_wiki}/test_wiki_link.log +0 -0
  183. data/unittest/{expected → expected_wiki}/test_wiki_link.wiki +0 -0
  184. data/unittest/{expected → expected_wiki}/test_wiki_list_ol.html +0 -0
  185. data/unittest/{expected → expected_wiki}/test_wiki_list_ol.latex +0 -0
  186. data/unittest/{expected → expected_wiki}/test_wiki_list_ol.text +0 -0
  187. data/unittest/{expected → expected_wiki}/test_wiki_list_ol.wiki +0 -0
  188. data/unittest/{expected → expected_wiki}/test_wiki_list_ol_after_ul.html +0 -0
  189. data/unittest/{expected → expected_wiki}/test_wiki_list_ol_after_ul.latex +0 -0
  190. data/unittest/{expected → expected_wiki}/test_wiki_list_ol_after_ul.text +0 -0
  191. data/unittest/{expected → expected_wiki}/test_wiki_list_ol_after_ul.wiki +0 -0
  192. data/unittest/{expected → expected_wiki}/test_wiki_list_ol_ul.html +0 -0
  193. data/unittest/{expected → expected_wiki}/test_wiki_list_ol_ul.latex +0 -0
  194. data/unittest/{expected → expected_wiki}/test_wiki_list_ol_ul.text +0 -0
  195. data/unittest/{expected → expected_wiki}/test_wiki_list_ol_ul.wiki +0 -0
  196. data/unittest/{expected → expected_wiki}/test_wiki_list_ul.html +0 -0
  197. data/unittest/{expected → expected_wiki}/test_wiki_list_ul.latex +0 -0
  198. data/unittest/{expected → expected_wiki}/test_wiki_list_ul.text +0 -0
  199. data/unittest/{expected → expected_wiki}/test_wiki_list_ul.wiki +0 -0
  200. data/unittest/{expected → expected_wiki}/test_wiki_list_ul_too_much.html +0 -0
  201. data/unittest/{expected → expected_wiki}/test_wiki_list_ul_too_much.latex +0 -0
  202. data/unittest/{expected → expected_wiki}/test_wiki_list_ul_too_much.text +0 -0
  203. data/unittest/{expected → expected_wiki}/test_wiki_list_ul_too_much.wiki +0 -0
  204. data/unittest/{expected → expected_wiki}/test_wiki_picture.html +0 -0
  205. data/unittest/{expected → expected_wiki}/test_wiki_picture.latex +0 -0
  206. data/unittest/{expected → expected_wiki}/test_wiki_picture_thumb.html +0 -0
  207. data/unittest/{expected → expected_wiki}/test_wiki_tab1.html +0 -0
  208. data/unittest/{expected → expected_wiki}/test_wiki_tab1.latex +0 -0
  209. data/unittest/{expected → expected_wiki}/test_wiki_tab1.wiki +0 -0
  210. data/unittest/{expected → expected_wiki}/test_wiki_textformatting.html +0 -0
  211. data/unittest/{expected → expected_wiki}/test_wiki_textformatting.latex +0 -0
  212. data/unittest/{expected → expected_wiki}/test_wiki_textformatting.text +0 -0
  213. data/unittest/{expected → expected_wiki}/test_wiki_textformatting.wiki +0 -0
  214. data/unittest/{expected → expected_wiki}/test_wiki_toc.html +0 -0
  215. data/unittest/{expected → expected_wiki}/test_wiki_toc.latex +0 -0
  216. data/unittest/{expected → expected_wiki}/test_wiki_toc.text +0 -0
  217. data/unittest/{expected → expected_wiki}/test_wiki_toc.wiki +0 -0
  218. data/unittest/{expected → expected_wiki}/test_wiki_ul_multiple_line.html +0 -0
  219. data/unittest/{expected → expected_wiki}/test_wiki_ul_multiple_line.latex +0 -0
  220. data/unittest/{expected → expected_wiki}/test_wiki_ul_multiple_line.text +0 -0
  221. data/unittest/{expected → expected_wiki}/test_wiki_ul_multiple_line.wiki +0 -0
  222. data/unittest/test_docgenerator.rb +1 -2
  223. data/unittest/unittest_creole2doc.rb +1024 -0
  224. data/unittest/unittest_docgenerator.rb +17 -8
  225. data/unittest/unittest_wiki2doc.rb +92 -88
  226. data/unittest/unittest_yaml2pres.rb +336 -0
  227. metadata +202 -70
  228. data/unittest/expected/test_wiki_footnote.html +0 -8
  229. data/unittest/expected/test_wiki_footnote.latex +0 -15
  230. data/unittest/expected/test_wiki_footnote.wiki +0 -12
  231. data/unittest/expected/test_wiki_footnote_groupid.html +0 -21
@@ -1,4 +1,4 @@
1
- #~ @attr = {:short=> 1}
1
+ #~ @attr = {:short=> 1}
2
2
  #~ puts "\title#{"[#{@attr[:short]}]" if @attr[:short]}"
3
3
  #~ __END__
4
4
 
@@ -11,34 +11,34 @@
11
11
  #Main document control.
12
12
  #
13
13
  Element.create( [:head], {}, true,
14
- { :htmltag => 'head',
15
- :latex => '#{@content}',
16
- :text => '#{@content}',
17
- :wiki => '#{@content}',
18
- } )
19
- Element.create( [:body], {
20
- :bgcolor => Attribute.create( [ :html ] ),
21
- :text => Attribute.create( [ :html ] ),
22
- :link => Attribute.create( [ :html ] ),
23
- :vlink => Attribute.create( [ :html ] ),
24
- :alink => Attribute.create( [ :html ] ),
25
- }.update(HTML_ATTR_CORE.dup.update(HTML_ATTR_I18N)),
26
- true,
27
- { :htmltag => 'body',
28
- :latex => '#{@content}',
29
- :text => '#{@content}',
30
- :wiki => '#{@content}',
31
- } )
14
+ { :htmltag => 'head',
15
+ :latex => '#{@content}',
16
+ :text => '#{@content}',
17
+ :wiki => '#{@content}',
18
+ } )
19
+ Element.create( [:body], {
20
+ :bgcolor => Attribute.create( [ :html ] ),
21
+ :text => Attribute.create( [ :html ] ),
22
+ :link => Attribute.create( [ :html ] ),
23
+ :vlink => Attribute.create( [ :html ] ),
24
+ :alink => Attribute.create( [ :html ] ),
25
+ }.update(HTML_ATTR_CORE.dup.update(HTML_ATTR_I18N)),
26
+ true,
27
+ { :htmltag => 'body',
28
+ :latex => '#{@content}',
29
+ :text => '#{@content}',
30
+ :wiki => '#{@content}',
31
+ } )
32
32
 
33
33
  Element.create( [:latexdummy, :latexonly ], {},true,
34
- { :htmltag => nil,
35
- :html => '',
36
- :latex => '#{@content}'
37
- } )
34
+ { :htmltag => nil,
35
+ :html => '',
36
+ :latex => '#{@content}'
37
+ } )
38
38
  Element.create( [:htmldummy, :htmlonly ], {},true,
39
- { :html => '#{@content}',
40
- :latex => ''
41
- } )
39
+ { :html => '#{@content}',
40
+ :latex => ''
41
+ } )
42
42
 
43
43
 
44
44
  #
@@ -47,89 +47,96 @@ Element.create( [:htmldummy, :htmlonly ], {},true,
47
47
  #This parameter are better set with Document.title.
48
48
  #
49
49
  class Title < Element
50
- Element.add( [:title], Title)
51
- add_attributes( {
52
- :short => Attribute.create( [ :html ], nil, 1 )
53
- }.update(HTML_ATTR_ALL)
54
- )
55
- #Unsaubere realisierung .. fixme
56
- def shortoption( options = {} )
57
- @attr[:short].content.compact! #delete nils.
58
- return nil if ! @attr[:short].filled?
50
+ Element.add( [:title], Title)
51
+ add_attributes( {
52
+ :short => Attribute.create( [ :html ], nil, 1 )
53
+ }.update(HTML_ATTR_ALL)
54
+ )
55
+ #Unsaubere realisierung .. fixme
56
+ def shortoption( options = {} )
57
+ @attr[:short].content.compact! #delete nils.
58
+ return nil if ! @attr[:short].filled?
59
59
  o = Docgenerator_logger.set_option_defaults(options)
60
60
  o[:log].debug("enter shortoption") if o[:log].debug?
61
61
  if o[:document]
62
- if o[:document].template[:latex].template.include?('Beamer')
63
- return "[#{@attr[:short].content}]"
64
- end
62
+ if o[:document].template[:latex].template.include?('Beamer')
63
+ return "[#{@attr[:short].content}]"
64
+ end
65
65
  else
66
66
  o[:log].info("No related document for shortoption") if o[:log].info?
67
67
  end
68
68
  return nil
69
- end
70
- add_output( :latex, '#{linebreak(@crbefore)}\title#{shortoption(o)}{#{@content}}#{linebreak(@crmid)}\hypersetup{pdftitle={#{@content}}}#{linebreak(@crafter)}')
71
- #~ add_output( :latex, '#{linebreak(@crbefore)}\title{#{@content}}#{linebreak(@crmid)}\hypersetup{pdftitle={#{@content}}}#{linebreak(@crafter)}')
72
- add_output( :html, '#{linebreak(@crbefore)}<title>#{@content}</title>#{linebreak(@crafter)}')
73
- add_output( :text, "\n" + '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}' + "\n")
74
- add_output( :wiki, '#{linebreak(@crbefore)}' + '=#{@content}=' + ' #{linebreak(@crafter)}')
69
+ end
70
+ #Add shorttitle as a meta-tag.
71
+ def shorttitle_html()
72
+ return nil if ! @attr[:short].filled?
73
+ return element( :meta, {:name => 'shorttitle', :content => @attr[:short].content }).to_html
74
+ end
75
+
76
+ add_output( :latex, '#{linebreak(@crbefore)}\title#{shortoption(o)}{#{@content}}#{linebreak(@crmid)}\hypersetup{pdftitle={#{@content}}}#{linebreak(@crafter)}')
77
+ #~ add_output( :latex, '#{linebreak(@crbefore)}\title{#{@content}}#{linebreak(@crmid)}\hypersetup{pdftitle={#{@content}}}#{linebreak(@crafter)}')
78
+ add_output( :html, '#{linebreak(@crbefore)}<title>#{@content}</title>#{linebreak(@crmid) if shorttitle_html}#{shorttitle_html}#{linebreak(@crafter)}')
79
+
80
+ add_output( :text, "\n" + '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}' + "\n")
81
+ add_output( :wiki, '#{linebreak(@crbefore)}' + '=#{@content}=' + ' #{linebreak(@crafter)}')
75
82
  end
76
83
  Element.create( [:meta], {
77
- :name => Attribute.create( [ :html, :required ], nil, 1 ),
78
- :content => Attribute.create( [ :html, :required ], nil, 2 ),
79
- }, ENDTAG,
80
- {
81
- :htmltag => 'meta',
82
- #~ :html => '<meta name="#{@attr[:name]}" content="#{@attr[:content]}">',
83
- :latex => '',
84
- # :latex => '#{linebreak(@crbefore)}' + '\author{#{@content}}\hypersetup{pdfauthor={#{@content}}}' + ' #{linebreak(@crafter)}'
85
- } )
84
+ :name => Attribute.create( [ :html, :required ], nil, 1 ),
85
+ :content => Attribute.create( [ :html, :required ], nil, 2 ),
86
+ }, ENDTAG,
87
+ {
88
+ :htmltag => 'meta',
89
+ #~ :html => '<meta name="#{@attr[:name]}" content="#{@attr[:content]}">',
90
+ :latex => '',
91
+ # :latex => '#{linebreak(@crbefore)}' + '\author{#{@content}}\hypersetup{pdfauthor={#{@content}}}' + ' #{linebreak(@crafter)}'
92
+ } )
86
93
  #Like Meta, but not name...
87
94
  Element.create( [:meta2], {
88
- :'http-equiv' => Attribute.create( [ :html, :required ], nil, 1 ),
89
- :content => Attribute.create( [ :html, :required ], nil, 2 ),
90
- }, nil,
91
- {
92
- :htmltag => 'meta',
93
- #~ :html => '<meta name="#{@attr[:name]}" content="#{@attr[:content]}">',
94
- :latex => '',
95
- # :latex => '#{linebreak(@crbefore)}' + '\author{#{@content}}\hypersetup{pdfauthor={#{@content}}}' + ' #{linebreak(@crafter)}'
96
- } )
95
+ :'http-equiv' => Attribute.create( [ :html, :required ], nil, 1 ),
96
+ :content => Attribute.create( [ :html, :required ], nil, 2 ),
97
+ }, nil,
98
+ {
99
+ :htmltag => 'meta',
100
+ #~ :html => '<meta name="#{@attr[:name]}" content="#{@attr[:content]}">',
101
+ :latex => '',
102
+ # :latex => '#{linebreak(@crbefore)}' + '\author{#{@content}}\hypersetup{pdfauthor={#{@content}}}' + ' #{linebreak(@crafter)}'
103
+ } )
97
104
 
98
105
  Element.create( [:author], {}, true,
99
- { :html => '<meta name="author" content="#{@content}">' + ' #{linebreak(@crafter)}',
100
- :latex => '#{linebreak(@crbefore)}\author{#{@content}}#{linebreak(@crmid)}\hypersetup{pdfauthor={#{@content}}}#{linebreak(@crafter)}'
101
- } )
106
+ { :html => '<meta name="author" content="#{@content}">' + ' #{linebreak(@crafter)}',
107
+ :latex => '#{linebreak(@crbefore)}\author{#{@content}}#{linebreak(@crmid)}\hypersetup{pdfauthor={#{@content}}}#{linebreak(@crafter)}'
108
+ } )
102
109
  Element.create( [:date], {}, true,
103
- { :html => '<meta name="creation-date" content="#{@content}">' + ' #{linebreak(@crafter)}',
104
- :latex => '#{linebreak(@crbefore)}\date{#{@content}}#{linebreak(@crafter)}'
105
- } )
110
+ { :html => '<meta name="creation-date" content="#{@content}">' + ' #{linebreak(@crafter)}',
111
+ :latex => '#{linebreak(@crbefore)}\date{#{@content}}#{linebreak(@crafter)}'
112
+ } )
106
113
  Element.create( [:keywords], {}, true,
107
- { :html => '<meta name="keywords" content="#{@content}">' + ' #{linebreak(@crafter)}',
108
- :latex => '#{linebreak(@crbefore)}\hypersetup{pdfkeywords={#{@content}}}#{linebreak(@crafter)}'
109
- } )
114
+ { :html => '<meta name="keywords" content="#{@content}">' + ' #{linebreak(@crafter)}',
115
+ :latex => '#{linebreak(@crbefore)}\hypersetup{pdfkeywords={#{@content}}}#{linebreak(@crafter)}'
116
+ } )
110
117
  Element.create( [:metadescription], {}, true,
111
- { :html => '<meta name="description" content="#{@content}">' + ' #{linebreak(@crafter)}',
112
- :latex => '#{linebreak(@crbefore)}\hypersetup{pdfsubject={#{@content}}}#{linebreak(@crafter)}'
113
- } )
118
+ { :html => '<meta name="description" content="#{@content}">' + ' #{linebreak(@crafter)}',
119
+ :latex => '#{linebreak(@crbefore)}\hypersetup{pdfsubject={#{@content}}}#{linebreak(@crafter)}'
120
+ } )
114
121
  Element.create( [:creator], {}, true,
115
- { :html => '<meta name="creator" content="#{@content}">' + ' #{linebreak(@crafter)}',
116
- :latex => '#{linebreak(@crbefore)}\hypersetup{pdfcreator={#{@content}}}#{linebreak(@crafter)}'
117
- } )
122
+ { :html => '<meta name="creator" content="#{@content}">' + ' #{linebreak(@crafter)}',
123
+ :latex => '#{linebreak(@crbefore)}\hypersetup{pdfcreator={#{@content}}}#{linebreak(@crafter)}'
124
+ } )
118
125
  #~ Element.create( [:hypersetup], {}, true,
119
- #~ { :html => '<meta name="description" content="#{@content}">',
120
- #~ :latex => '#{linebreak(@crbefore)}' + '\pdfinfo{description=#{@content}}' + ' #{linebreak(@crafter)}'
121
- #~ } )
126
+ #~ { :html => '<meta name="description" content="#{@content}">',
127
+ #~ :latex => '#{linebreak(@crbefore)}' + '\pdfinfo{description=#{@content}}' + ' #{linebreak(@crafter)}'
128
+ #~ } )
122
129
 
123
130
  Element.create( [:maketitle], {}, false,
124
- { :htmltag => 'span', #Empty span
125
- :html => "<!-- maketitle -->\n",
126
- :latex => '#{linebreak(@crbefore)}' + '\maketitle #{linebreak(@crafter)}'
127
- } )
131
+ { :htmltag => 'span', #Empty span
132
+ :html => "<!-- maketitle -->\n",
133
+ :latex => '#{linebreak(@crbefore)}' + '\maketitle #{linebreak(@crafter)}'
134
+ } )
128
135
  #~ Element.create( [:tableofcontents], {}, false,
129
- #~ { :htmltag => 'span', #Empty span
130
- #~ :html => '#{linebreak(@crbefore)}<!-- tableofcontents -->#{linebreak(@crafter)}',
131
- #~ :latex => '#{linebreak(@crbefore)}' + '\tableofcontents ' + ' #{linebreak(@crafter)}'
132
- #~ } )
136
+ #~ { :htmltag => 'span', #Empty span
137
+ #~ :html => '#{linebreak(@crbefore)}<!-- tableofcontents -->#{linebreak(@crafter)}',
138
+ #~ :latex => '#{linebreak(@crbefore)}' + '\tableofcontents ' + ' #{linebreak(@crafter)}'
139
+ #~ } )
133
140
 
134
141
  #Build table of contents.
135
142
  #
@@ -137,15 +144,15 @@ Element.create( [:maketitle], {}, false,
137
144
  #
138
145
  #For LaTeX \tableofcontents is created, with attribute :as_list you can create a list.
139
146
  class Tableofcontents < Element
140
- Element.add( [:tableofcontents], Tableofcontents)
141
- add_attributes( {
142
- :level => Attribute.create( [ :html, :latex ], [Fixnum], 1 ),
143
- :pre => Attribute.create( [ :html, :latex ], nil, 2 ),
144
- :post => Attribute.create( [ :html, :latex ], nil, 2 ),
145
- :as_list => Attribute.create( [ :latex ], [true, false], 2 ),
146
- }.update(HTML_ATTR_ALL)
147
+ Element.add( [:tableofcontents], Tableofcontents)
148
+ add_attributes( {
149
+ :level => Attribute.create( [ :html, :latex ], [Fixnum], 1 ),
150
+ :pre => Attribute.create( [ :html, :latex ], nil, 2 ),
151
+ :post => Attribute.create( [ :html, :latex ], nil, 2 ),
152
+ :as_list => Attribute.create( [ :latex ], [true, false], 2 ),
153
+ }.update(HTML_ATTR_ALL)
147
154
  )
148
- def content?(); return false; end
155
+ def content?(); return false; end
149
156
  def to_doc( target, options = {} )
150
157
  o = Docgenerator_logger.set_option_defaults(options)
151
158
  o[:log].debug("enter to_doc(#{target}) for #{self.inspect}, options: #{options.keys.inspect}") if o[:log].debug?
@@ -192,124 +199,124 @@ class Tableofcontents < Element
192
199
  end
193
200
  end
194
201
  Element.create( [:addcontentsline], {
195
- :file => Attribute.create( [ :latex, :required ], [ 'toc', 'lof', 'lot' ] ),
196
- :depth => Attribute.create( [ :latex, :required ], [ -1, 0,1,2,3,4,5,6] ),
197
- }, true,
198
- { #:htmltag => 'span', #Empty span
199
- #:html => "<!-- tableofcontents -->\n",
200
- :latex => '#{linebreak(@crbefore)}' + '\addcontentsline{#{@attr[:file]}}{#{@attr[:depth]}}{#{@content}}' + ' #{linebreak(@crafter)}'
201
- } )
202
+ :file => Attribute.create( [ :latex, :required ], [ 'toc', 'lof', 'lot' ] ),
203
+ :depth => Attribute.create( [ :latex, :required ], [ -1, 0,1,2,3,4,5,6] ),
204
+ }, true,
205
+ { #:htmltag => 'span', #Empty span
206
+ #:html => "<!-- tableofcontents -->\n",
207
+ :latex => '#{linebreak(@crbefore)}' + '\addcontentsline{#{@attr[:file]}}{#{@attr[:depth]}}{#{@content}}' + ' #{linebreak(@crafter)}'
208
+ } )
202
209
  Element.create( [:addtocontents], {
203
- :file => Attribute.create( [ :latex, :required ], [ 'toc', 'lof', 'lot' ] ),
204
- }, true,
205
- { #:htmltag => 'span', #Empty span
206
- #:html => "<!-- tableofcontents -->\n",
207
- :latex => '#{linebreak(@crbefore)}' + '\addtocontents{#{@attr[:file]}}{#{@content}}' + ' #{linebreak(@crafter)}'
208
- } )
210
+ :file => Attribute.create( [ :latex, :required ], [ 'toc', 'lof', 'lot' ] ),
211
+ }, true,
212
+ { #:htmltag => 'span', #Empty span
213
+ #:html => "<!-- tableofcontents -->\n",
214
+ :latex => '#{linebreak(@crbefore)}' + '\addtocontents{#{@attr[:file]}}{#{@content}}' + ' #{linebreak(@crafter)}'
215
+ } )
209
216
 
210
217
  #
211
218
  #Generell paragraph handling.
212
219
  #
213
- Element.create( [:par, :p], HTML_ATTR_ALL, true,
214
- { :htmltag => 'p',
215
- :latex => "\n\n" + '#{@content}' + "\n\n",
216
- :text => "\n" + '#{@content}' + "\n", #siehe experimente/textformat.rb
217
- :wiki => "\n" + '#{@content}' + "\n",
218
- } )
219
- #~ par.add_output( :html, '<p>#{@attr[:content]}</p>')
220
- #~ par.add_output( :latex, '#{@content}\par')
221
-
222
- Element.create( [:nobr], HTML_ATTR_ALL, true,
223
- { :htmltag => 'nobr',
224
- :latex => '#{linebreak(@crbefore)}\mbox{#{@content}}#{linebreak(@crafter)}'
225
- #~ :text => "\n" + '#{@content}' + "\n",
226
- } )
220
+ Element.create( [:par, :p], HTML_ATTR_ALL, true,
221
+ { :htmltag => 'p',
222
+ :latex => "\n\n" + '#{@content}' + "\n\n",
223
+ :text => "\n" + '#{@content}' + "\n", #siehe experimente/textformat.rb
224
+ :wiki => "\n" + '#{@content}' + "\n",
225
+ } )
226
+ #~ par.add_output( :html, '<p>#{@attr[:content]}</p>')
227
+ #~ par.add_output( :latex, '#{@content}\par')
228
+
229
+ Element.create( [:nobr], HTML_ATTR_ALL, true,
230
+ { :htmltag => 'nobr',
231
+ :latex => '#{linebreak(@crbefore)}\mbox{#{@content}}#{linebreak(@crafter)}'
232
+ #~ :text => "\n" + '#{@content}' + "\n",
233
+ } )
227
234
 
228
235
  Element.create( [:br, 'br/', 'br', :newline], {
229
- :clear=> Attribute.create( [ :html ], ['all'] ),
230
- },ENDTAG,
231
- { :htmltag => 'br',
232
- :latex => '#{linebreak(@crbefore)}\newline' + ' #{linebreak(@crafter)}',
233
- :text => "\n",
234
- :wiki => '{{newline}}#{linebreak(@crafter)}',
235
- } )
236
+ :clear=> Attribute.create( [ :html ], ['all'] ),
237
+ },ENDTAG,
238
+ { :htmltag => 'br',
239
+ :latex => '#{linebreak(@crbefore)}\newline' + ' #{linebreak(@crafter)}',
240
+ :text => "\n",
241
+ :wiki => '{{newline}}#{linebreak(@crafter)}',
242
+ } )
236
243
  Element.create( [:hr, 'hr/', 'hr', :hrulefill], {
237
- :clear=> Attribute.create( [ :html ], ['all'] ),
238
- },ENDTAG,
239
- { :htmltag => 'hr',
240
- :wiki => '----',
241
- :text => '-' * 25,
242
- :latex => '#{linebreak(@crbefore)}' + '\hrulefill' + ' #{linebreak(@crafter)}'
243
- } )
244
+ :clear=> Attribute.create( [ :html ], ['all'] ),
245
+ },ENDTAG,
246
+ { :htmltag => 'hr',
247
+ :wiki => '----',
248
+ :text => '-' * 25,
249
+ :latex => '#{linebreak(@crbefore)}' + '\hrulefill' + ' #{linebreak(@crafter)}'
250
+ } )
244
251
 
245
252
  Element.create( [:vfill], {},false,
246
- { :htmltag => nil,
247
- :latex => '#{linebreak(@crbefore)}\vfill #{linebreak(@crafter)}'
248
- } )
253
+ { :htmltag => nil,
254
+ :latex => '#{linebreak(@crbefore)}\vfill #{linebreak(@crafter)}'
255
+ } )
249
256
  Element.create( [:hfill], {},false,
250
- { :htmltag => nil,
251
- :latex => '#{linebreak(@crbefore)}\hfill #{linebreak(@crafter)}'
252
- } )
257
+ { :htmltag => nil,
258
+ :latex => '#{linebreak(@crbefore)}\hfill #{linebreak(@crafter)}'
259
+ } )
253
260
 
254
261
  Element.create( [:relax], {},false,
255
- { :htmltag => nil,
256
- :latex => '#{linebreak(@crbefore)}\relax #{linebreak(@crafter)}'
257
- } )
262
+ { :htmltag => nil,
263
+ :latex => '#{linebreak(@crbefore)}\relax #{linebreak(@crafter)}'
264
+ } )
258
265
 
259
266
  #
260
267
  #Grouping
261
268
  #
262
- Element.create( [:span, :group], HTML_ATTR_CORE, true,
263
- { :htmltag => 'span',
264
- :latex => '#{linebreak(@crbefore)}' +
265
- '\bgroup ' + '#{linebreak(@crmid)}' +
266
- '#{@content}' + '#{linebreak(@crmid)}' +
267
- '\egroup ' + '#{linebreak(@crafter)}'
268
- } )
269
+ Element.create( [:span, :group], HTML_ATTR_CORE, true,
270
+ { :htmltag => 'span',
271
+ :latex => '#{linebreak(@crbefore)}' +
272
+ '\bgroup ' + '#{linebreak(@crmid)}' +
273
+ '#{@content}' + '#{linebreak(@crmid)}' +
274
+ '\egroup ' + '#{linebreak(@crafter)}'
275
+ } )
269
276
 
270
277
  divattr = { :align => HTML_ATTR_ALIGN}
271
278
  divattr.update( HTML_ATTR_CORE )
272
- Element.create( [:div, :Group], divattr, true,
273
- { :htmltag => 'div',
274
- :latex => '#{linebreak(@crbefore)}' +
275
- '\begingroup ' + '#{linebreak(@crmid)}' +
276
- '#{@content}' + '#{linebreak(@crmid)}' +
277
- '\endgroup ' + '#{linebreak(@crafter)}',
279
+ Element.create( [:div, :Group], divattr, true,
280
+ { :htmltag => 'div',
281
+ :latex => '#{linebreak(@crbefore)}' +
282
+ '\begingroup ' + '#{linebreak(@crmid)}' +
283
+ '#{@content}' + '#{linebreak(@crmid)}' +
284
+ '\endgroup ' + '#{linebreak(@crafter)}',
278
285
  :text => '#{@content}',
279
286
  :wiki => '#{@content}',
280
- } )
287
+ } )
281
288
 
282
289
 
283
290
  #Make a separator lin in code
284
- Element.create( [:sepline], {}, false,
285
- { :html => "\n<!--" + '-' * 50 + " -->\n",
286
- :latex => "\n%" + '-' * 50 + "\n"
287
- } )
291
+ Element.create( [:sepline], {}, false,
292
+ { :html => "\n<!--" + '-' * 50 + " -->\n",
293
+ :latex => "\n%" + '-' * 50 + "\n"
294
+ } )
288
295
  #Make a comment in code
289
- Element.create( [:comment], {}, true,
290
- { :htmltag => '<!-- #{@content} -->',
291
- :latex => '#{linebreak(@crbefore)}' + '% ------- #{@content} -------' + ' #{linebreak(@crafter)}'
292
- } )
296
+ Element.create( [:comment], {}, true,
297
+ { :htmltag => '<!-- #{@content} -->',
298
+ :latex => '#{linebreak(@crbefore)}' + '% ------- #{@content} -------' + ' #{linebreak(@crafter)}'
299
+ } )
293
300
 
294
301
  #
295
302
  #Links
296
303
  #
297
304
  #Better: \hypertarget, hyperlink (pdf)
298
305
  Element.create( [ :url ],
299
- HTML_ATTR_ALL,
300
- true,
301
- {
302
- :html => '#{linebreak(@crbefore)}<a href="#{@content}">#{@content}</a>#{linebreak(@crafter)}',
303
- :latex => '#{linebreak(@crbefore)}\url{#{@content}}#{linebreak(@crafter)}',
304
- } )
306
+ HTML_ATTR_ALL,
307
+ true,
308
+ {
309
+ :html => '#{linebreak(@crbefore)}<a href="#{@content}">#{@content}</a>#{linebreak(@crafter)}',
310
+ :latex => '#{linebreak(@crbefore)}\url{#{@content}}#{linebreak(@crafter)}',
311
+ } )
305
312
 
306
313
  Element.create( [ :ensuremath ],
307
- {},
308
- true,
309
- {
310
- :html => '#{@content}',
311
- :latex => '\ensuremath{#{@content}}',
312
- } )
314
+ {},
315
+ true,
316
+ {
317
+ :html => '#{@content}',
318
+ :latex => '\ensuremath{#{@content}}',
319
+ } )
313
320
 
314
321
  #
315
322
  #Internal reference
@@ -318,286 +325,288 @@ Element.create( [ :ensuremath ],
318
325
  #
319
326
  #For external links use :href.
320
327
  class Href < Element
321
- Element.add( [:a, :href], Href)
322
- add_attributes( {
323
- :href => Attribute.create( [ :html, :required ], [String], 1 ),
324
- :hreflang => ATTR_LANG,
325
- :alt => Attribute.create( [ :html ], [String], 2 ),
326
- :name => Attribute.create( [ :html ], [String] ),
327
- :longdesc => Attribute.create( [ :html ], [String] ),
328
- :value => Attribute.create( [ :html ] ),
329
- :shape => Attribute.create( [ :html ] ),
330
- :coords => Attribute.create( [ :html ] ),
331
- :target => Attribute.create( [ :html ], [ '_blank', '_parent', '_self', '_top' ] ),
332
- }.update(HTML_ATTR_ALL)
333
- )
334
- def htmltag(); 'a'; end
335
- def to_wiki( options = {} )
336
- "[#{@attr[:href].to_s} #{@content.to_doc(:wiki, options)}]"
337
- end
338
- def to_latex( options = {} )
328
+ Element.add( [:a, :href], Href)
329
+ add_attributes( {
330
+ :href => Attribute.create( [ :html, :required ], [String], 1 ),
331
+ :hreflang => ATTR_LANG,
332
+ :alt => Attribute.create( [ :html ], [String], 2 ),
333
+ :name => Attribute.create( [ :html ], [String] ),
334
+ :longdesc => Attribute.create( [ :html ], [String] ),
335
+ :value => Attribute.create( [ :html ] ),
336
+ :shape => Attribute.create( [ :html ] ),
337
+ :coords => Attribute.create( [ :html ] ),
338
+ :target => Attribute.create( [ :html ], [ '_blank', '_parent', '_self', '_top' ] ),
339
+ }.update(HTML_ATTR_ALL)
340
+ )
341
+ def htmltag(); 'a'; end
342
+ def to_wiki( options = {} )
343
+ "[#{@attr[:href].to_s} #{@content.to_doc(:wiki, options)}]"
344
+ end
345
+ def to_latex( options = {} )
339
346
  cmd = linebreak(@crbefore)
340
- reference = @attr[:href].to_s
341
- if reference.sub!(/\#/, '') #Internal reference
342
- cmd << "\\hyperlink{#{reference}}{#{@content.to_doc(:latex, options)}}"
343
- else #external reference
344
- cmd << "\\href{#{reference}}{#{@content.to_doc(:latex, options)}}"
345
- end
347
+ reference = @attr[:href].to_s
348
+ if reference.sub!(/\#/, '') #Internal reference
349
+ cmd << "\\hyperlink{#{reference}}{#{@content.to_doc(:latex, options)}}"
350
+ else #external reference
351
+ cmd << "\\href{#{reference}}{#{@content.to_doc(:latex, options)}}"
352
+ end
346
353
  cmd << linebreak(@crafter)
347
354
  cmd
348
- end
349
- def to_text( options = {} )
350
- if @attr[:href].to_s == @content
351
- @content.to_doc(:text, options)
352
- else
353
- #~ "<#{@attr[:href].to_s} #{@content}>" --> Problem: Wird gerne als komplette URL interpreitert
354
- "#{@content.to_doc(:text, options)} (#{@attr[:href].to_s})"
355
- end
356
- end
355
+ end
356
+ def to_text( options = {} )
357
+ if @attr[:href].to_s == @content
358
+ @content.to_doc(:text, options)
359
+ else
360
+ #~ "<#{@attr[:href].to_s} #{@content}>" --> Problem: Wird gerne als komplette URL interpreitert
361
+ "#{@content.to_doc(:text, options)} (#{@attr[:href].to_s})"
362
+ end
363
+ end
357
364
  end
358
365
 
359
366
  #~ Element.create( [ :a, :href ],
360
- #~ { :href => Attribute.create( [ :html, :required ], [String], 1 ),
361
- #~ :hreflang => ATTR_LANG,
362
- #~ :alt => Attribute.create( [ :html ], [String], 2 ),
363
- #~ :name => Attribute.create( [ :html ], [String] ),
364
- #~ :longdesc => Attribute.create( [ :html ], [String] ),
365
- #~ :value => Attribute.create( [ :html ] ),
366
- #~ :shape => Attribute.create( [ :html ] ),
367
- #~ :coords => Attribute.create( [ :html ] ),
368
- #~ :target => Attribute.create( [ :html ], [ '_blank', '_parent', '_self', '_top' ] ),
369
- #~ }.update( HTML_ATTR_ALL ),
370
- #~ true,
371
- #~ {
372
- #~ :htmltag => 'a',
373
- #~ :latex => '\href{#{@attr[:href]}}{#{@content}}',
374
- #~ } )
367
+ #~ { :href => Attribute.create( [ :html, :required ], [String], 1 ),
368
+ #~ :hreflang => ATTR_LANG,
369
+ #~ :alt => Attribute.create( [ :html ], [String], 2 ),
370
+ #~ :name => Attribute.create( [ :html ], [String] ),
371
+ #~ :longdesc => Attribute.create( [ :html ], [String] ),
372
+ #~ :value => Attribute.create( [ :html ] ),
373
+ #~ :shape => Attribute.create( [ :html ] ),
374
+ #~ :coords => Attribute.create( [ :html ] ),
375
+ #~ :target => Attribute.create( [ :html ], [ '_blank', '_parent', '_self', '_top' ] ),
376
+ #~ }.update( HTML_ATTR_ALL ),
377
+ #~ true,
378
+ #~ {
379
+ #~ :htmltag => 'a',
380
+ #~ :latex => '\href{#{@attr[:href]}}{#{@content}}',
381
+ #~ } )
375
382
 
376
383
  Element.create( [ :label ],
377
- {
378
- :name => Attribute.create( [ :html, :latex, :required ] ),
379
- }.update( HTML_ATTR_ALL ),
380
- true,
381
- {
382
- #~ :htmltag => 'a',
383
- :html => '#{linebreak(@crbefore)}<a name="#{@attr[:name]}">#{linebreak(@crmid)}#{@content}</a>#{linebreak(@crafter)}',
384
- :latex => '#{linebreak(@crbefore)}\label{#{@attr[:name]}}#{linebreak(@crmid)}\hypertarget{#{@attr[:name]}}{#{@content}}#{linebreak(@crafter)}',
384
+ {
385
+ :name => Attribute.create( [ :html, :latex, :required ] ),
386
+ }.update( HTML_ATTR_ALL ),
387
+ true,
388
+ {
389
+ #~ :htmltag => 'a',
390
+ :html => '#{linebreak(@crbefore)}<a name="#{@attr[:name]}">#{linebreak(@crmid)}#{@content}</a>#{linebreak(@crafter)}',
391
+ :latex => '#{linebreak(@crbefore)}\label{#{@attr[:name]}}#{linebreak(@crmid)}\hypertarget{#{@attr[:name]}}{#{@content}}#{linebreak(@crafter)}',
385
392
  :text => '(#{@attr[:name]}) #{@content}',
386
393
  :wiki => '#{linebreak(@crbefore)}[[??#{@attr[:name]}]]#{@content}#{linebreak(@crafter)}', #fixme wrong
387
- } )
394
+ } )
388
395
 
389
396
  Element.create( [ :hypertarget ],
390
- { :href => Attribute.create( [ :html, :required ] ),
391
- :alt => Attribute.create( [ :html ] ),
392
- :longdesc => Attribute.create( [ :html ] ),
393
- :value => Attribute.create( [ :html ] ),
394
- :shape => Attribute.create( [ :html ] ),
395
- :coords => Attribute.create( [ :html ] ),
396
- }.update( HTML_ATTR_ALL ),
397
- true,
398
- {
399
- #~ :htmltag => 'a',
400
- :latex => '#{linebreak(@crbefore)}\hypertarget{#{@attr[:href]}}{#{@content}}#{linebreak(@crafter)}',
401
- } )
397
+ { :href => Attribute.create( [ :html, :required ] ),
398
+ :alt => Attribute.create( [ :html ] ),
399
+ :longdesc => Attribute.create( [ :html ] ),
400
+ :value => Attribute.create( [ :html ] ),
401
+ :shape => Attribute.create( [ :html ] ),
402
+ :coords => Attribute.create( [ :html ] ),
403
+ }.update( HTML_ATTR_ALL ),
404
+ true,
405
+ {
406
+ #~ :htmltag => 'a',
407
+ :latex => '#{linebreak(@crbefore)}\hypertarget{#{@attr[:href]}}{#{@content}}#{linebreak(@crafter)}',
408
+ } )
402
409
 
403
410
  Element.create( [ :link ],
404
- { :href => Attribute.create( [ :html, :required ], nil, 1 ),
405
- :rel => Attribute.create( [ :html ], [String], 2 ),
406
- :title => Attribute.create( [ :html ], nil, 3 ),
407
- :type => Attribute.create( [ :html ], nil, 4 ),
408
- }.update( HTML_ATTR_ALL ),
409
- ENDTAG,
410
- {
411
- :htmltag => 'link',
412
- #~ :latex => '',
413
- } )
411
+ { :href => Attribute.create( [ :html, :required ], nil, 1 ),
412
+ :rel => Attribute.create( [ :html ], [String], 2 ),
413
+ :title => Attribute.create( [ :html ], nil, 3 ),
414
+ :type => Attribute.create( [ :html ], nil, 4 ),
415
+ }.update( HTML_ATTR_ALL ),
416
+ ENDTAG,
417
+ {
418
+ :htmltag => 'link',
419
+ #~ :latex => '',
420
+ } )
414
421
 
415
422
  #
416
423
 
417
424
  #
418
- #TeX-Makro usepackage.
419
- # Trys to load element definitions
425
+ #Add a TeX-Makro usepackage.
426
+ #
427
+ #This method tries to load the package specific definitions in a file
428
+ # docgenerator_<<packagename>>
420
429
  #
421
430
  class Usepackage < Element
422
- #Make the key known to the complete key-list of elements.
423
- Element.add( [:usepackage], Usepackage)
424
- #~ add_attributes( HTML_ATTR_ALL )
425
- add_attributes( { :option => Attribute.create( ) } )
426
-
427
- #With usepackage additional command may be defined.
428
- #Here we load this special commands/elements if available.
429
- def << ( content )
430
- @content << content
431
- #Load new makros
432
- makrodefinitions = 'docgenerator_' + content + '.rb'
433
- begin
434
- require makrodefinitions
435
- rescue LoadError
436
- end
437
- end
438
-
439
- #Redefine standard output.
440
- #Options are given, if an option is available.
441
- #~ add_output( :latex, '\usepackage[#{@attr[:option]}]{#{@content}}' )
442
- def to_latex( options = {} )
443
- cmd = linebreak(@crbefore)
444
- cmd << '\usepackage'
445
- opt = @attr[:option].content
446
- cmd << '[' + opt.join(',') + ']' if opt.size > 0
447
- cmd << "{#{@content}}"
448
- cmd << linebreak(@crafter)
449
- return cmd
450
- end
451
- def to_html( options = {} )
452
- return ''
453
- end
454
- end #Usepackage
455
-
456
-
457
-
458
- #~ :em => {}, #complete it
459
- #~ :code => {}, #complete it
431
+ #Make the key known to the complete key-list of elements.
432
+ Element.add( [:usepackage], Usepackage)
433
+ #~ add_attributes( HTML_ATTR_ALL )
434
+ add_attributes( { :option => Attribute.create( ) } )
435
+
436
+ #With usepackage additional command may be defined.
437
+ #Here we load this special commands/elements if available.
438
+ def << ( content )
439
+ @content << content
440
+ #Load new makros if available
441
+ makrodefinitions = 'docgenerator_' + content + '.rb'
442
+ begin
443
+ require makrodefinitions
444
+ rescue LoadError
445
+ end
446
+ end
447
+
448
+ #Redefine standard output.
449
+ #Options are given, if an option is available.
450
+ #~ add_output( :latex, '\usepackage[#{@attr[:option]}]{#{@content}}' )
451
+ def to_latex( options = {} )
452
+ cmd = linebreak(@crbefore)
453
+ cmd << '\usepackage'
454
+ opt = @attr[:option].content
455
+ cmd << '[' + opt.join(',') + ']' if opt.size > 0
456
+ cmd << "{#{@content}}"
457
+ cmd << linebreak(@crafter)
458
+ return cmd
459
+ end
460
+ def to_html( options = {} )
461
+ return ''
462
+ end
463
+ end #Usepackage
464
+
465
+
466
+
467
+ #~ :em => {}, #complete it
468
+ #~ :code => {}, #complete it
460
469
  Element.create( [:font], {
461
- :size => Attribute.create([:html], [ Fixnum ]),
462
- },true,
463
- { :htmltag => 'font',
464
- #~ :latex => '\tiny ' #+ ' #{linebreak(@crafter)}'
465
- } )
470
+ :size => Attribute.create([:html], [ Fixnum ]),
471
+ },true,
472
+ { :htmltag => 'font',
473
+ #~ :latex => '\tiny ' #+ ' #{linebreak(@crafter)}'
474
+ } )
466
475
  #Fixme: Jeweils :tinytex f�r ungeklammerte
467
476
  Element.create( [:tiny ], {},true,
468
- { :html => '<span style="font-size:xx-small">#{@content}</span>',
469
- :latex => '#{linebreak(@crbefore)}{\tiny #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
470
- } )
477
+ { :html => '<span style="font-size:xx-small">#{@content}</span>',
478
+ :latex => '#{linebreak(@crbefore)}{\tiny #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
479
+ } )
471
480
  Element.create( [:scriptsize ], {},true,
472
- { :html => '<span style="font-size:x-small">#{@content}</span>',
473
- :latex => '#{linebreak(@crbefore)}{\scriptsize #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
474
- } )
481
+ { :html => '<span style="font-size:x-small">#{@content}</span>',
482
+ :latex => '#{linebreak(@crbefore)}{\scriptsize #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
483
+ } )
475
484
  Element.create( [:footnotesize ], {},true,
476
- { :html => '<span style="font-size:x-small">#{@content}</span>',
477
- :latex => '#{linebreak(@crbefore)}{\footnotesize #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
478
- } )
479
- #fixme \small oder {\small ..}
485
+ { :html => '<span style="font-size:x-small">#{@content}</span>',
486
+ :latex => '#{linebreak(@crbefore)}{\footnotesize #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
487
+ } )
488
+ #fixme \small oder {\small ..}
480
489
  Element.create( [:small ], {},true,
481
- { #:html => '<span style="font-size:small">#{@content}</span>',
482
- :htmltag => 'small',
483
- :latex => '#{linebreak(@crbefore)}{\small #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
484
- } )
490
+ { #:html => '<span style="font-size:small">#{@content}</span>',
491
+ :htmltag => 'small',
492
+ :latex => '#{linebreak(@crbefore)}{\small #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
493
+ } )
485
494
  Element.create( [:normalsize ], {},true,
486
- { :html => '<span style="font-size:medium">#{@content}</span>',
487
- :latex => '#{linebreak(@crbefore)}{\normalsize #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
488
- } )
495
+ { :html => '<span style="font-size:medium">#{@content}</span>',
496
+ :latex => '#{linebreak(@crbefore)}{\normalsize #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
497
+ } )
489
498
  Element.create( [:large ], {},true,
490
- { :html => '<span style="font-size:large">#{@content}</span>',
491
- :latex => '#{linebreak(@crbefore)}{\large #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
492
- } )
499
+ { :html => '<span style="font-size:large">#{@content}</span>',
500
+ :latex => '#{linebreak(@crbefore)}{\large #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
501
+ } )
493
502
  Element.create( [:Large ], {},true,
494
- { :html => '<span style="font-size:x-large">#{@content}</span>',
495
- :latex => '#{linebreak(@crbefore)}{\Large #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
496
- } )
503
+ { :html => '<span style="font-size:x-large">#{@content}</span>',
504
+ :latex => '#{linebreak(@crbefore)}{\Large #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
505
+ } )
497
506
  Element.create( [:huge ], {},true,
498
- { :html => '<span style="font-size:xx-large">#{@content}</span>',
499
- :latex => '#{linebreak(@crbefore)}{\huge #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
500
- } )
507
+ { :html => '<span style="font-size:xx-large">#{@content}</span>',
508
+ :latex => '#{linebreak(@crbefore)}{\huge #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
509
+ } )
501
510
  Element.create( [:Huge ], {},true,
502
- { :html => '<span style="font-size:xx-large">#{@content}</span>',
503
- :latex => '#{linebreak(@crbefore)}{\Huge #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
504
- } )
511
+ { :html => '<span style="font-size:xx-large">#{@content}</span>',
512
+ :latex => '#{linebreak(@crbefore)}{\Huge #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
513
+ } )
505
514
 
506
515
  Element.create( [:textbf, :strong ], {},true,
507
- { :htmltag => 'strong',
508
- :latex => '#{linebreak(@crbefore)}\textbf{#{@content}}#{linebreak(@crafter)}',
509
- :wiki => %q|#{linebreak(@crbefore)}'''#{@content}'''#{linebreak(@crafter)}|,
510
- :text => '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}',
511
- } )
516
+ { :htmltag => 'strong',
517
+ :latex => '#{linebreak(@crbefore)}\textbf{#{@content}}#{linebreak(@crafter)}',
518
+ :wiki => %q|#{linebreak(@crbefore)}'''#{@content}'''#{linebreak(@crafter)}|,
519
+ :text => '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}',
520
+ } )
512
521
  Element.create( [:emph ], {},true,
513
- { :htmltag => 'em',
514
- :latex => '#{linebreak(@crbefore)}\emph{#{@content}}#{linebreak(@crafter)}',
515
- :wiki => '#{linebreak(@crbefore)}''#{@content}''#{linebreak(@crafter)}',
516
- :text => '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}',
517
- } )
522
+ { :htmltag => 'em',
523
+ :latex => '#{linebreak(@crbefore)}\emph{#{@content}}#{linebreak(@crafter)}',
524
+ :wiki => '#{linebreak(@crbefore)}''#{@content}''#{linebreak(@crafter)}',
525
+ :text => '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}',
526
+ } )
518
527
 
519
528
  Element.create( [:stroke ], {},true,
520
- { #:html => '<span style="font-size:small">#{@content}</span>',
521
- :htmltag => 's',
522
- #~ :latex => '#{linebreak(@crbefore)}{\stroke #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
523
- } )
529
+ { #:html => '<span style="font-size:small">#{@content}</span>',
530
+ :htmltag => 's',
531
+ #~ :latex => '#{linebreak(@crbefore)}{\stroke #{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
532
+ } )
524
533
 
525
534
  Element.create( [:underline ], {},true,
526
- { #:html => '<span style="font-size:small">#{@content}</span>',
527
- :htmltag => 'undeline',
528
- :latex => '#{linebreak(@crbefore)}{\underline#{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
529
- } )
535
+ { #:html => '<span style="font-size:small">#{@content}</span>',
536
+ :htmltag => 'undeline',
537
+ :latex => '#{linebreak(@crbefore)}{\underline#{@content}}#{linebreak(@crafter)}' #+ ' #{linebreak(@crafter)}'
538
+ } )
530
539
 
531
540
  Element.create( [:sup, :textsuperscript ], {}.update(HTML_ATTR_ALL),true,
532
- { :htmltag => 'sup',
533
- :latex => '#{linebreak(@crbefore)}\textsuperscript{#{@content}}#{linebreak(@crafter)}',
534
- :wiki => '#{linebreak(@crbefore)}^#{@content}^#{linebreak(@crafter)}',
535
- :text => '#{linebreak(@crbefore)}^#{@content}^#{linebreak(@crafter)}'
536
- } )
541
+ { :htmltag => 'sup',
542
+ :latex => '#{linebreak(@crbefore)}\textsuperscript{#{@content}}#{linebreak(@crafter)}',
543
+ :wiki => '#{linebreak(@crbefore)}^#{@content}^#{linebreak(@crafter)}',
544
+ :text => '#{linebreak(@crbefore)}^#{@content}^#{linebreak(@crafter)}'
545
+ } )
537
546
 
538
547
  #
539
548
  #Math function: sup
540
549
  #~ Element.create( [:latexsup ], {}.update(HTML_ATTR_ALL),false,
541
- #~ { :html => 'sup',
542
- #~ :latex => '#{linebreak(@crbefore)}\sup}#{linebreak(@crafter)}'
543
- #~ } )
550
+ #~ { :html => 'sup',
551
+ #~ :latex => '#{linebreak(@crbefore)}\sup}#{linebreak(@crafter)}'
552
+ #~ } )
544
553
 
545
554
  Element.create( [:sub ], {}.update(HTML_ATTR_ALL),true,
546
- { :htmltag => 'sub',
547
- #:latex => '\emph{#{@content}}'
548
- } )
555
+ { :htmltag => 'sub',
556
+ #:latex => '\emph{#{@content}}'
557
+ } )
549
558
 
550
-
559
+
551
560
  Element.create( [:newpage ], {},false,
552
- { #:htmltag => '',
553
- :latex => '#{linebreak(@crbefore)}\newpage #{linebreak(@crafter)}'
554
- } )
561
+ { #:htmltag => '',
562
+ :latex => '#{linebreak(@crbefore)}\newpage #{linebreak(@crafter)}'
563
+ } )
555
564
  Element.create( [:clearpage ], {},false,
556
- { #:htmltag => '',
557
- :latex => '#{linebreak(@crbefore)}' + '\clearpage ' + ' #{linebreak(@crafter)}'
558
- } )
565
+ { #:htmltag => '',
566
+ :latex => '#{linebreak(@crbefore)}' + '\clearpage ' + ' #{linebreak(@crafter)}'
567
+ } )
559
568
  Element.create( [:twocolumn ], {},false,
560
- { #:htmltag => '',
561
- :latex => '#{linebreak(@crbefore)}' + '\twocolumn ' + ' #{linebreak(@crafter)}'
562
- } )
569
+ { #:htmltag => '',
570
+ :latex => '#{linebreak(@crbefore)}' + '\twocolumn ' + ' #{linebreak(@crafter)}'
571
+ } )
563
572
  #fixme: TeX kein content, HTML hat content
564
573
  Element.create( [:centering ], {},false,
565
- { :htmltag => 'center',
566
- :latex => '\centering ' + ' #{linebreak(@crafter)}'
567
- } )
568
-
569
- #~ :link => {}, #complete it
570
- #~ :center => {}, #complete it
571
- #~ :map => all.update({}), #complete it
572
- #~ :area => all.update({}), #complete it
574
+ { :htmltag => 'center',
575
+ :latex => '\centering ' + ' #{linebreak(@crafter)}'
576
+ } )
577
+
578
+ #~ :link => {}, #complete it
579
+ #~ :center => {}, #complete it
580
+ #~ :map => all.update({}), #complete it
581
+ #~ :area => all.update({}), #complete it
573
582
  #~ :option=> {:value=>nil}, #complete it
574
583
  #~ :select=> events.update({}), #complete it
575
584
 
576
585
  Element.create( :input, {}, true, {
577
- :latex => '#{linebreak(@crbefore)}\input{#{@content}}#{linebreak(@crafter)}'
586
+ :latex => '#{linebreak(@crbefore)}\input{#{@content}}#{linebreak(@crafter)}'
578
587
  } )
579
588
  Element.create( :include, {}, true, {
580
- :latex => '#{linebreak(@crbefore)}\include{#{@content}}#{linebreak(@crafter)}'
589
+ :latex => '#{linebreak(@crbefore)}\include{#{@content}}#{linebreak(@crafter)}'
581
590
  } )
582
591
 
583
592
 
584
593
  Element.create( [:img, :includegraphics],
585
- {
586
- :src => Attribute.create([:html, :latex, :required], [ String ], 1),
587
- :alt => Attribute.create([:html], [String], 2 ),
588
- :style => Attribute.create([:html], [String] ),
589
- :width => Attribute.create([:texkeyval], [Integer, String] ), #String for \textwidth... for HTML use CSS
590
- :height => Attribute.create([:texkeyval], [Integer, String] ), #String for \textwidth... for HTML use CSS
591
- :border => Attribute.create([:html], [Integer] ),
592
- :longdesc => Attribute.create([:html], [String] ),
593
- :usemap => Attribute.create([:html], [String] ),
594
- :name => Attribute.create([:html], [String] ),
595
- :angle => Attribute.create([:texkeyval], [Integer] ), #Rotation angle.
596
- :align => HTML_ATTR_ALIGN,
597
- }.update(HTML_ATTR_CORE), ENDTAG,
598
- { #:html => '<span style="font-size:xx-small">#{@content}</span>',
599
- :htmltag => 'img',
600
- :latex => '#{linebreak(@crbefore)}\includegraphics[#{texkeyval}]{#{@attr[:src]}}#{linebreak(@crafter)}'
601
- }
594
+ {
595
+ :src => Attribute.create([:html, :latex, :required], [ String ], 1),
596
+ :alt => Attribute.create([:html], [String], 2 ),
597
+ :style => Attribute.create([:html], [String] ),
598
+ :width => Attribute.create([:texkeyval], [Integer, String] ), #String for \textwidth... for HTML use CSS
599
+ :height => Attribute.create([:texkeyval], [Integer, String] ), #String for \textwidth... for HTML use CSS
600
+ :border => Attribute.create([:html], [Integer] ),
601
+ :longdesc => Attribute.create([:html], [String] ),
602
+ :usemap => Attribute.create([:html], [String] ),
603
+ :name => Attribute.create([:html], [String] ),
604
+ :angle => Attribute.create([:texkeyval], [Integer] ), #Rotation angle.
605
+ :align => HTML_ATTR_ALIGN,
606
+ }.update(HTML_ATTR_CORE), ENDTAG,
607
+ { #:html => '<span style="font-size:xx-small">#{@content}</span>',
608
+ :htmltag => 'img',
609
+ :latex => '#{linebreak(@crbefore)}\includegraphics[#{texkeyval}]{#{@attr[:src]}}#{linebreak(@crafter)}'
610
+ }
602
611
  )
603
612