docgenerator 1.2.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. data/build_test_and_doc.rb +505 -0
  2. data/examples/creole_example.rb +82 -0
  3. data/examples/creole_example_footnote.rb +67 -0
  4. data/examples/creole_example_placeholder.rb +77 -0
  5. data/examples/creole_example_rail.rb +154 -0
  6. data/examples/creole_example_rubycode.rb +144 -0
  7. data/examples/creole_example_struktex.rb +169 -0
  8. data/examples/docgenerator_example.rb +1 -1
  9. data/examples/docgenerator_example_footnote.rb +1 -0
  10. data/examples/docgenerator_example_list.rb +3 -0
  11. data/examples/docgenerator_example_restrictions.rb +1 -1
  12. data/examples/docgenerator_example_tabular.rb +1 -1
  13. data/examples/docgenerator_example_tripfalls.rb +2 -2
  14. data/examples/results/readme +2 -1
  15. data/examples/wiki2docgenerator_example.rb +61 -32
  16. data/lib/creole/creole2doc.rb +57 -58
  17. data/lib/creole/creole_characters.rb +56 -0
  18. data/lib/creole/creole_inclusion_and_plugins.rb +59 -284
  19. data/lib/creole/creole_inclusions.rb +142 -0
  20. data/lib/creole/creole_placeholder.rb +57 -23
  21. data/lib/creole/creole_plugins.rb +198 -0
  22. data/lib/creole/creole_tabular.rb +16 -8
  23. data/lib/creole/plugins/rail.rb +182 -0
  24. data/lib/creole/plugins/rubycode4creole.rb +136 -0
  25. data/lib/creole/plugins/struktex.rb +59 -0
  26. data/lib/creole/plugins/todonotes.rb +70 -0
  27. data/lib/docgenerator.rb +161 -71
  28. data/lib/docgenerator/attribute.rb +189 -156
  29. data/lib/docgenerator/characters.rb +824 -267
  30. data/lib/docgenerator/compatibility_v1.rb +249 -0
  31. data/lib/docgenerator/css.rb +53 -32
  32. data/lib/docgenerator/document.rb +119 -56
  33. data/lib/docgenerator/element.rb +304 -351
  34. data/lib/docgenerator/element_meta.rb +303 -0
  35. data/lib/docgenerator/elements.rb +1112 -481
  36. data/lib/docgenerator/environments.rb +153 -62
  37. data/lib/docgenerator/footnote.rb +30 -9
  38. data/lib/docgenerator/lists.rb +71 -47
  39. data/lib/docgenerator/packages/attachfile.rb +136 -0
  40. data/lib/{packages/docgenerator_caption.rb → docgenerator/packages/caption.rb} +28 -19
  41. data/lib/docgenerator/packages/hyperref.rb +194 -0
  42. data/lib/docgenerator/packages/listings.rb +179 -0
  43. data/lib/docgenerator/packages/pdfpages.rb +43 -0
  44. data/lib/docgenerator/packages/rubycode4doc.rb +227 -0
  45. data/lib/{packages/docgenerator_scrlettr2.rb → docgenerator/packages/scrlettr2.rb} +25 -16
  46. data/lib/docgenerator/packages/scrpage2.rb +410 -0
  47. data/lib/docgenerator/packages/struktex.rb +447 -0
  48. data/lib/docgenerator/packages/todonotes.rb +85 -0
  49. data/lib/{packages/docgenerator_url.rb → docgenerator/packages/url.rb} +7 -6
  50. data/lib/docgenerator/sections.rb +257 -83
  51. data/lib/docgenerator/standard.rb +19 -11
  52. data/lib/docgenerator/tabular.rb +234 -118
  53. data/lib/{templates → docgenerator/templates}/docgenerator_template.rb +52 -44
  54. data/lib/{templates → docgenerator/templates}/docgenerator_template.yaml +0 -0
  55. data/lib/{templates → docgenerator/templates}/docgenerator_template_css.rb +22 -16
  56. data/lib/wiki2doc/plugins/rubycode4wiki.rb +53 -0
  57. data/lib/wiki2doc/plugins/struktex.rb +12 -0
  58. data/lib/wiki2doc/wiki2docgenerator.rb +39 -38
  59. data/lib/wiki2doc/wikimedia_document.rb +24 -0
  60. data/manpage_elements.rb +10411 -0
  61. data/readme.rd +34 -24
  62. data/unittest/creole_testtext.creole +11 -0
  63. data/unittest/expected/test_document_usepackage_undefined.log +2 -2
  64. data/unittest/expected/test_runtex.stdout +0 -1
  65. data/unittest/expected/test_runtex_2.stdout +0 -1
  66. data/unittest/expected/toc_css.css +3 -2
  67. data/unittest/expected_creole/test_creole_characters_all.creole +28 -0
  68. data/unittest/expected_creole/test_creole_characters_all.html +15 -15
  69. data/unittest/expected_creole/test_creole_characters_all.latex +15 -15
  70. data/unittest/expected_creole/test_creole_footnotes_groupid.html +15 -0
  71. data/unittest/expected_creole/test_creole_links_file.html +2 -2
  72. data/unittest/expected_creole/test_creole_links_file.latex +2 -2
  73. data/unittest/expected_creole/test_creole_links_file.text +2 -2
  74. data/unittest/expected_creole/test_creole_picture_link.html +1 -1
  75. data/unittest/expected_creole_rail/test_rail_creole_object.tex +33 -0
  76. data/unittest/expected_creole_rail/test_rail_creole_placeholder.tex +40 -0
  77. data/unittest/expected_rubycode4doc/creole_complete.html +26 -0
  78. data/unittest/expected_rubycode4doc/creole_complete.tex +40 -0
  79. data/unittest/expected_rubycode4doc/creole_in_tab.html +4 -0
  80. data/unittest/expected_rubycode4doc/creole_in_tab.tex +6 -0
  81. data/unittest/expected_rubycode4doc/creole_inline_ruby.html +7 -0
  82. data/unittest/expected_rubycode4doc/creole_output.html +2 -0
  83. data/unittest/expected_rubycode4doc/creole_output.tex +4 -0
  84. data/unittest/expected_rubycode4doc/creole_rubycode.html +1 -0
  85. data/unittest/expected_rubycode4doc/creole_rubycode.tex +3 -0
  86. data/unittest/expected_rubycode4doc/creole_rubycode_evaluated.html +1 -0
  87. data/unittest/expected_rubycode4doc/creole_rubycode_evaluated.tex +3 -0
  88. data/unittest/expected_rubycode4doc/creole_rubycode_evaluated_listings.html +3 -0
  89. data/unittest/expected_rubycode4doc/creole_rubycode_evaluated_listings.tex +5 -0
  90. data/unittest/expected_rubycode4doc/wiki_1.html +8 -0
  91. data/unittest/expected_rubycode4doc/wiki_2.html +8 -0
  92. data/unittest/expected_rubycode4doc/wiki_3.html +9 -0
  93. data/unittest/expected_rubycode4doc/wiki_immediate_1.html +5 -0
  94. data/unittest/expected_rubycode4doc/wiki_immediate_2.html +5 -0
  95. data/unittest/expected_rubycode4doc/wiki_immediate_3.html +8 -0
  96. data/unittest/expected_rubycode4doc/wiki_immediate_full.html +21 -0
  97. data/unittest/expected_struktex/test_struktex_krug.creole +15 -0
  98. data/unittest/expected_struktex/test_struktex_krug.tex +19 -0
  99. data/unittest/expected_struktex/test_struktex_krug.wiki +15 -0
  100. data/unittest/expected_struktex/test_struktex_statement.creole +7 -0
  101. data/unittest/expected_struktex/test_struktex_statement.tex +9 -0
  102. data/unittest/expected_struktex/test_struktex_statement.wiki +7 -0
  103. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.html +0 -0
  104. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.latex +0 -0
  105. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.text +0 -0
  106. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.wiki +0 -0
  107. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.html +1 -1
  108. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.latex +1 -1
  109. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.text +1 -1
  110. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.wiki +1 -1
  111. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.html +0 -0
  112. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.latex +0 -0
  113. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.text +0 -0
  114. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.wiki +0 -0
  115. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote_2.html +0 -0
  116. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote_groupid.html +0 -0
  117. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.html +0 -0
  118. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.latex +0 -0
  119. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.text +0 -0
  120. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.wiki +0 -0
  121. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.html +0 -0
  122. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.latex +0 -0
  123. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.text +0 -0
  124. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.wiki +0 -0
  125. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_label.html +0 -0
  126. data/unittest/expected_wikimedia/test_wiki_link.html +8 -0
  127. data/unittest/expected_wikimedia/test_wiki_link.latex +17 -0
  128. data/unittest/expected_wikimedia/test_wiki_link.wiki +11 -0
  129. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.html +0 -0
  130. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.latex +0 -0
  131. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.text +0 -0
  132. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.wiki +0 -0
  133. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.html +0 -0
  134. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.latex +0 -0
  135. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.text +0 -0
  136. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.wiki +0 -0
  137. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.html +0 -0
  138. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.latex +0 -0
  139. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.text +0 -0
  140. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.wiki +0 -0
  141. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.html +0 -0
  142. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.latex +0 -0
  143. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.text +0 -0
  144. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.wiki +0 -0
  145. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.html +0 -0
  146. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.latex +0 -0
  147. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.text +0 -0
  148. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.wiki +0 -0
  149. data/unittest/expected_wikimedia/test_wiki_picture.html +55 -0
  150. data/unittest/expected_wikimedia/test_wiki_picture.latex +76 -0
  151. data/unittest/expected_wikimedia/test_wiki_picture_thumb.html +5 -0
  152. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_tab1.html +0 -0
  153. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_tab1.latex +0 -0
  154. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_tab1.wiki +0 -0
  155. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.html +0 -0
  156. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.latex +0 -0
  157. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.text +0 -0
  158. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.wiki +0 -0
  159. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.html +0 -0
  160. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.latex +0 -0
  161. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.text +0 -0
  162. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.wiki +0 -0
  163. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.html +0 -0
  164. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.latex +0 -0
  165. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.text +0 -0
  166. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.wiki +0 -0
  167. data/unittest/{unittest_creole2doc.rb → unittest_creole.rb} +385 -476
  168. data/unittest/unittest_creole_placeholders.rb +272 -0
  169. data/unittest/unittest_creole_plugin_rail.rb +147 -0
  170. data/unittest/unittest_docgenerator.rb +206 -332
  171. data/unittest/unittest_docgenerator_characters.rb +650 -0
  172. data/unittest/unittest_docgenerator_runtex.rb +48 -20
  173. data/unittest/unittest_packages_struktex.rb +187 -0
  174. data/unittest/unittest_rubycode4doc.rb +275 -0
  175. data/unittest/unittest_wikimedia.rb +479 -0
  176. metadata +245 -172
  177. data/examples/results_expected/docgenerator_example.html +0 -39
  178. data/examples/results_expected/docgenerator_example.pdf +0 -0
  179. data/examples/results_expected/docgenerator_example.tex +0 -56
  180. data/examples/results_expected/docgenerator_example_footnote.html +0 -40
  181. data/examples/results_expected/docgenerator_example_footnote.pdf +0 -0
  182. data/examples/results_expected/docgenerator_example_footnote.tex +0 -50
  183. data/examples/results_expected/docgenerator_example_list.html +0 -18
  184. data/examples/results_expected/docgenerator_example_list.pdf +0 -0
  185. data/examples/results_expected/docgenerator_example_list.tex +0 -46
  186. data/examples/results_expected/docgenerator_example_restrictions.html +0 -22
  187. data/examples/results_expected/docgenerator_example_restrictions.pdf +0 -0
  188. data/examples/results_expected/docgenerator_example_restrictions.tex +0 -31
  189. data/examples/results_expected/docgenerator_example_tabular.html +0 -37
  190. data/examples/results_expected/docgenerator_example_tabular.pdf +0 -0
  191. data/examples/results_expected/docgenerator_example_tabular.tex +0 -41
  192. data/examples/results_expected/docgenerator_example_tripfalls.html +0 -27
  193. data/examples/results_expected/docgenerator_example_tripfalls.pdf +0 -0
  194. data/examples/results_expected/docgenerator_example_tripfalls.tex +0 -31
  195. data/lib/packages/docgenerator_attachfile.rb +0 -71
  196. data/lib/packages/docgenerator_hyperref.rb +0 -109
  197. data/lib/packages/docgenerator_listings.rb +0 -103
  198. data/lib/packages/docgenerator_pdfpages.rb +0 -24
  199. data/lib/packages/docgenerator_scrpage2.rb +0 -172
  200. data/self_docgenerator.rb +0 -163
  201. data/unittest/expected_wiki/test_wiki_link.html +0 -8
  202. data/unittest/expected_wiki/test_wiki_link.latex +0 -17
  203. data/unittest/expected_wiki/test_wiki_link.wiki +0 -11
  204. data/unittest/expected_wiki/test_wiki_picture.html +0 -55
  205. data/unittest/expected_wiki/test_wiki_picture.latex +0 -76
  206. data/unittest/expected_wiki/test_wiki_picture_thumb.html +0 -5
  207. data/unittest/test_rakefile_docgenerator.rb +0 -43
  208. data/unittest/unittest_versions.rb +0 -44
  209. data/unittest/unittest_wiki2doc.rb +0 -464
