docgenerator 1.2.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/build_test_and_doc.rb +505 -0
- data/examples/creole_example.rb +82 -0
- data/examples/creole_example_footnote.rb +67 -0
- data/examples/creole_example_placeholder.rb +77 -0
- data/examples/creole_example_rail.rb +154 -0
- data/examples/creole_example_rubycode.rb +144 -0
- data/examples/creole_example_struktex.rb +169 -0
- data/examples/docgenerator_example.rb +1 -1
- data/examples/docgenerator_example_footnote.rb +1 -0
- data/examples/docgenerator_example_list.rb +3 -0
- data/examples/docgenerator_example_restrictions.rb +1 -1
- data/examples/docgenerator_example_tabular.rb +1 -1
- data/examples/docgenerator_example_tripfalls.rb +2 -2
- data/examples/results/readme +2 -1
- data/examples/wiki2docgenerator_example.rb +61 -32
- data/lib/creole/creole2doc.rb +57 -58
- data/lib/creole/creole_characters.rb +56 -0
- data/lib/creole/creole_inclusion_and_plugins.rb +59 -284
- data/lib/creole/creole_inclusions.rb +142 -0
- data/lib/creole/creole_placeholder.rb +57 -23
- data/lib/creole/creole_plugins.rb +198 -0
- data/lib/creole/creole_tabular.rb +16 -8
- data/lib/creole/plugins/rail.rb +182 -0
- data/lib/creole/plugins/rubycode4creole.rb +136 -0
- data/lib/creole/plugins/struktex.rb +59 -0
- data/lib/creole/plugins/todonotes.rb +70 -0
- data/lib/docgenerator.rb +161 -71
- data/lib/docgenerator/attribute.rb +189 -156
- data/lib/docgenerator/characters.rb +824 -267
- data/lib/docgenerator/compatibility_v1.rb +249 -0
- data/lib/docgenerator/css.rb +53 -32
- data/lib/docgenerator/document.rb +119 -56
- data/lib/docgenerator/element.rb +304 -351
- data/lib/docgenerator/element_meta.rb +303 -0
- data/lib/docgenerator/elements.rb +1112 -481
- data/lib/docgenerator/environments.rb +153 -62
- data/lib/docgenerator/footnote.rb +30 -9
- data/lib/docgenerator/lists.rb +71 -47
- data/lib/docgenerator/packages/attachfile.rb +136 -0
- data/lib/{packages/docgenerator_caption.rb → docgenerator/packages/caption.rb} +28 -19
- data/lib/docgenerator/packages/hyperref.rb +194 -0
- data/lib/docgenerator/packages/listings.rb +179 -0
- data/lib/docgenerator/packages/pdfpages.rb +43 -0
- data/lib/docgenerator/packages/rubycode4doc.rb +227 -0
- data/lib/{packages/docgenerator_scrlettr2.rb → docgenerator/packages/scrlettr2.rb} +25 -16
- data/lib/docgenerator/packages/scrpage2.rb +410 -0
- data/lib/docgenerator/packages/struktex.rb +447 -0
- data/lib/docgenerator/packages/todonotes.rb +85 -0
- data/lib/{packages/docgenerator_url.rb → docgenerator/packages/url.rb} +7 -6
- data/lib/docgenerator/sections.rb +257 -83
- data/lib/docgenerator/standard.rb +19 -11
- data/lib/docgenerator/tabular.rb +234 -118
- data/lib/{templates → docgenerator/templates}/docgenerator_template.rb +52 -44
- data/lib/{templates → docgenerator/templates}/docgenerator_template.yaml +0 -0
- data/lib/{templates → docgenerator/templates}/docgenerator_template_css.rb +22 -16
- data/lib/wiki2doc/plugins/rubycode4wiki.rb +53 -0
- data/lib/wiki2doc/plugins/struktex.rb +12 -0
- data/lib/wiki2doc/wiki2docgenerator.rb +39 -38
- data/lib/wiki2doc/wikimedia_document.rb +24 -0
- data/manpage_elements.rb +10411 -0
- data/readme.rd +34 -24
- data/unittest/creole_testtext.creole +11 -0
- data/unittest/expected/test_document_usepackage_undefined.log +2 -2
- data/unittest/expected/test_runtex.stdout +0 -1
- data/unittest/expected/test_runtex_2.stdout +0 -1
- data/unittest/expected/toc_css.css +3 -2
- data/unittest/expected_creole/test_creole_characters_all.creole +28 -0
- data/unittest/expected_creole/test_creole_characters_all.html +15 -15
- data/unittest/expected_creole/test_creole_characters_all.latex +15 -15
- data/unittest/expected_creole/test_creole_footnotes_groupid.html +15 -0
- data/unittest/expected_creole/test_creole_links_file.html +2 -2
- data/unittest/expected_creole/test_creole_links_file.latex +2 -2
- data/unittest/expected_creole/test_creole_links_file.text +2 -2
- data/unittest/expected_creole/test_creole_picture_link.html +1 -1
- data/unittest/expected_creole_rail/test_rail_creole_object.tex +33 -0
- data/unittest/expected_creole_rail/test_rail_creole_placeholder.tex +40 -0
- data/unittest/expected_rubycode4doc/creole_complete.html +26 -0
- data/unittest/expected_rubycode4doc/creole_complete.tex +40 -0
- data/unittest/expected_rubycode4doc/creole_in_tab.html +4 -0
- data/unittest/expected_rubycode4doc/creole_in_tab.tex +6 -0
- data/unittest/expected_rubycode4doc/creole_inline_ruby.html +7 -0
- data/unittest/expected_rubycode4doc/creole_output.html +2 -0
- data/unittest/expected_rubycode4doc/creole_output.tex +4 -0
- data/unittest/expected_rubycode4doc/creole_rubycode.html +1 -0
- data/unittest/expected_rubycode4doc/creole_rubycode.tex +3 -0
- data/unittest/expected_rubycode4doc/creole_rubycode_evaluated.html +1 -0
- data/unittest/expected_rubycode4doc/creole_rubycode_evaluated.tex +3 -0
- data/unittest/expected_rubycode4doc/creole_rubycode_evaluated_listings.html +3 -0
- data/unittest/expected_rubycode4doc/creole_rubycode_evaluated_listings.tex +5 -0
- data/unittest/expected_rubycode4doc/wiki_1.html +8 -0
- data/unittest/expected_rubycode4doc/wiki_2.html +8 -0
- data/unittest/expected_rubycode4doc/wiki_3.html +9 -0
- data/unittest/expected_rubycode4doc/wiki_immediate_1.html +5 -0
- data/unittest/expected_rubycode4doc/wiki_immediate_2.html +5 -0
- data/unittest/expected_rubycode4doc/wiki_immediate_3.html +8 -0
- data/unittest/expected_rubycode4doc/wiki_immediate_full.html +21 -0
- data/unittest/expected_struktex/test_struktex_krug.creole +15 -0
- data/unittest/expected_struktex/test_struktex_krug.tex +19 -0
- data/unittest/expected_struktex/test_struktex_krug.wiki +15 -0
- data/unittest/expected_struktex/test_struktex_statement.creole +7 -0
- data/unittest/expected_struktex/test_struktex_statement.tex +9 -0
- data/unittest/expected_struktex/test_struktex_statement.wiki +7 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.html +1 -1
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.latex +1 -1
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.text +1 -1
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.wiki +1 -1
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote_2.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote_groupid.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_label.html +0 -0
- data/unittest/expected_wikimedia/test_wiki_link.html +8 -0
- data/unittest/expected_wikimedia/test_wiki_link.latex +17 -0
- data/unittest/expected_wikimedia/test_wiki_link.wiki +11 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.wiki +0 -0
- data/unittest/expected_wikimedia/test_wiki_picture.html +55 -0
- data/unittest/expected_wikimedia/test_wiki_picture.latex +76 -0
- data/unittest/expected_wikimedia/test_wiki_picture_thumb.html +5 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_tab1.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_tab1.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_tab1.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.wiki +0 -0
- data/unittest/{unittest_creole2doc.rb → unittest_creole.rb} +385 -476
- data/unittest/unittest_creole_placeholders.rb +272 -0
- data/unittest/unittest_creole_plugin_rail.rb +147 -0
- data/unittest/unittest_docgenerator.rb +206 -332
- data/unittest/unittest_docgenerator_characters.rb +650 -0
- data/unittest/unittest_docgenerator_runtex.rb +48 -20
- data/unittest/unittest_packages_struktex.rb +187 -0
- data/unittest/unittest_rubycode4doc.rb +275 -0
- data/unittest/unittest_wikimedia.rb +479 -0
- metadata +245 -172
- data/examples/results_expected/docgenerator_example.html +0 -39
- data/examples/results_expected/docgenerator_example.pdf +0 -0
- data/examples/results_expected/docgenerator_example.tex +0 -56
- data/examples/results_expected/docgenerator_example_footnote.html +0 -40
- data/examples/results_expected/docgenerator_example_footnote.pdf +0 -0
- data/examples/results_expected/docgenerator_example_footnote.tex +0 -50
- data/examples/results_expected/docgenerator_example_list.html +0 -18
- data/examples/results_expected/docgenerator_example_list.pdf +0 -0
- data/examples/results_expected/docgenerator_example_list.tex +0 -46
- data/examples/results_expected/docgenerator_example_restrictions.html +0 -22
- data/examples/results_expected/docgenerator_example_restrictions.pdf +0 -0
- data/examples/results_expected/docgenerator_example_restrictions.tex +0 -31
- data/examples/results_expected/docgenerator_example_tabular.html +0 -37
- data/examples/results_expected/docgenerator_example_tabular.pdf +0 -0
- data/examples/results_expected/docgenerator_example_tabular.tex +0 -41
- data/examples/results_expected/docgenerator_example_tripfalls.html +0 -27
- data/examples/results_expected/docgenerator_example_tripfalls.pdf +0 -0
- data/examples/results_expected/docgenerator_example_tripfalls.tex +0 -31
- data/lib/packages/docgenerator_attachfile.rb +0 -71
- data/lib/packages/docgenerator_hyperref.rb +0 -109
- data/lib/packages/docgenerator_listings.rb +0 -103
- data/lib/packages/docgenerator_pdfpages.rb +0 -24
- data/lib/packages/docgenerator_scrpage2.rb +0 -172
- data/self_docgenerator.rb +0 -163
- data/unittest/expected_wiki/test_wiki_link.html +0 -8
- data/unittest/expected_wiki/test_wiki_link.latex +0 -17
- data/unittest/expected_wiki/test_wiki_link.wiki +0 -11
- data/unittest/expected_wiki/test_wiki_picture.html +0 -55
- data/unittest/expected_wiki/test_wiki_picture.latex +0 -76
- data/unittest/expected_wiki/test_wiki_picture_thumb.html +0 -5
- data/unittest/test_rakefile_docgenerator.rb +0 -43
- data/unittest/unittest_versions.rb +0 -44
- data/unittest/unittest_wiki2doc.rb +0 -464
data/lib/docgenerator/tabular.rb
CHANGED
|
@@ -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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
30
|
-
Element.add( [:tabular], Tabular )
|
|
31
|
-
#~ add_attributes( HTML_ATTR_ALL )
|
|
39
|
+
add_attributes HTML_ATTR_ALL
|
|
32
40
|
#Problem: Nicht weitervererbt
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
92
|
-
|
|
97
|
+
=begin rdoc
|
|
98
|
+
Use longtable-package.
|
|
99
|
+
|
|
100
|
+
Requires
|
|
101
|
+
doc.head << element(:usepackage,{},'longtable')
|
|
102
|
+
=end
|
|
93
103
|
class Longtable < Tabular
|
|
94
|
-
|
|
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 =
|
|
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
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
|
130
|
+
add_attributes Tabular.get_attribute_list( )
|
|
121
131
|
def to_latex(options={})
|
|
122
|
-
o =
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
class Row < Element
|
|
152
|
+
=begin rdoc
|
|
153
|
+
May only be used insode a tabular. Tabular must set the columns-value.
|
|
145
154
|
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
235
|
+
@log.warn("Add row to tabular with undefined columns number (#{row.inspect})" ) if @log.warn?
|
|
225
236
|
elsif @content.size > @columns
|
|
226
|
-
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
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 =
|
|
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
|
-
|
|
467
|
+
=begin rdoc
|
|
468
|
+
Header cell (only for HTML)
|
|
469
|
+
=end
|
|
372
470
|
class Column_th < Column
|
|
373
|
-
|
|
374
|
-
|
|
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
|
-
|
|
380
|
-
|
|
381
|
-
|
|
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 =
|
|
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
|
-
|
|
404
|
-
|
|
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
|