docgenerator 2.1.0 → 2.1.1
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.
- checksums.yaml +7 -0
- data/examples/creole_example.rb +0 -1
- data/examples/creole_example_new_plugin.rb +51 -0
- data/examples/creole_example_tabular.rb +3 -1
- data/examples/wiki2docgenerator_example.rb +2 -2
- data/lib/creole/creole2doc.rb +697 -680
- data/lib/creole/creole_characters.rb +90 -26
- data/lib/creole/creole_inclusion_and_plugins.rb +25 -43
- data/lib/creole/creole_inclusions.rb +87 -75
- data/lib/creole/creole_placeholder.rb +87 -89
- data/lib/creole/creole_plugins.rb +149 -117
- data/lib/creole/creole_tabular.rb +247 -141
- data/lib/creole/plugins/todonotes.rb +48 -48
- data/lib/docgenerator/characters.rb +106 -8
- data/lib/docgenerator/compatibility_v1.rb +7 -1
- data/lib/docgenerator/document.rb +34 -19
- data/lib/docgenerator/element.rb +1 -0
- data/lib/docgenerator/element_meta.rb +1 -1
- data/lib/docgenerator/elements.rb +594 -535
- data/lib/docgenerator/environments.rb +131 -99
- data/lib/docgenerator/index.rb +110 -0
- data/lib/docgenerator/lists.rb +2 -1
- data/lib/docgenerator/packages/caption.rb +32 -34
- data/lib/docgenerator/packages/hyperref.rb +1 -0
- data/lib/docgenerator/packages/multicol.rb +3 -2
- data/lib/docgenerator/packages/pdfpages.rb +71 -20
- data/lib/docgenerator/packages/scrpage2.rb +99 -142
- data/lib/docgenerator/packages/url.rb +75 -81
- data/lib/docgenerator/sections.rb +98 -98
- data/lib/docgenerator/standard.rb +8 -1
- data/lib/docgenerator/tabular.rb +44 -25
- data/lib/docgenerator/templates/docgenerator_template.yaml +28 -0
- data/lib/docgenerator/version.rb +146 -0
- data/lib/docgenerator.rb +20 -15
- data/meta_test_and_doc/build_doc.rb +39 -10
- data/meta_test_and_doc/build_test.rb +34 -12
- data/meta_test_and_doc/manpages/characters.rb +452 -20
- data/meta_test_and_doc/manpages/elementlist.rb +304 -0
- data/meta_test_and_doc/manpages/elements.rb +305 -42
- data/meta_test_and_doc/manpages/others.rb +403 -0
- data/meta_test_and_doc/manpages/pdfpages.rb +117 -18
- data/meta_test_and_doc/manpages/readme.rdoc +3 -1
- data/meta_test_and_doc/manpages/scrpage2.rb +0 -80
- data/meta_test_and_doc/manpages/tables.rb +6 -6
- data/readme.rdoc +11 -120
- data/unittest/expected/test_comment.html +1 -0
- data/unittest/expected/test_comment.latex +5 -0
- data/unittest/expected/test_comment_complex.html +3 -0
- data/unittest/expected/test_comment_complex.latex +15 -0
- data/unittest/expected_creole/test_creole_characters_all.html +6 -5
- data/unittest/expected_creole/test_creole_characters_all.latex +10 -8
- data/unittest/expected_creole/test_creole_creole1.0test.latex +5 -5
- data/unittest/expected_creole/test_creole_input.normsource +11 -9
- data/unittest/expected_creole/test_creole_list_ul.normsource +57 -51
- data/unittest/expected_creole/test_creole_list_ulul_without_ul.html +6 -0
- data/unittest/expected_creole/test_creole_list_ulul_without_ul.latex +12 -0
- data/unittest/expected_creole/test_creole_paragraphs.normsource +12 -10
- data/unittest/expected_creole/test_creole_pictures.latex +2 -2
- data/unittest/expected_creole/test_creole_pictures_css.latex +2 -2
- data/unittest/expected_creole/test_creole_pictures_imgclass.latex +2 -2
- data/unittest/expected_creole/test_creole_pictures_width.latex +1 -1
- data/unittest/expected_creole/test_creole_tabular.latex +3 -3
- data/unittest/expected_creole/test_creole_tabular_creole.latex +2 -2
- data/unittest/expected_creole/test_creole_tabular_css.latex +3 -3
- data/unittest/expected_creole/test_creole_tabular_row_parameters.latex +22 -0
- data/unittest/expected_templates/test_standalone.tex +34 -0
- data/unittest/expected_wikimedia/test_wiki_picture.latex +12 -12
- data/unittest/unittest_creole.rb +22 -3
- data/unittest/unittest_creole_tabular.rb +34 -1
- data/unittest/unittest_docgenerator.rb +46 -3
- data/unittest/unittest_docgenerator_characters.rb +527 -82
- data/unittest/unittest_templates.rb +1 -1
- metadata +149 -108
@@ -33,7 +33,7 @@ Define of
|
|
33
33
|
* h1...h6
|
34
34
|
|
35
35
|
=end
|
36
|
-
module Sectioning
|
36
|
+
module Sectioning
|
37
37
|
|
38
38
|
=begin rdoc
|
39
39
|
Define Element :sectioning
|
@@ -47,68 +47,68 @@ Attributes may be:
|
|
47
47
|
* HTML_ATTR_EVENTS
|
48
48
|
* :lang, ATTR_LANG
|
49
49
|
=end
|
50
|
-
class DummySectioning < Element
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
50
|
+
class DummySectioning < Element
|
51
|
+
class << self
|
52
|
+
def inherited(subclass)
|
53
|
+
Element.inherited(subclass)
|
54
|
+
subclass.class_eval(<<-attr
|
55
|
+
add_attributes HTML_ATTR_CORE
|
56
|
+
add_attributes HTML_ATTR_I18N
|
57
|
+
add_attributes HTML_ATTR_EVENTS
|
58
|
+
add_attribute :lang, ATTR_LANG
|
59
|
+
add_attribute :short, Attribute.create( [ :latex ] )
|
60
|
+
attr
|
61
|
+
)
|
62
|
+
end
|
63
63
|
=begin rdoc
|
64
64
|
Define the number of '=' for this section-command in wiki syntax.
|
65
65
|
=end
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
66
|
+
def set_wikilevel( level )
|
67
|
+
class_eval( "def wikilevel(); '#{'=' * level}'; end")
|
68
|
+
end
|
69
|
+
end #class << self
|
70
70
|
=begin rdoc
|
71
71
|
Default marup for title for wikis.
|
72
72
|
|
73
73
|
Is redefined by set_wikilevel( level )
|
74
74
|
=end
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
75
|
+
def wikilevel(); ''; end
|
76
|
+
|
77
|
+
#Small helper to make TeX-Hyperlinks like in HTML (attribute id)
|
78
|
+
def hypertarget(id)
|
79
|
+
return "\\hypertarget{#{id}}{}" if id.is_a?(String)
|
80
|
+
#~ return '' if ! id.content or id.content.to_s =~/\A\s*\Z/
|
81
|
+
return '' if ! id.content or id.content.join =~/\A\s*\Z/ #Ruby 1.9
|
82
|
+
return "\\hypertarget{#{id}}{}"
|
83
|
+
end
|
84
84
|
=begin rdoc
|
85
85
|
Determine the TeX-Makroname from class name
|
86
86
|
=end
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
end #Sectioning
|
87
|
+
def texmakro()
|
88
|
+
self.class.name.split('::').last.downcase
|
89
|
+
end
|
90
|
+
|
91
|
+
add_latex_output '#{linebreak(@crbefore)}' + '\\#{texmakro}' +
|
92
|
+
'#{texoptional(:short)}' +
|
93
|
+
'{#{@content}}' +
|
94
|
+
'#{hypertarget(@attr[:id])}' +
|
95
|
+
'#{linebreak(@crafter)}'
|
96
|
+
|
97
|
+
add_context_output '#{linebreak(@crbefore)}' + '\\#{texmakro}' +
|
98
|
+
'#{texoptional(:short)}' +
|
99
|
+
'{#{@content}}' +
|
100
|
+
'#{hypertarget(@attr[:id])}' +
|
101
|
+
'#{linebreak(@crafter)}'
|
102
|
+
|
103
|
+
#'underlined' title
|
104
|
+
add_text_output "\n" + '#{linebreak(@crbefore)}#{@content}' + "\n" +
|
105
|
+
'#{wikilevel.gsub(/=/,\' \')}' +
|
106
|
+
'-' * 30 + "\n" + '#{linebreak(@crafter)}'
|
107
|
+
|
108
|
+
add_wiki_output '#{linebreak(@crbefore)}' + "\n" + '#{wikilevel}' + '#{@content}' + '#{wikilevel}' + "\n" + '#{linebreak(@crafter)}'
|
109
|
+
|
110
|
+
add_creole_output '#{linebreak(@crbefore)}' + "\n" + '#{wikilevel}' + '#{@content}' + "\n" + '#{linebreak(@crafter)}'
|
111
|
+
end #Sectioning
|
112
112
|
|
113
113
|
|
114
114
|
=begin rdoc
|
@@ -121,9 +121,9 @@ or
|
|
121
121
|
|
122
122
|
Attributes see class DummySectioning.
|
123
123
|
=end
|
124
|
-
class Part < DummySectioning
|
125
|
-
|
126
|
-
end #Part
|
124
|
+
class Part < DummySectioning
|
125
|
+
#~ add_html_tag ''
|
126
|
+
end #Part
|
127
127
|
|
128
128
|
=begin rdoc
|
129
129
|
Define Element :chapter
|
@@ -135,10 +135,10 @@ or
|
|
135
135
|
|
136
136
|
Attributes see class DummySectioning.
|
137
137
|
=end
|
138
|
-
class Chapter < DummySectioning
|
139
|
-
|
140
|
-
|
141
|
-
end #Chapter
|
138
|
+
class Chapter < DummySectioning
|
139
|
+
set_wikilevel 1
|
140
|
+
#~ add_html_tag ''
|
141
|
+
end #Chapter
|
142
142
|
|
143
143
|
=begin rdoc
|
144
144
|
Define Element :h1, :section
|
@@ -151,11 +151,11 @@ or
|
|
151
151
|
|
152
152
|
Attributes see class DummySectioning.
|
153
153
|
=end
|
154
|
-
class Section < DummySectioning
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
end #H1
|
154
|
+
class Section < DummySectioning
|
155
|
+
set_wikilevel 2
|
156
|
+
add_id :h1
|
157
|
+
add_html_tag 'h1'
|
158
|
+
end #H1
|
159
159
|
|
160
160
|
=begin rdoc
|
161
161
|
Define Element :h2, :subsection
|
@@ -168,11 +168,11 @@ or
|
|
168
168
|
|
169
169
|
Attributes see class DummySectioning.
|
170
170
|
=end
|
171
|
-
class Subsection < DummySectioning
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
end #H2
|
171
|
+
class Subsection < DummySectioning
|
172
|
+
set_wikilevel 3
|
173
|
+
add_id :h2
|
174
|
+
add_html_tag 'h2'
|
175
|
+
end #H2
|
176
176
|
|
177
177
|
=begin rdoc
|
178
178
|
Define Element :h3, :subsubsection
|
@@ -186,11 +186,11 @@ Attributes may be:
|
|
186
186
|
|
187
187
|
Attributes see class DummySectioning.
|
188
188
|
=end
|
189
|
-
class Subsubsection < DummySectioning
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
end #H3
|
189
|
+
class Subsubsection < DummySectioning
|
190
|
+
set_wikilevel 4
|
191
|
+
add_id :h3
|
192
|
+
add_html_tag 'h3'
|
193
|
+
end #H3
|
194
194
|
|
195
195
|
=begin rdoc
|
196
196
|
Define Element :h4, :paragraph
|
@@ -203,11 +203,11 @@ or
|
|
203
203
|
|
204
204
|
Attributes see class DummySectioning.
|
205
205
|
=end
|
206
|
-
class Paragraph < DummySectioning
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
end #H4
|
206
|
+
class Paragraph < DummySectioning
|
207
|
+
set_wikilevel 5
|
208
|
+
add_id :h4
|
209
|
+
add_html_tag 'h4'
|
210
|
+
end #H4
|
211
211
|
|
212
212
|
|
213
213
|
=begin rdoc
|
@@ -221,11 +221,11 @@ or
|
|
221
221
|
|
222
222
|
Attributes see class DummySectioning.
|
223
223
|
=end
|
224
|
-
class Subparagraph < DummySectioning
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
end #H5
|
224
|
+
class Subparagraph < DummySectioning
|
225
|
+
set_wikilevel 6
|
226
|
+
add_id :h5
|
227
|
+
add_html_tag 'h5'
|
228
|
+
end #H5
|
229
229
|
|
230
230
|
=begin rdoc
|
231
231
|
Define Element :h6, :minisec
|
@@ -238,11 +238,11 @@ or
|
|
238
238
|
|
239
239
|
Attributes see class DummySectioning.
|
240
240
|
=end
|
241
|
-
class Minisec < DummySectioning
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
end #H6
|
241
|
+
class Minisec < DummySectioning
|
242
|
+
set_wikilevel 7
|
243
|
+
add_id :h6
|
244
|
+
add_html_tag 'h6'
|
245
|
+
end #H6
|
246
246
|
|
247
247
|
|
248
248
|
=begin rdoc
|
@@ -258,13 +258,13 @@ or
|
|
258
258
|
Attributes may be:
|
259
259
|
* HTML_ATTR_ALL
|
260
260
|
=end
|
261
|
-
class Addsec < Element
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
end #Addsec
|
269
|
-
end #module Sectioning
|
261
|
+
class Addsec < Element
|
262
|
+
add_attributes HTML_ATTR_CORE
|
263
|
+
add_attributes HTML_ATTR_I18N
|
264
|
+
add_attributes HTML_ATTR_EVENTS
|
265
|
+
add_attribute :lang, ATTR_LANG
|
266
|
+
add_html_tag 'h2'
|
267
|
+
add_latex_output '#{linebreak(@crbefore)}' + '\addsec{#{@content}}' + '#{linebreak(@crafter)}'
|
268
|
+
end #Addsec
|
269
|
+
end #module Sectioning
|
270
270
|
end #module Docgenerator
|
@@ -51,11 +51,17 @@ will be redefined for Docgenerator::Element
|
|
51
51
|
end
|
52
52
|
self.respond_to?(:to_str) ? self.to_str : self.to_s
|
53
53
|
end
|
54
|
+
#Extend each object with #to_text
|
54
55
|
def to_text(options = {}); to_doc(:text, options); end
|
56
|
+
#Extend each object with #to_latex
|
55
57
|
def to_latex(options = {}); to_doc(:latex, options); end
|
58
|
+
#Extend each object with #to_context
|
56
59
|
def to_context(options = {}); to_doc(:context, options); end
|
60
|
+
#Extend each object with #to_html
|
57
61
|
def to_html(options = {}); to_doc(:html, options); end
|
62
|
+
#Extend each object with #to_wiki
|
58
63
|
def to_wiki(options = {}); to_doc(:wiki, options); end
|
64
|
+
#Extend each object with #to_creole
|
59
65
|
def to_creole(options = {}); to_doc(:creole, options); end
|
60
66
|
end
|
61
67
|
|
@@ -64,7 +70,7 @@ Recursive to_doc for each elements in the array.
|
|
64
70
|
=end
|
65
71
|
class Array
|
66
72
|
=begin rdoc
|
67
|
-
Returns the element for each
|
73
|
+
Returns the element for each element in the list.
|
68
74
|
=end
|
69
75
|
def to_doc(target, options = {})
|
70
76
|
o = Docgenerator.set_option_defaults(options)
|
@@ -77,6 +83,7 @@ Returns the element for each parameter
|
|
77
83
|
o[:log].fatal("ArgumentError to_doc for element <#{el.class}>") if o[:log].fatal?
|
78
84
|
res = el.to_doc(target)
|
79
85
|
end
|
86
|
+
|
80
87
|
#Add text. If necessary, convert the encoding.
|
81
88
|
begin
|
82
89
|
str << res
|
data/lib/docgenerator/tabular.rb
CHANGED
@@ -15,7 +15,9 @@ Definition of tabular elements for docgenerator-gem.
|
|
15
15
|
TEX_PACKAGE_BOOKTABS = element(:usepackage,{},'booktabs').cr
|
16
16
|
|
17
17
|
=begin rdoc
|
18
|
-
Environment Table
|
18
|
+
Environment Table.
|
19
|
+
|
20
|
+
Only LaTeX.
|
19
21
|
=end
|
20
22
|
class Table < Environments::Environment
|
21
23
|
add_attributes HTML_ATTR_ALL
|
@@ -29,7 +31,7 @@ Tabulars
|
|
29
31
|
|
30
32
|
fixme: check on attributes. columnsdescription
|
31
33
|
~ :table=> {:border=>nil, :width=>nil, :cellpadding=>nil, :cellspacing=>nil},#complete it
|
32
|
-
~ :colgroup => {}, #
|
34
|
+
~ :colgroup => {}, #complete it
|
33
35
|
=end
|
34
36
|
class Tabular < Element
|
35
37
|
add_attributes HTML_ATTR_ALL
|
@@ -114,16 +116,21 @@ Output a complete tabular in wikimedia-like tabular extension for creole.
|
|
114
116
|
Use longtable-package.
|
115
117
|
|
116
118
|
Requires
|
117
|
-
doc.head << element(:usepackage,{},'longtable')
|
119
|
+
doc.head << element(:usepackage,{},'longtable')
|
120
|
+
|
118
121
|
=end
|
119
122
|
class Longtable < Tabular
|
120
123
|
add_attributes Tabular.get_attribute_list( )
|
124
|
+
#Position of the longtable in paragraph
|
125
|
+
add_attribute :texalignment, Attribute.create( [:latex], %w{l c r} )
|
121
126
|
def to_latex(options={})
|
122
127
|
o = set_option_defaults(options)
|
123
128
|
o[:log].debug("enter to_latex for longtable") if o[:log].debug?
|
124
129
|
cmd = ''
|
125
130
|
cmd << "\n" if @crbefore
|
126
|
-
cmd << "\\begin{longtable}
|
131
|
+
cmd << "\\begin{longtable}"
|
132
|
+
cmd << "[%s]" % @attr[:texalignment].content.first if @attr[:texalignment]
|
133
|
+
cmd << "{"
|
127
134
|
cmd << @attr[:columndescription].content.to_doc(:latex, o)
|
128
135
|
cmd << "}"
|
129
136
|
cmd << "\n" if @crmid
|
@@ -166,9 +173,13 @@ fixme :width is obligatory
|
|
166
173
|
end
|
167
174
|
end #class Tabularx
|
168
175
|
=begin rdoc
|
169
|
-
May only be used
|
176
|
+
May only be used inside a tabular. Tabular must set the columns-value.
|
170
177
|
|
171
178
|
If not, zero columns is expected and an error is thrown.
|
179
|
+
In this cases you can mock a columns definition via an attribute.
|
180
|
+
There si now check, if the row is added later to a tabular with the same size.
|
181
|
+
|
182
|
+
You can add rows in an array.
|
172
183
|
=end
|
173
184
|
class Row < Element
|
174
185
|
add_id :tr
|
@@ -176,12 +187,13 @@ If not, zero columns is expected and an error is thrown.
|
|
176
187
|
add_attributes( {
|
177
188
|
:add_vspace => Attribute.create( [:latex] ) ,
|
178
189
|
:bgcolor => Attribute.create( [ :html ] ),
|
179
|
-
:width
|
190
|
+
:width => Attribute.create( [ :html ] ),
|
180
191
|
:height => Attribute.create( [ :html ] ),
|
181
|
-
#
|
182
|
-
#~ :hline => Attribute.create( [:latex], [true, false] ) ,
|
192
|
+
:columns => Attribute.create( [] ), #normally set by related table. But useful if columns are created before the table is defined
|
183
193
|
}.update(HTML_ATTR_ALL) )
|
184
194
|
def initialize( attr={}, content = nil)
|
195
|
+
local_content = content #store for later analyze
|
196
|
+
content = nil #default Element will give an error -> remove content
|
185
197
|
super
|
186
198
|
#For Ruby 1.9: Initialize instance variable
|
187
199
|
@toprule = false
|
@@ -194,8 +206,16 @@ If not, zero columns is expected and an error is thrown.
|
|
194
206
|
@cline = false
|
195
207
|
@cmidrule = false
|
196
208
|
@hline = false
|
209
|
+
@columns = attr[:columns] #if set, we can suppress error messages
|
210
|
+
case local_content
|
211
|
+
when nil #ok, no content
|
212
|
+
when Array
|
213
|
+
local_content.each{|col| self << col }
|
214
|
+
else
|
215
|
+
@log.error("Row allows no %s as parameter" % local_content.class)
|
216
|
+
end
|
197
217
|
end
|
198
|
-
#Set from tabular
|
218
|
+
#Set from tabular or by attribute columns
|
199
219
|
attr_accessor :columns
|
200
220
|
#Set a line after the row.
|
201
221
|
def hline(); @hline = element(:hline); self; end
|
@@ -233,22 +253,22 @@ If not, zero columns is expected and an error is thrown.
|
|
233
253
|
def endlastfoot(); @endlastfoot = element(:endlastfoot); self; end
|
234
254
|
#Only Colums are allowed to be added.
|
235
255
|
#In combination with longtable, captions are also allowed.
|
236
|
-
def << (
|
256
|
+
def << ( column )
|
237
257
|
#Check on allowed elements inside a row
|
238
258
|
allowed = false
|
239
259
|
[ :col, :multicolumn, :caption].each{|el|
|
240
|
-
if
|
260
|
+
if column.is_a?( Element.get(el) )
|
241
261
|
allowed = true
|
242
262
|
break
|
243
263
|
end
|
244
264
|
}
|
245
265
|
if ! allowed
|
246
|
-
@log.warn("Add non-column to tabular (#{
|
266
|
+
@log.warn("Add non-column to tabular (#{column.class})") if @log.warn?
|
247
267
|
end
|
248
|
-
@content <<
|
268
|
+
@content << column
|
249
269
|
#Does not work with multicolumns.
|
250
270
|
if !@columns
|
251
|
-
@log.warn("Add row to tabular with undefined columns number (#{
|
271
|
+
@log.warn("Add row to tabular with undefined columns number (#{column.inspect})" ) if @log.warn?
|
252
272
|
elsif @content.size > @columns
|
253
273
|
@log.warn("Tabular with #{@columns} columns get #{@content.size} columns" ) if @log.warn?
|
254
274
|
end
|
@@ -264,15 +284,7 @@ If not, zero columns is expected and an error is thrown.
|
|
264
284
|
cmd = ''
|
265
285
|
cmd << "\n" if @crbefore
|
266
286
|
cmd << @content.map{|cell| cell.to_latex(o)}.join(' & ')
|
267
|
-
#
|
268
|
-
#In usage in documents, two \\ are needed (-> see unittest )
|
269
|
-
if o[:filename]
|
270
|
-
o[:log].debug("table/row with corresponding file #{o[:filename].inspect}") if o[:log].debug?
|
271
|
-
cmd << Regexp.escape('\\' + '\\')
|
272
|
-
else
|
273
|
-
o[:log].debug("table/row without corresponding file") if o[:log].debug?
|
274
|
-
cmd << Regexp.escape('\\')
|
275
|
-
end
|
287
|
+
cmd << Regexp.escape('\\') #escape needed to keep the double \\
|
276
288
|
cmd << "[#{@attr[:add_vspace].content.join}]" if @attr[:add_vspace].content.size > 0
|
277
289
|
cmd << @hline.to_latex(o) if @hline
|
278
290
|
cmd << @toprule.to_latex(o) if @toprule
|
@@ -301,6 +313,9 @@ If not, zero columns is expected and an error is thrown.
|
|
301
313
|
@attr[:style] << css = CSS.new if ! css
|
302
314
|
|
303
315
|
#Doesn't work. Style sheet setting in tr doesn't go to td
|
316
|
+
#See http://stackoverflow.com/questions/1384823/how-to-specify-the-bottom-border-of-a-tr, comment of deceze
|
317
|
+
# You can't style a <tr>, as it's only a "logical grouping element", but it's not actually rendered.
|
318
|
+
# You can only style the <td> or <th> elements inside the <tr>
|
304
319
|
if @hline
|
305
320
|
css[:border_bottom_style] = 'solid'
|
306
321
|
css[:border_bottom_width] = 'medium'
|
@@ -469,7 +484,11 @@ A column in a tabular.
|
|
469
484
|
o[:log].debug("enter to_latex for column") if o[:log].debug?
|
470
485
|
cmd = ''
|
471
486
|
cmd << "\n" if @crbefore
|
472
|
-
cmd <<
|
487
|
+
cmd << if self.is_a?(Column_th )
|
488
|
+
element(:textbf,{}, @content).to_latex(o) #make bold for header line
|
489
|
+
else
|
490
|
+
"#{@content.to_latex(o)}"
|
491
|
+
end
|
473
492
|
cmd << "\n" if @crafter
|
474
493
|
return cmd
|
475
494
|
end
|
@@ -545,7 +564,7 @@ Multicolumn
|
|
545
564
|
def to_latex(options={})
|
546
565
|
o = set_option_defaults(options)
|
547
566
|
o[:log].debug("enter to_latex for multicolumn") if o[:log].debug?
|
548
|
-
o[:log].warn("multicolumn without latex-position") unless @attr[:pos].filled?
|
567
|
+
o[:log].warn("multicolumn without latex-position (attribute 'pos')") unless @attr[:pos].filled?
|
549
568
|
cmd = ''
|
550
569
|
cmd << "\n" if @crbefore
|
551
570
|
cmd << "\\multicolumn{#{@attr[:colspan]}}{#{@attr[:pos]}}{#{@content.to_latex(o)}}"
|
@@ -170,6 +170,34 @@
|
|
170
170
|
\end{document}
|
171
171
|
% ----------------------------------------------------------------
|
172
172
|
|
173
|
+
:standalone:
|
174
|
+
:target: :latex
|
175
|
+
:encoding: utf-8
|
176
|
+
:source: |
|
177
|
+
<<prefix>>
|
178
|
+
\documentclass[<<classoptions>>]{standalone}
|
179
|
+
\usepackage{babel}
|
180
|
+
%Encoding-package depends on TeX-engine
|
181
|
+
\usepackage{ifpdf,ifxetex,ifluatex}
|
182
|
+
\ifxetex
|
183
|
+
\usepackage{fontspec} %Without, umlauts are missing
|
184
|
+
\fi
|
185
|
+
\ifluatex
|
186
|
+
\usepackage[utf8]{luainputenc} %Or in first line: % !Mode:: "TeX:UTF-8".
|
187
|
+
\else
|
188
|
+
\ifpdf\relax
|
189
|
+
\usepackage[utf8]{inputenc}
|
190
|
+
\fi
|
191
|
+
\fi
|
192
|
+
%\usepackage{hyperref}
|
193
|
+
% ----------------------------------------------------------------
|
194
|
+
<<head>>
|
195
|
+
% ----------------------------------------------------------------
|
196
|
+
\begin{document}
|
197
|
+
<<body>>
|
198
|
+
\end{document}
|
199
|
+
% ----------------------------------------------------------------
|
200
|
+
|
173
201
|
:context:
|
174
202
|
:target: :context
|
175
203
|
:source: |
|
@@ -0,0 +1,146 @@
|
|
1
|
+
=begin rdoc
|
2
|
+
=Version history
|
3
|
+
==Pre-Versions
|
4
|
+
===0.0.x:
|
5
|
+
* Developpers version
|
6
|
+
|
7
|
+
===0.1.0:
|
8
|
+
* to_element
|
9
|
+
|
10
|
+
===0.1.1:
|
11
|
+
* to_element
|
12
|
+
|
13
|
+
==1.0.0:
|
14
|
+
* to_doc
|
15
|
+
* no @@target any longer
|
16
|
+
* Document.new mit Hash
|
17
|
+
* unit tests
|
18
|
+
* lib-folder
|
19
|
+
* Constant DOCGENERATOR_VERSION
|
20
|
+
* Published as 1.0.2
|
21
|
+
|
22
|
+
===1.0.3:
|
23
|
+
* Add table of contents
|
24
|
+
|
25
|
+
===1.0.4 (2008-05-06)
|
26
|
+
* wiki2docgenerator: delete myscripts.rb
|
27
|
+
* wiki2docgenerator: change in link (no cr)
|
28
|
+
* Add dependency log4r
|
29
|
+
* Correction error 'uninitialized constant CSS_collection (NameError)'
|
30
|
+
-> rubyforge
|
31
|
+
|
32
|
+
==1.0.5 (2008-09-24)
|
33
|
+
* yaml2presentation + docgenerator_beamer.rb
|
34
|
+
* Correction packages/docgenerator_scrlettr2.rb
|
35
|
+
* wiki2docgenerator: In Tab: Allow ! as replacement for |
|
36
|
+
* CSS_collection: Define accessor []
|
37
|
+
* Attribute#filled? ignores nil-values
|
38
|
+
* Docgenerator:
|
39
|
+
*Default-Logger gives message
|
40
|
+
*Check META-Values
|
41
|
+
*shorttitle adapted
|
42
|
+
*Document.new: add option :css
|
43
|
+
|
44
|
+
===1.1.0
|
45
|
+
* Document.save: Changes interface, options...
|
46
|
+
* Wikitext: Ignore multiple empty lines
|
47
|
+
* Element#new: Define default-attribute :log for logger (used afterwords as @log)
|
48
|
+
* yaml2presentation: New setting :valid_keys
|
49
|
+
* package/docgenerator_scrlettr2: Extended
|
50
|
+
* default pdflualatex for runtex
|
51
|
+
* Add ->, => for text-output
|
52
|
+
|
53
|
+
===1.1.1:
|
54
|
+
* Document.new: New option parameter/All meta-tags are allowed
|
55
|
+
* Document.save: New option :additional_options
|
56
|
+
* Wikitext: Add method Wikitext.help
|
57
|
+
* Added first version of creole2doc (should replace wiki2docgenerator)
|
58
|
+
Details see http://www.wikicreole.org/
|
59
|
+
* Little reorg of the Documentation
|
60
|
+
published 2009-06-28
|
61
|
+
|
62
|
+
===1.1.2:
|
63
|
+
* Correction Creole (Unit test test_creole_mix_titles_list)
|
64
|
+
* First steps for Context-support (don't expect too much)
|
65
|
+
|
66
|
+
==1.2.0:
|
67
|
+
* New gem: docgenerator_tools
|
68
|
+
* Move yaml2presentation from docgenerator to docgenerator_tools
|
69
|
+
* Creole_document makes tableofcontents for tex, not Creole#toc
|
70
|
+
* Add creole_rail.rb to docgenerator_tools
|
71
|
+
* Add rubycode4doc to docgenerator_tools
|
72
|
+
* Add code2structogramm to docgenerator_tools
|
73
|
+
* Add Creole-option :ignore
|
74
|
+
* Add Creole-option :comment
|
75
|
+
* Repair load-bug with usepackage
|
76
|
+
* Redefine pathes for privat and tools (check open)
|
77
|
+
* Add examples for docgenerator_tools
|
78
|
+
* Replace Document#runtex with rake4latex
|
79
|
+
* Add Versions to Classes...
|
80
|
+
* Reorganize unit tests
|
81
|
+
* Ruby 1.9 enabled
|
82
|
+
|
83
|
+
===1.2.1 2011-02-20
|
84
|
+
* More Ruby 1.9.1 additions (convert encodings)
|
85
|
+
* Creole: Images with option width (LaTeX)
|
86
|
+
* Corrected examples, added expected results of the examples (increases gem size)
|
87
|
+
* corrections footnote handling
|
88
|
+
|
89
|
+
===1.2.2
|
90
|
+
* correction wiki2docgenerator.rb, wiki2docgenerator_example.rb
|
91
|
+
* add creole2doc_example.rb
|
92
|
+
* add todonotes support (only LaTeX)
|
93
|
+
|
94
|
+
==2.0.0 2011-04-29
|
95
|
+
* Pack everything in module Docgenerator
|
96
|
+
* Group classes to modules
|
97
|
+
* clean up lib-folder
|
98
|
+
* docgenerator_tools integrated in docgenerator (and docgenerator4presentation-gem)
|
99
|
+
|
100
|
+
==2.1.0 2012-06-16
|
101
|
+
* Encoding:
|
102
|
+
* Switch templates to UTF-8
|
103
|
+
* enable encoding for templates + unittest_templates.rb
|
104
|
+
* Creole
|
105
|
+
* Correction Docgenerator::Creole::Creole#toc
|
106
|
+
* Add parameter Docgenerator::Creole::Creole#new logname
|
107
|
+
* new: Docgenerator::Creole::Creole_longtable
|
108
|
+
* Correction implicit HTTP (Use \url instead href)
|
109
|
+
* to_creole for tables implemented Docgenerator::Tables::Tabular
|
110
|
+
* Docgenerator::Document.new:
|
111
|
+
* option latex_option (replacement for Docgenerator::Document#add_option)
|
112
|
+
* option logname
|
113
|
+
* Correction element caption
|
114
|
+
* href: change internal links
|
115
|
+
* element li: add type
|
116
|
+
|
117
|
+
==New
|
118
|
+
* Reorganize Version history
|
119
|
+
|
120
|
+
==2.1.1 2015-04-01
|
121
|
+
* Document:
|
122
|
+
* Added subtitle-option (needed for koma-script titlepage).
|
123
|
+
* Added encoding information to file prefix.
|
124
|
+
* Templates:
|
125
|
+
* add standalone
|
126
|
+
* Creole:
|
127
|
+
* Improved encoding handling
|
128
|
+
* tabular: Option hline
|
129
|
+
* Define Docgenerator::Creole::Creole.targetdir
|
130
|
+
* Define plugin latex Docgenerator::Creole::Creole::Plugins::Creole_short_latex
|
131
|
+
* Comment function in wiki method adapted
|
132
|
+
* Elements:
|
133
|
+
* Added Docgenerator::Index to build index.
|
134
|
+
* Docgenerator::Tables::Row
|
135
|
+
* allows definition of column number (usefull if rows are created before the tabular exists)
|
136
|
+
* Can receive content in an array
|
137
|
+
* Packages:
|
138
|
+
* Docgenerator::Packages::PDFPages
|
139
|
+
New: Docgenerator::Packages::PDFPages::IncludePDFmerge
|
140
|
+
=end
|
141
|
+
|
142
|
+
#
|
143
|
+
module Docgenerator
|
144
|
+
#Define Version number.
|
145
|
+
VERSION = '2.1.1'
|
146
|
+
end
|