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
@@ -3,6 +3,12 @@
3
3
  Definition of tabular elements for DocGenerator.rb
4
4
  =end
5
5
 
6
+ #
7
+ module Docgenerator
8
+ =begin rdoc
9
+ Definition of tabular elements for DocGenerator.rb
10
+ =end
11
+ module Tables
6
12
  #~ if __FILE__ == $0
7
13
  #~ require 'DocGenerator'
8
14
  #~ end
@@ -12,38 +18,38 @@ TEX_PACKAGE_TABULARX = element(:usepackage,{},'tabularx').cr
12
18
  TEX_PACKAGE_LONGTABLE= element(:usepackage,{},'longtable').cr
13
19
  TEX_PACKAGE_BOOKTABS = element(:usepackage,{},'booktabs').cr
14
20
 
15
- class Table < Environment
16
- add_attributes( HTML_ATTR_ALL )
17
- Element.add( [:table ], Table)
18
- def htmltag(); 'div'; end
21
+ =begin rdoc
22
+ Environment Table
23
+ =end
24
+ class Table < Environments::Environment
25
+ add_attributes HTML_ATTR_ALL
26
+ add_html_tag 'div'
19
27
  def to_latex( options={} )
20
28
  return to_latex_environment( 'table', nil, options )
21
29
  end
22
30
  end
31
+ =begin rdoc
32
+ Tabulars
23
33
 
24
- #Tabulars
25
- #fixme: check on attributes. columnsdescription
26
- #~ :table=> {:border=>nil, :width=>nil, :cellpadding=>nil, :cellspacing=>nil},#complete it
27
- #~ :colgroup => {}, #comlpete it
34
+ fixme: check on attributes. columnsdescription
35
+ ~ :table=> {:border=>nil, :width=>nil, :cellpadding=>nil, :cellspacing=>nil},#complete it
36
+ ~ :colgroup => {}, #comlpete it
37
+ =end
28
38
  class Tabular < Element
29
- #Make the key known to the complete key-list of elements.
30
- Element.add( [:tabular], Tabular )
31
- #~ add_attributes( HTML_ATTR_ALL )
39
+ add_attributes HTML_ATTR_ALL
32
40
  #Problem: Nicht weitervererbt
33
- add_attributes( {
34
- :columndescription => Attribute.create( [:latex, :required ] ) ,
35
- :columns => Attribute.create( [:required], [ Fixnum ] ) ,
36
- :border => Attribute.create( [:html] ) ,
37
- :bgcolor => Attribute.create( [ :html ] ),
38
- :width => Attribute.create( [ :html ], [ Integer, String ] ), #String necessary for percentage
39
- :frame => Attribute.create( [ :html ], [ 'box', 'above', 'below', 'hsides', 'vsides', 'lhs', 'rhs' ] ),
40
- :rules => Attribute.create( [ :html ], [ 'none', 'rows', 'cols', 'groups', 'all' ] ),
41
- :height => Attribute.create( [ :html ], [ Integer ] ),
42
- :cellspacing => Attribute.create( [ :html ], [ Integer ] ),
43
- :cellpadding => Attribute.create( [ :html ], [ Integer ] ),
44
- :summary => Attribute.create( [:html] ) ,
45
- :align => HTML_ATTR_ALIGN,
46
- }.update( HTML_ATTR_ALL ) )
41
+ add_attribute :columndescription , Attribute.create( [:latex, :required ] )
42
+ add_attribute :columns , Attribute.create( [:required], [ Fixnum ] )
43
+ add_attribute :border , Attribute.create( [:html] )
44
+ add_attribute :bgcolor , Attribute.create( [ :html ] )
45
+ add_attribute :width , Attribute.create( [ :html ], [ Integer, String ] ) #String necessary for percentage
46
+ add_attribute :frame , Attribute.create( [ :html ], [ 'box', 'above', 'below', 'hsides', 'vsides', 'lhs', 'rhs' ] )
47
+ add_attribute :rules , Attribute.create( [ :html ], [ 'none', 'rows', 'cols', 'groups', 'all' ] )
48
+ add_attribute :height , Attribute.create( [ :html ], [ Integer ] )
49
+ add_attribute :cellspacing , Attribute.create( [ :html ], [ Integer ] )
50
+ add_attribute :cellpadding , Attribute.create( [ :html ], [ Integer ] )
51
+ add_attribute :summary , Attribute.create( [:html] )
52
+ add_attribute :align , HTML_ATTR_ALIGN
47
53
  #Only rows are allowed to be added.