@@ -1,30 +1,60 @@
1
+ module Docgenerator
2
+ =begin rdoc
3
+ Collection of Environments.
4
+
5
+ Enviroment are special LaTeX-constructs.
6
+
7
+ Instead
8
+ \makro{content}
9
+ environments are coded as
10
+ \begin{makro}
11
+ content
12
+ \end{makro}
13
+ =end
14
+ module Environments
15
+ =begin rdoc
16
+ Define Element :environment
17
+
18
+ This class is used for further class definitions.
19
+ Only for LaTeX
20
+
21
+ Create an instance with
22
+ element( :environment, [ attributes, [content]] )
23
+ or
24
+ Environment.new( [ attributes, [content]] )
25
+ =end
1
26
  class Environment < Element
2
- Element.add( [:environment], Environment)
3
- #Parameters are given as a string (or anything what gives a String with to_s).
4
- #It is difficult to make a generic parameter interface.
5
- #If needed, redefine the method.
27
+ =begin rdoc
28
+ Parameters are given as a string (or anything what gives a String with to_s).
29
+
30
+ It is difficult to make a generic parameter interface.
31
+
32
+ If needed, redefine the method.
33
+ =end
6
34
  def to_latex_environment( environment, parameter = nil, options={})
7
35
  cmd = ''
8
36
  cmd << "\n" if @crbefore
9
37
  cmd << "\n\\begin{#{environment}}"
10
38
  cmd << parameter.to_s if parameter
11
39
  cmd << "\n" if @crmid
12
- cmd << @content.to_latex
40
+ cmd << @content.to_latex(options)
13
41
  cmd << "\n" if @crmid and cmd[-1,1] != "\n"
14
42
  cmd << "\\end{#{environment}}\n"
15
43
  cmd << "\n" if @crafter
16
44
  return cmd
17
45
  end
18
- #ConTeXt-environments start with start and end with stop.
19
- #
20
- #Fixme: Parameters
46
+ =begin rdoc
47
+ ConTeXt-environments start with start and end with stop.
48
+
49
+ Fixme: Parameters
50
+ =end
21
51
  def to_context_environment( environment, parameter = nil, options={})
22
52
  cmd = ''
23
53
  cmd << "\n" if @crbefore
24
54
  cmd << "\n\\start#{environment}"
25
55
  cmd << parameter.to_s if parameter
26
56
  cmd << "\n" if @crmid
27
- cmd << @content.to_latex
57
+ cmd << @content.to_latex(options)
28
58
  #~ cmd << "\n" if @crmid and cmd[-1,1] != "\n"
29
59
  cmd << "\n\\stop#{environment}\n"