48
54
  #The row get the number of columns.
49
55
  #The row counting does not word, when the row-content is added immediate in element-initialization.
@@ -58,7 +64,7 @@ class Tabular < Element
58
64
  end
59
65
  }
60
66
  if ! allowed
61
- puts "Add non-row to tabular (#{row.class})"
67
+ @log.warn("Add non-row to tabular (#{row.class})") if @log.warn?
62
68
  end
63
69
  if row.is_a?( Row )
64
70
  row.columns = @attr[:columns].to_s.to_i
@@ -66,7 +72,7 @@ class Tabular < Element
66
72
  @content << row
67
73
  end
68
74
  def to_latex(options={})
69
- o = Docgenerator_logger.set_option_defaults(options)
75
+ o = set_option_defaults(options)
70
76
  o[:log].debug("enter to_latex for tabular") if o[:log].debug?
71
77
  cmd = ''
72
78
  cmd << "\n" if @crbefore
@@ -88,15 +94,16 @@ class Tabular < Element
88
94
  return "<Class Element(tabular) columns=#{@attr[:columns]}>"
89
95
  end
90
96
  end
91
- #Requires
92
- # doc.head << element(:usepackage,{},'longtable')
97
+ =begin rdoc
98
+ Use longtable-package.
99
+
100
+ Requires
101
+ doc.head << element(:usepackage,{},'longtable')
102
+ =end
93
103
  class Longtable < Tabular
94
- #Make the key known to the complete key-list of elements.
95
- Element.add( [:longtable], Longtable )
96
- #
97
- add_attributes( Element.get_attribute_list( Tabular ) )
104
+ add_attributes Tabular.get_attribute_list( )
98
105
  def to_latex(options={})
99
- o = Docgenerator_logger.set_option_defaults(options)
106
+ o = set_option_defaults(options)
100
107
  o[:log].debug("enter to_latex for longtable") if o[:log].debug?
101
108
  cmd = ''
102
109
  cmd << "\n" if @crbefore
@@ -110,16 +117,19 @@ class Longtable < Tabular
110
117
  return cmd
111
118
  end
112
119
  end
113
- #Requires
114
- # doc.head << element(:usepackage,{},'longtable')
115
- #fixme :width is obligatory
120
+ =begin rdoc
121
+ Use Tabularx-package.
122
+
123
+ Requires
124
+ doc.head << element(:usepackage,{},'longtable')
125
+
126
+ fixme :width is obligatory
127
+ =end
116
128
  class Tabularx < Tabular
117
- #Make the key known to the complete key-list of elements.
118
- Element.add( [:tabularx], Tabularx )
119
129
  #
120
- add_attributes( Element.get_attribute_list( Tabular ) )
130
+ add_attributes Tabular.get_attribute_list( )
121
131
  def to_latex(options={})
122
- o = Docgenerator_logger.set_option_defaults(options)
132
+ o = set_option_defaults(options)
123
133
  o[:log].debug("enter to_latex for tabularx") if o[:log].debug?
124
134
  if @attr[:width].content.to_s == ''
125
135
  o[:log].error( "Tabularx: Empty width, set it to \\textwidth" ) if o[:log].error?
@@ -139,12 +149,13 @@ class Tabularx < Tabular
139
149
  return cmd
140
150
  end
141
151
  end
142
- #May only be used insode a tabular. Tabular must set the columns-value.
143
- #If not, zero columns is expected and an error is thrown.
144
- class Row < Element
152
+ =begin rdoc
153
+ May only be used insode a tabular. Tabular must set the columns-value.
145
154
 
146
- #Make the key known to the complete key-list of elements.
147
- Element.add( [:row, :tr], Row )
155
+ If not, zero columns is expected and an error is thrown.
156
+ =end
157
+ class Row < Element
158
+ add_id :tr
148
159
  #~ :tr => {:align=>align},#complete it