30
60
  cmd << "\n" if @crafter
@@ -32,56 +62,94 @@ class Environment < Element
32
62
  end #~ def htmltag()
33
63
  #~ return 'table'
34
64
  #~ end
35
- #~ def to_latex( )
36
- #~ return to_latex_environment( 'itemize' )
65
+ #~ def to_latex( options={} )
66
+ #~ return to_latex_environment( 'itemize', nil, options )
37
67
  #~ end
38
68
  end
39
69
 
40
- Element.create( [:minipage], { :width => Attribute.create( [ :latex, :html ], [ String ] ), },
41
- true,
42
- { :htmltag => 'div',
43
- :latex => '#{linebreak(@crbefore)}' +
70
+ =begin rdoc
71
+ Define Element :minipage
72
+
73
+ Create an instance with
74
+ element( :minipage, [ attributes, [content]] )
75
+ or
76
+ Minipage.new( [ attributes, [content]] )
77
+ Attributes may be:
78
+ * :width:
79
+ =end
80
+ class Minipage < Element
81
+ add_attribute :width, Attribute.create( [ :latex, :html ], [ String ] )
82
+ add_html_tag 'div'
83
+ add_latex_output '#{linebreak(@crbefore)}' +
44
84
  '\begin{minipage}{#{@attr[:width]}}' + '#{linebreak(@crmid)}' +
45
85
  '#{@content}' + '#{linebreak(@crmid)}' +
46
- '\end{minipage}' + '#{linebreak(@crafter)}'
47
- } )
48
-
49
- Element.create( [:center ], HTML_ATTR_CORE, true,
50
- { :htmltag => 'center',
51
- :latex => '#{linebreak(@crbefore)}\begin{center}#{linebreak(@crmid)}#{@content}#{linebreak(@crmid)}\\end{center}#{linebreak(@crafter)}'
52
- } )
53
- Element.create( [:quote, :blockquote ], HTML_ATTR_CORE, true,
54
- { :htmltag => 'blockquote',
55
- :latex => '#{linebreak(@crbefore)}\begin{quote}#{linebreak(@crmid)}#{@content}#{linebreak(@crmid)}\end{quote}#{linebreak(@crafter)}'
56
- } )
57
-
58
- Element.create( [:landscape ], {}, true,
59
- { #:htmltag => 'center',
60
- :latex => '#{linebreak(@crbefore)}\begin{landscape}#{linebreak(@crmid)}#{@content}#{linebreak(@crmid)}\end{landscape}#{linebreak(@crafter)}'
61
- } )
62
-
63
- Element.create( [:verb ], HTML_ATTR_CORE, true,
64
- {
65
- #This builds a new block
66
- #~ :htmltag => 'pre',
67
- #With "display: inline" the element is continued correct, but <pre starts on new line.
68
- #~ :html => '#{linebreak(@crbefore)}<pre style = "display: inline">#{@content}</pre>#{linebreak(@crafter)}',
69
- #fixme font tt
70
- #~ :html => '#{linebreak(@crbefore)}<span style = "display: inline;white-space:pre;font-family:monospace">#{@content}</span>#{linebreak(@crafter)}',
71
- :html => '#{linebreak(@crbefore)}<span style = "display: inline;white-space:pre;font-family:monospace">#{@content.join.gsub(/</, \'&lt;\').gsub(/>/, \'&gt;\')}</span>#{linebreak(@crafter)}',
72
- :latex => '#{linebreak(@crbefore)}\verb|#{@content}|#{linebreak(@crafter)}',
73
- :text => '#{linebreak(@crbefore)}#{@content}#{linebreak(@crafter)}',
74
- } )
75
-
86
+ '\end{minipage}' + '#{linebreak(@crafter)}'
87
+ end #Minipage
88
+
89
+ =begin rdoc
90
+ Define Element :center
91
+
92
+ Create an instance with
93
+ element( :center, [ attributes, [content]] )
94
+ or
95
+ Center.new( [ attributes, [content]] )
96
+ Attributes may be:
97
+ * HTML_ATTR_CORE
98
+
99
+ =end
100
+ class Center < Element
101
+ add_attributes HTML_ATTR_CORE
102
+ add_html_tag 'center'
103
+ add_latex_output '#{linebreak(@crbefore)}\begin{center}#{linebreak(@crmid)}#{@content}#{linebreak(@crmid)}\end{center}#{linebreak(@crafter)}'
104
+ end #Center
105
+
106
+ =begin rdoc
107
+ Define Element :quote, :blockquote
108
+
109
+ Create an instance with
110
+ element( :quote, [ attributes, [content]] )
111
+ element( :blockquote, [ attributes, [content]] )
112
+ or
113
+ Quote.new( [ attributes, [content]] )
114
+ Attributes may be:
115
+ * HTML_ATTR_CORE
116
+ =end
117
+ class Quote < Element
118
+ add_id :blockquote
119
+ add_attributes HTML_ATTR_CORE
120
+ add_html_tag 'blockquote'
121
+ add_latex_output '#{linebreak(@crbefore)}\begin{quote}#{linebreak(@crmid)}#{@content}#{linebreak(@crmid)}\end{quote}#{linebreak(@crafter)}'
122
+ end #Quote
123
+
124
+ =begin rdoc
125
+ Define Element :landscape
126
+
127
+ Only LaTeX
128
+
129
+ Create an instance with
130
+ element( :landscape, [ attributes, [content]] )
131
+ or
132
+ Landscape.new( [ attributes, [content]] )
133
+ Attributes are not defined for this element.
134
+ =end
135
+ class Landscape < Element
136
+ add_latex_output '#{linebreak(@crbefore)}\begin{landscape}#{linebreak(@crmid)}#{@content}#{linebreak(@crmid)}\end{landscape}#{linebreak(@crafter)}'
137
+ end #Landscape
138
+
139
+
140
+ =begin rdoc
141
+ Environment Verbatim
142
+
143
+ See also Elements::Verb
144
+ =end
76
145
  class Verbatim < Environment
77
- add_attributes( {
78
- :width => Attribute.create( [ :html ], [Integer], 1 ), #Number of characters
79
- }.update(HTML_ATTR_ALL))
80
-
81
- Element.add( [:verbatim, :pre], Verbatim)
82
- #~ def htmltag(); 'pre' end
146
+ add_attribute :width, Attribute.create( [ :html ], [Integer], 1 ) #Number of characters
147
+ add_attributes HTML_ATTR_ALL
148
+ add_id :pre
149
+ =begin rdoc
150
+ =end
83
151
  def to_html(options = {})
84
- o = Docgenerator_logger.set_option_defaults(options)
152
+ o = set_option_defaults(options)
85
153
  html = String.new()
86
154
  html << "\n" if @crbefore
87
155
  html << "<pre"
@@ -98,22 +166,45 @@ class Verbatim < Environment
98
166
  return html
99
167
  end #to_html
100
168
 
101
- def to_text(options = {}); "#{content.join}" end
102
- def to_wiki(options = {} ); " #{content.join}" end
103
- def to_latex(options = {} )
104
- return to_latex_environment( 'verbatim', nil, options = {} )
169
+ =begin rdoc
170
+ =end
171
+ def to_text(options = {}); "#{@content.join}" end
172
+ =begin rdoc
173
+ =end
174
+ def to_wiki(options = {} ); " #{@content.join}" end
175
+ =begin rdoc
176
+ =end
177
+ def to_creole(options = {} ); "{{{\n#{@content.join}\n}}}" end
178
+ =begin rdoc
179
+ =end
180
+ def to_latex(options = {} )
181
+ return to_latex_environment( 'verbatim', nil, options )
105
182
  end