149
160
  add_attributes( {
150
161
  :add_vspace => Attribute.create( [:latex] ) ,
@@ -176,7 +187,7 @@ class Row < Element
176
187
  def cline( val )
177
188
  @cline = [] if ! defined?( @cline )
178
189
  if ! ( /\A\d+-\d+\z/ =~ val )
179
- puts "\\cline with wrong parameter: #{val.inspect}"
190
+ @log.warn("\\cline with wrong parameter: #{val.inspect}") if @log.warn?
180
191
  end
181
192
  @cline << val
182
193
  return self
@@ -188,7 +199,7 @@ class Row < Element
188
199
  def cmidrule( val )
189
200
  @cmidrule = [] if ! defined?( @cmidrule )
190
201
  if ! ( /\A\d+-\d+\z/ =~ val )
191
- puts "\\cmidrule with wrong parameter: #{val.inspect}"
202
+ @log.warn("\\cmidrule with wrong parameter: #{val.inspect}") if @log.warn?
192
203
  end
193
204
  @cmidrule << val
194
205
  return self
@@ -216,22 +227,23 @@ class Row < Element
216
227
  end
217
228
  }
218
229
  if ! allowed
219
- puts "Add non-column to tabular (#{row.class})"
230
+ @log.warn("Add non-column to tabular (#{row.class})") if @log.warn?
220
231
  end
221
232
  @content << row
222
233
  #Does not work with multicolumns.
223
234
  if !@columns
224
- puts "Add row to tabular with undefined columns number (#{row.inspect})"
235
+ @log.warn("Add row to tabular with undefined columns number (#{row.inspect})" ) if @log.warn?
225
236
  elsif @content.size > @columns
226
- puts "Tabular with #{@columns} columns get #{@content.size} columns"
237
+ @log.warn("Tabular with #{@columns} columns get #{@content.size} columns" ) if @log.warn?
227
238
  end
228
239
  end
240
+
229
241
  def inspect()
230
- return "<Class Row columns=#{@content.size}>"
242
+ return "<Class Row columns=#{@content.size}#{inspect_creation_caller}>"
231
243
  end
232
244
  #Each cell is separated by '&'.
233
245
  def to_latex(options={})
234
- o = Docgenerator_logger.set_option_defaults(options)
246
+ o = set_option_defaults(options)
235
247
  o[:log].debug("enter to_latex for row") if o[:log].debug?
236
248
  cmd = ''
237
249
  cmd << "\n" if @crbefore
@@ -263,7 +275,7 @@ class Row < Element
263
275
  return 'tr'
264
276
  end
265
277
  def to_html(options={})
266
- o = Docgenerator_logger.set_option_defaults(options)
278
+ o = set_option_defaults(options)
267
279
  o[:log].debug("enter to_html for row") if o[:log].debug?
268
280
  cmd = ''
269
281
  cmd << "\n" if @crbefore
@@ -302,55 +314,139 @@ class Row < Element
302
314
  def to_wiki(options={}); return "\n|-\n#{@content.to_wiki(options).strip}"; end
303
315
  end #Row
304
316
 
305
- Element.create( [:hline ], {},false,
306
- { :htmltag => nil,
307
- :latex => '\hline '
308
- } )
309
- Element.create( [:toprule ], {},false,
310
- { :htmltag => nil,
311
- :latex => '\toprule'
312
- } )
313
- Element.create( [:midrule ], {},false,
314
- { :htmltag => nil,
315
- :latex => '\midrule'
316
- } )
317
- Element.create( [:bottomrule ], {},false,
318
- { :htmltag => nil,
319
- :latex => '\bottomrule'
320
- } )
321
- Element.create( [:endfirsthead ], {},false,
322
- { :htmltag => nil,
323
- :latex => '\endfirsthead '
324
- } )
325
- Element.create( [:endhead ], {},false,
326
- { :htmltag => nil,
327
- :latex => '\endhead '
328
- } )
329
- Element.create( [:endfoot ], {},false,
330
- { :htmltag => nil,
331
- :latex => '\endfoot'
332
- } )
333
- Element.create( [:endlastfoot ], {},false,
334
- { :htmltag => nil,
335
- :latex => '\endlastfoot'
336
- } )
337
- #~ @cline.each{|cline| cmd << "\\cline{#{cline}}" } if @cline
317
+ =begin rdoc
318
+ Define Element :hline
319
+
320
+ Create an instance with
321
+ element( :hline, [ attributes, [content]] )
322
+ or
323
+ Hline.new( [ attributes, [content]] )
324
+ Attributes are not defined for this element.
325
+ =end
326
+ class Hline < Element
327
+ has_no_content false
328
+ add_latex_output '\hline '
329
+ end #Hline
330
+
331
+ =begin rdoc
332
+ Define Element :toprule
333
+
334
+ Create an instance with
335
+ element( :toprule, [ attributes, [content]] )
336
+ or
337
+ Toprule.new( [ attributes, [content]] )
338
+ Attributes are not defined for this element.
339
+ =end
340
+ class Toprule < Element
341
+ has_no_content false
342
+ add_latex_output '\toprule'
343
+ end #Toprule
344
+
345
+ =begin rdoc
346
+ Define Element :midrule
347
+
348
+ Create an instance with
349
+ element( :midrule, [ attributes, [content]] )
350
+ or
351
+ Midrule.new( [ attributes, [content]] )
352
+ Attributes are not defined for this element.
353
+ =end
354
+ class Midrule < Element
355
+ has_no_content false
356
+ add_latex_output '\midrule '
357
+ end #Midrule
358
+
359
+ =begin rdoc
360
+ Define Element :bottomrule
361
+
362
+ Create an instance with
363
+ element( :bottomrule, [ attributes, [content]] )
364
+ or
365
+ Bottomrule.new( [ attributes, [content]] )
366
+ Attributes are not defined for this element.
367
+ =end
368
+ class Bottomrule < Element
369
+ has_no_content false
370
+ add_latex_output '\bottomrule '
371
+ end #Bottomrule
372
+
373
+ =begin rdoc
374
+ Define Element :endfirsthead
375
+
376
+ Create an instance with
377
+ element( :endfirsthead, [ attributes, [content]] )
378
+ or
379
+ Endfirsthead.new( [ attributes, [content]] )
380
+ Attributes are not defined for this element.
381
+ =end
382
+ class Endfirsthead < Element
383
+ has_no_content false
384
+ add_latex_output '\endfirsthead '
385
+ end #Endfirsthead
386
+
387
+ =begin rdoc
388
+ Define Element :endhead
389
+
390
+ Create an instance with
391
+ element( :endhead, [ attributes, [content]] )
392
+ or
393
+ Endhead.new( [ attributes, [content]] )
394
+ Attributes are not defined for this element.
395
+ =end
396
+ class Endhead < Element
397
+ has_no_content false
398
+ add_latex_output '\endhead '
399
+ end #Endhead
338
400
 
401
+ =begin rdoc
402
+ Define Element :endfoot
339
403
 
340
- #One column in a tabular.
404
+ Create an instance with
405
+ element( :endfoot, [ attributes, [content]] )
406
+ or
407
+ Endfoot.new( [ attributes, [content]] )
408
+ Attributes are not defined for this element.
409
+ =end
410
+ class Endfoot < Element
411
+ has_no_content false
412
+ add_html_tag nil
413
+ add_latex_output '\endfoot '
414
+
415
+ end #Endfoot
416
+
417
+ =begin rdoc
418
+ Define Element :endlastfoot
419
+
420
+ Create an instance with
421
+ element( :endlastfoot, [ attributes, [content]] )
422
+ or
423
+ Endlastfoot.new( [ attributes, [content]] )
424
+ Attributes are not defined for this element.
425
+ =end
426
+ class Endlastfoot < Element
427
+ has_no_content false
428
+ add_html_tag nil
429
+ add_latex_output '\endlastfoot '
430
+ end #Endlastfoot
431
+
432
+ =begin rdoc
433
+ A column in a tabular.
434
+ =end
341
435
  class Column < Element
342
- #Make the key known to the complete key-list of elements.
436
+ has_no_content :empty_ok
437
+
438
+ add_id :col
439
+ add_id :td
440
+ add_attributes HTML_ATTR_ALL
441
+
343
442
  #~ :th => {:colspan => nil, :rowspan => nil, :align=>align, :valign=>valign, :border=>nil, :width=>nil},#complete it
344
- Element.add( [:col, :column, :td ], Column )
345
- add_attributes( HTML_ATTR_ALL )
346
- add_attributes( {
347
- :width => Attribute.create( [ :html ] ),
348
- :height => Attribute.create( [ :html ] ),
349
- :align => HTML_ATTR_ALIGN,
350
- :bgcolor => Attribute.create( [ :html ] ),
351
- } )
443
+ add_attribute :width , Attribute.create( [ :html ] )
444
+ add_attribute :height , Attribute.create( [ :html ] )
445
+ add_attribute :align , HTML_ATTR_ALIGN
446
+ add_attribute :bgcolor , Attribute.create( [ :html ] )
447
+
352
448
  def to_latex(options={})
353
- o = Docgenerator_logger.set_option_defaults(options)
449
+ o = set_option_defaults(options)
354
450
  o[:log].debug("enter to_latex for column") if o[:log].debug?
355
451
  cmd = ''
356
452
  cmd << "\n" if @crbefore
@@ -368,17 +464,20 @@ class Column < Element
368
464
  return "<Class Column @content=#{@content.inspect}>"
369
465
  end
370
466
  end #Columns
371
- #Header cell (only for HTML
467
+ =begin rdoc
468
+ Header cell (only for HTML)
469
+ =end
372
470
  class Column_th < Column
373
- Element.add( [:th ], Column_th )
374
- def htmltag()
375
- return 'th'
376
- end
471
+ add_id :th
472
+ add_html_tag 'th'
377
473
  end
474
+ =begin rdoc
475
+ Multicolumn
476
+ =end
378
477
  class Multicolumn < Column
379
- #Make the key known to the complete key-list of elements.
380
- Element.add( [:multicolumn], Multicolumn )
381
- #~ add_attributes( HTML_ATTR_ALL )
478
+ has_no_content :empty_ok
479
+
480
+ #~ add_attributes( HTML_ATTR_ALL )
382
481
  add_attributes( {
383
482
  #~ :columns => Attribute.create( [:required], [ Fixnum ] ) , #colspan
384
483
  :colspan => Attribute.create( [:required, :html, :latex], [ Fixnum ], 2 ) ,
@@ -390,7 +489,7 @@ class Multicolumn < Column
390
489
  :height => Attribute.create( [ :html ] ),
391
490
  }.update( HTML_ATTR_ALL ) )
392
491
  def to_latex(options={})
393
- o = Docgenerator_logger.set_option_defaults(options)
492
+ o = set_option_defaults(options)
394
493
  o[:log].debug("enter to_latex for multicolumn") if o[:log].debug?
395
494
  cmd = ''
396
495
  cmd << "\n" if @crbefore
@@ -398,20 +497,37 @@ class Multicolumn < Column
398
497
  cmd << "\n" if @crafter
399
498
  return cmd
400
499
  end
500
+ #add_html_output -> like Column, :colspan is obligatory
401
501
  def to_text(options={}); return "#{@content.to_text(options).strip}\n"; end
402
502
  def to_wiki(options={}); return "|columns=#{@attr[:colspan]}|pos=#{@attr[:pos]}||#{@content.to_wiki(options).strip}\n"; end
403
- #~ def htmltag()
404
- #~ return 'td'
405
- #~ end
406
- #~ def to_html()
407
- #~ cmd = ''
408
- #~ cmd += "\n" if @crbefore
409
- #~ cmd += "<td colspan=\"#{@attr[:columns]}\">"
410
- #~ cmd += "#{@content}</td>"
411
- #~ cmd += "\n" if @crafter
412
- #~ return cmd
413
- #~ end
503
+
504
+ #
414
505
  def inspect()
415
506
  return "<Class Multicolumn @content=#{@content.inspect}>"
416
507
  end
417
508
  end
509
+
510
+ class Caption < Element
511
+ #
512
+ add_attribute :optional, Attribute.create( [ :latex ] )
513
+
514
+ def to_latex(options= {})
515
+ cmd = ''
516
+ cmd << "\n" if @crbefore
517
+ cmd << "\\caption"
518
+ if @attr[:optional].content != []
519
+ cmd << "["
520
+ cmd << @attr[:optional].content.to_s
521
+ cmd << "]"
522
+ cmd << "\n\t" if @crmid
523
+ end
524
+ cmd << "{"
525
+ cmd << @content.to_s
526
+ cmd << "}"
527
+ cmd << "\n" if @crafter
528
+ return cmd
529
+ end
530
+ end
531
+
532
+ end #module Tab
533
+ end #module Docgenerator