106
183
  end
107
184
 
185
+ =begin rdoc
186
+ =end
108
187
  class Figure < Environment
109
- add_attributes( HTML_ATTR_ALL )
110
- Element.add( [:figure], Figure)
188
+ add_attributes HTML_ATTR_ALL
111
189
  def htmltag(); 'div'; end
112
190
  def to_latex( options = {} )
113
- return to_latex_environment( 'figure', options = {} )
191
+ return to_latex_environment( 'figure', nil, options )
114
192
  end
115
193
  end
116
194
 
117
- Element.create( [:listoffigures], {},false, {
118
- :latex => '#{linebreak(@crbefore)}\listoffigures #{linebreak(@crafter)}',
119
- })
195
+ =begin rdoc
196
+ Environment Abstract.
197
+
198
+ Only LaTeX
199
+ =end
200
+ class Abstract < Environment
201
+ #~ add_attributes( HTML_ATTR_ALL )
202
+ #~ def htmltag(); ''; end
203
+ =begin rdoc
204
+ =end
205
+ def to_latex( options = {} )
206
+ return to_latex_environment( 'abstract', nil, options )
207
+ end
208
+ end
209
+ end #module Environments
210
+ end #module Docgenerator
@@ -1,7 +1,8 @@
1
+ module Docgenerator
1
2
  =begin rdoc
2
3
  Footnotegroup.
3
4
 
4
- A Footnote without group-attribute get it#s own Footnotegroup.
5
+ A Footnote without group-attribute get it's own Footnotegroup.
5
6
  For LaTeX it is ok, for HTML the content of the footnote will disappear.
6
7
  =end
7
8
  class Footnotegroup
@@ -42,9 +43,9 @@ Build a new footnote group.
42
43
  ul = element(:p, @attr ).cr
43
44
  @footnotes.each{|f|
44
45
  #~ ul << element(:sup, {}, f.counter )
45
- ul << footnotemark = element(:sup)
46
+ ul << footnotemark = element(:sup, { :log => options[:log] })
46
47
  if @html_link
47
- footnotemark << element(:label, { :name => "#{f.link}" }, f.label )
48
+ footnotemark << element(:label, { :name => "#{f.link}", :log => options[:log] }, f.label )
48
49
  else
49
50
  footnotemark << f.label
50
51
  end
@@ -56,10 +57,12 @@ Build a new footnote group.
56
57
  end #Footnotegroup
57
58
 
58
59
  =begin rdoc
59
- Footnotes
60
+ A Footnote.
61
+
62
+ ==HTML
63
+ Footnotes should be assigned to a Footnotegroup
60
64
  =end
61
65
  class Footnote < Element
62
- Element.add( [:footnote ], Footnote)
63
66
  add_attributes( {
64
67
  :label => Attribute.create(),
65
68
  :group => Attribute.create([:required], [Footnotegroup] )
@@ -117,9 +120,27 @@ class Footnote < Element
117
120
  end
118
121
  end #Footnote
119
122
 
123
+ =begin rdoc
124
+ Define Element :footnotemark
125
+
126
+ Create an instance with
127
+ element( :footnotemark, [ attributes, [content]] )
128
+ or
129
+ Footnotemark.new( [ attributes, [content]] )
130
+ Attributes may be:
131
+ * HTML_ATTR_CORE
132
+ * HTML_ATTR_I18N
133
+ * HTML_ATTR_EVENTS
134
+ * :lang, ATTR_LANG
135
+ =end
136
+ class Footnotemark < Element
137
+ add_attributes HTML_ATTR_CORE
138
+ add_attributes HTML_ATTR_I18N
139
+ add_attributes HTML_ATTR_EVENTS
140
+ add_attribute :lang, ATTR_LANG
141
+ add_html_tag 'sup'
142
+ add_latex_output '#{linebreak(@crbefore)}\footnotemark[#{@content}]#{linebreak(@crafter)}'
143
+ end #Footnotemark
120
144
 
121
- Element.create( [:footnotemark ], {}.update(HTML_ATTR_ALL),true,
122
- { :htmltag => 'sup',
123
- :latex => '#{linebreak(@crbefore)}\footnotemark[#{@content.to_latex}]#{linebreak(@crafter)}' #fixme
124
- } )
125
145
 
146
+ end #module Docgenerator
@@ -1,7 +1,11 @@
1
+ module Docgenerator
2
+ module Lists
3
+ =begin rdoc
4
+ Generic class for list environments.
1
5
 
2
- #Generell class for list environments
3
- class ListEnvironment < Environment
4
- Element.add( [:listenvironment], ListEnvironment)
6
+ Used to define Itemize, Enumerate...
7
+ =end
8
+ class ListEnvironment < Environments::Environment
5
9
  add_attributes( HTML_ATTR_ALL )
6
10
  #Only items are allowed to be added.
7
11
  #
@@ -13,22 +17,25 @@ class ListEnvironment < Environment
13
17
  if self.class == Description
14
18
  #fixme: Reihenfolge
15
19
  if ! ( item.is_a?( Element.get(:dt) ) or item.is_a?( Element.get(:dd) ) )
16
- @log.warn("Add non-item to list (#{item.class} #{@called_by})") if @log.warn
20
+ @log.warn("Add non-item to list (#{item.inspect})") if @log.warn
17
21
  end
18
22
  elsif ! item.is_a?( Element.get(:item) )
19
- @log.warn("Add non-item to list (#{item.class} #{@called_by})") if @log.warn
23
+ @log.warn("Add non-item to list (#{item.inspect})") if @log.warn
20
24
  end
21
25
  @content << item
22
26
  end
23
27
  end
24
28
  #Add parent-information to options. This is used by the list elements to get the list type.
25
29
  def to_doc( target, options = {} )
26
- o = Docgenerator_logger.set_option_defaults(options)
30
+ o = set_option_defaults(options)
27
31
  o[:log].debug("enter to_doc for #{self.inspect}") if o[:log].debug?
28
32
  options[:parent] = self
29
33
  super
30
34
  end
31
- def to_wiki( options={} )
35
+ def to_wiki( options= {} )
36
+ return "#{@content.to_doc(:wiki, options)}\n".gsub(/\n\n/, "\n")
37
+ end
38
+ def to_creole( options= {} )
32
39
  return "#{@content.to_doc(:wiki, options)}\n".gsub(/\n\n/, "\n")
33
40
  end
34
41
  def to_text( options={} )
@@ -36,9 +43,12 @@ class ListEnvironment < Environment
36
43
  end
37
44
  end
38
45
 
46
+ =begin rdoc
47
+ Unnumbered list
48
+ =end
39
49
  class Itemize < ListEnvironment
40
- add_attributes( HTML_ATTR_ALL )
41
- Element.add( [:ul, :itemize], Itemize)
50
+ add_attributes HTML_ATTR_ALL
51
+ add_id :ul
42
52
  def htmltag(); 'ul'; end
43
53
  def to_latex( options={} )
44
54
  return to_latex_environment( 'itemize', nil, options )
@@ -47,10 +57,13 @@ class Itemize < ListEnvironment
47
57
  return to_context_environment( 'itemize', '[1]', options )
48
58
  end
49
59
  end
60
+ =begin rdoc
61
+ Numbered lists.
62
+ =end
50
63
  class Enumerate < ListEnvironment
51
- add_attributes( HTML_ATTR_ALL )
52
- Element.add( [:ol, :enumerate], Enumerate)
53
- def htmltag(); 'ol'; end
64
+ add_attributes HTML_ATTR_ALL
65
+ add_id :ol
66
+ add_html_tag 'ol'
54
67
  def to_latex( options={} )
55
68
  return to_latex_environment( 'enumerate', nil, options )
56
69
  end
@@ -58,33 +71,32 @@ class Enumerate < ListEnvironment
58
71
  return to_context_environment( 'itemize', '[n]', options )
59
72
  end
60
73
  end
61
- #
62
- #
63
- #HTML:
64
- # <dl>
65
- # <dt> <dd>
66
- # </dl>
74
+
75
+ =begin rdoc
76
+ HTML:
77
+ <dl>
78
+ <dt> <dd>
79
+ </dl>
80
+ =end
67
81
  class Description < ListEnvironment
68
82
  add_attributes( HTML_ATTR_ALL )
69
- Element.add( [:description, :dl], Description)
70
- def htmltag(); 'dl'; end
83
+ add_id :dl
84
+ add_html_tag 'dl'
71
85
  def to_latex( options={} )
72
86
  return to_latex_environment( 'description', nil, options )
73
87
  end
74
88
  end
75
89
 
76
- #
77
- #Item line in a list.
78
- #The look will be defined by the environment where it is in (itemize/ul, enumerate/ol)
79
- #
80
- #bug to_html
90
+ =begin rdoc
91
+ Item line in a list.
92
+
93
+ The look will be defined by the environment where it is in (itemize/ul, enumerate/ol)
94
+ =end
81
95
  class Item < Element
82
- Element.add( [:li, :item], Item)
83
- add_attributes( {
84
- :text => Attribute.create( [ :latex ] )
85
- }.update(HTML_ATTR_ALL)
86
- )
87
- def htmltag(); 'li'; end
96
+ add_id :li
97
+ add_attribute :text, Attribute.create( [ :latex ] )
98
+ add_attributes HTML_ATTR_ALL
99
+ add_html_tag 'li'
88
100
  def to_latex( options={} )
89
101
  cmd = ''
90
102
  cmd << "\n" if @crbefore
@@ -115,14 +127,14 @@ class Item < Element
115
127
  #- ** auf stufe 2
116
128
  #- kein * wenn als n�chstes eine Liste kommt.
117
129
  def to_wiki(options={})
118
- o = Docgenerator_logger.set_option_defaults(options)
130
+ o = set_option_defaults(options)
119
131
  o[:log].debug("enter to_latex for row") if o[:log].debug?
120
132
  cmd = ''
121
133
  #~ cmd << "\n" if @crbefore
122
- case o[:parent].class.to_s.to_sym
123
- when :Itemize
134
+ case o[:parent] #check for class to get the item type
135
+ when Docgenerator::Lists::Itemize
124
136
  cmd << "\n* #{@content.to_doc(:wiki, options)}"
125
- when :Enumerate
137
+ when Docgenerator::Lists::Enumerate
126
138
  cmd << "\n# #{@content.to_doc(:wiki, options)}"
127
139
  else
128
140
  o[:log].error(":li/wiki: Unknown list type #{o[:parent].inspect}") if o[:log].error?
@@ -132,16 +144,23 @@ class Item < Element
132
144
  cmd << "\n" if @crafter and cmd[-1,1] != "\n"
133
145
  return cmd
134
146
  end
147
+ #
148
+ alias :to_creole :to_wiki #fixme/to_doc(:wiki falsch
135
149
  end #Item
136
150
 
137
- #HTML:
138
- # <dl>
139
- # <dt> <dd>
140
- # </dl>
151
+ =begin rdoc
152
+ HTML:
153
+ <dl>
154
+ <dt> <dd>
155
+ </dl>
156
+
157
+ LaTeX:
158
+ item with optional parameter.
159
+ Should be used only inside List::Description.
160
+ =end
141
161
  class DT < Element
142
- Element.add( [:dt], DT)
143
- add_attributes( HTML_ATTR_ALL )
144
- def htmltag(); 'dt'; end
162
+ add_attributes HTML_ATTR_ALL
163
+ add_html_tag 'dt'
145
164
  def to_text(options={}); "\n#{@content.to_doc(:text, options )}: " end
146
165
  def to_wiki(options={})
147
166
  cmd = ''
@@ -158,12 +177,15 @@ class DT < Element
158
177
  return cmd
159
178
  end
160
179
  end
161
- #HTML:
162
- # <dl>
163
- # <dt> <dd>
164
- # </dl>
180
+ =begin rdoc
181
+ HTML:
182
+ <dl>
183
+ <dt> <dd>
184
+ </dl>
185
+
186
+ Data for a description list.
187
+ =end
165
188
  class DD < Element
166
- Element.add( [:dd], DD)
167
189
  add_attributes( HTML_ATTR_ALL )
168
190
  def htmltag(); 'dd'; end
169
191
  def to_text(options={}); "\n\t#{@content.to_doc(:text, options)}\n" end
@@ -182,3 +204,5 @@ class DD < Element
182
204
  return cmd
183
205
  end
184
206
  end
207
+ end #module Lists
208
+ end #module Docgenerator