docgenerator 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/creole_example_tabular.rb +95 -0
- data/examples/docgenerator_example.rb +5 -5
- data/lib/creole/creole2doc.rb +28 -18
- data/lib/creole/creole_inclusions.rb +4 -4
- data/lib/creole/creole_placeholder.rb +4 -1
- data/lib/creole/creole_tabular.rb +173 -155
- data/lib/creole/plugins/rail.rb +118 -119
- data/lib/creole/plugins/struktex.rb +35 -35
- data/lib/creole/plugins/todonotes.rb +8 -1
- data/lib/docgenerator/attribute.rb +160 -160
- data/lib/docgenerator/characters.rb +343 -311
- data/lib/docgenerator/css.rb +167 -167
- data/lib/docgenerator/document.rb +525 -511
- data/lib/docgenerator/element.rb +316 -316
- data/lib/docgenerator/element_meta.rb +114 -114
- data/lib/docgenerator/elements.rb +19 -9
- data/lib/docgenerator/environments.rb +3 -1
- data/lib/docgenerator/lists.rb +177 -174
- data/lib/docgenerator/packages/hyperref.rb +74 -70
- data/lib/docgenerator/packages/multicol.rb +33 -0
- data/lib/docgenerator/packages/scrlettr2.rb +152 -151
- data/lib/docgenerator/packages/todonotes.rb +1 -1
- data/lib/docgenerator/tabular.rb +463 -400
- data/lib/docgenerator/templates/docgenerator_template.rb +94 -84
- data/lib/docgenerator/templates/docgenerator_template.yaml +75 -15
- data/lib/docgenerator.rb +1 -1
- data/lib/wiki2doc/wiki2docgenerator.rb +1 -1
- data/meta_test_and_doc/build__meta.rb +125 -0
- data/meta_test_and_doc/build_doc.rb +333 -0
- data/meta_test_and_doc/build_test.rb +251 -0
- data/meta_test_and_doc/manpages/attachfile.rb +389 -0
- data/meta_test_and_doc/manpages/caption.rb +133 -0
- data/meta_test_and_doc/manpages/characters.rb +3738 -0
- data/meta_test_and_doc/manpages/elements.rb +6851 -0
- data/meta_test_and_doc/manpages/environments.rb +985 -0
- data/meta_test_and_doc/manpages/footnote.rb +439 -0
- data/meta_test_and_doc/manpages/hyperref.rb +605 -0
- data/meta_test_and_doc/manpages/listings.rb +988 -0
- data/meta_test_and_doc/manpages/lists.rb +1463 -0
- data/meta_test_and_doc/manpages/others.rb +129 -0
- data/meta_test_and_doc/manpages/packages.rb +13 -0
- data/meta_test_and_doc/manpages/pdfpages.rb +108 -0
- data/meta_test_and_doc/manpages/readme.rdoc +9 -0
- data/meta_test_and_doc/manpages/scrlettr2.rb +362 -0
- data/meta_test_and_doc/manpages/scrpage2.rb +2028 -0
- data/meta_test_and_doc/manpages/sectioning.rb +2467 -0
- data/meta_test_and_doc/manpages/tables.rb +2088 -0
- data/meta_test_and_doc/manpages/todonotes.rb +235 -0
- data/meta_test_and_doc/manpages/wiki2docgenerator.rb +64 -0
- data/{readme.rd → readme.rdoc} +18 -1
- data/unittest/expected/test_tabular.creole +33 -0
- data/unittest/expected_creole/test_creole_creole1.0test.html +3 -3
- data/unittest/expected_creole/test_creole_creole1.0test.latex +3 -3
- data/unittest/expected_creole/test_creole_creole1.0test.text +3 -3
- data/unittest/expected_creole/test_creole_inline_apostroph.html +6 -0
- data/unittest/expected_creole/test_creole_inline_apostroph.latex +8 -0
- data/unittest/expected_creole/test_creole_inline_apostroph.text +4 -0
- data/unittest/expected_creole/test_creole_input.normsource +12 -12
- data/unittest/expected_creole/test_creole_input.normsource_1.8 +23 -0
- data/unittest/expected_creole/test_creole_links_external_implicit.html +2 -2
- data/unittest/expected_creole/test_creole_links_external_implicit.latex +2 -2
- data/unittest/expected_creole/test_creole_links_external_implicit.text +2 -2
- data/unittest/expected_creole/test_creole_links_implicit_end.html +1 -1
- data/unittest/expected_creole/test_creole_links_implicit_end.latex +1 -1
- data/unittest/expected_creole/test_creole_list_ul.normsource +42 -42
- data/unittest/expected_creole/test_creole_list_ul.normsource_1.8 +83 -0
- data/unittest/expected_creole/test_creole_paragraphs.normsource +15 -15
- data/unittest/expected_creole/test_creole_paragraphs.normsource_1.8 +27 -0
- data/unittest/expected_creole/test_creole_tabular.creole +22 -0
- data/unittest/expected_creole/test_creole_tabular_creole.creole +19 -0
- data/unittest/expected_creole/test_creole_tabular_css.creole +24 -0
- data/unittest/expected_creole/test_creole_tabular_multicols.creole +16 -0
- data/unittest/expected_creole/test_creole_tabular_multicols.html +14 -0
- data/unittest/expected_creole/test_creole_tabular_multicols.latex +16 -0
- data/unittest/expected_creole/test_creole_tabular_with_cell_option.creole +21 -0
- data/unittest/expected_creole/test_creole_toc_level_text.html +2 -2
- data/unittest/expected_creole/test_creole_toc_level_text.latex +2 -2
- data/unittest/expected_packages/test_multicol_3.tex +2 -0
- data/unittest/expected_packages/test_multicol_3_titleline.tex +2 -0
- data/unittest/expected_templates/test_article.tex +23 -0
- data/unittest/expected_templates/test_article_utf8.tex +34 -0
- data/unittest/expected_templates/test_context.miv +18 -0
- data/unittest/expected_templates/test_creole.creole +8 -0
- data/unittest/expected_templates/test_html.html +12 -0
- data/unittest/expected_templates/test_html401_strict.html +14 -0
- data/unittest/expected_templates/test_html401_trans.html +14 -0
- data/unittest/expected_templates/test_html_utf8.html +14 -0
- data/unittest/expected_templates/test_include.tex +17 -0
- data/unittest/expected_templates/test_include_utf8.tex +17 -0
- data/unittest/expected_templates/test_text.txt +6 -0
- data/unittest/expected_templates/test_wiki.wiki +6 -0
- data/unittest/expected_templates/test_xhtml_strict.html +14 -0
- data/unittest/expected_templates/test_xhtml_trans.html +14 -0
- data/unittest/unittest_creole.rb +27 -6
- data/unittest/unittest_creole_placeholders.rb +1 -123
- data/unittest/unittest_creole_tabular.rb +174 -0
- data/unittest/unittest_docgenerator.rb +4 -3
- data/unittest/unittest_docgenerator_characters.rb +4769 -615
- data/unittest/unittest_packages_multicol.rb +84 -0
- data/unittest/unittest_rubycode4doc.rb +0 -1
- data/unittest/unittest_templates.rb +64 -0
- metadata +163 -77
- data/build_test_and_doc.rb +0 -505
- data/manpage_elements.rb +0 -10411
@@ -1,3 +1,4 @@
|
|
1
|
+
#encoding: utf-8
|
1
2
|
=begin rdoc
|
2
3
|
Definition of elements for LaTeX class scrlettr2 (Koma-Script)
|
3
4
|
|
@@ -10,172 +11,172 @@ end
|
|
10
11
|
|
11
12
|
#
|
12
13
|
module Docgenerator
|
13
|
-
module Packages
|
14
|
-
module Letter
|
15
|
-
DocumentTemplate.new(
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
14
|
+
module Packages
|
15
|
+
module Letter
|
16
|
+
DocumentTemplate.new(
|
17
|
+
:scrlttr2, :latex, %q|<<prefix>>
|
18
|
+
\documentclass[<<classoptions>>]{scrlttr2}
|
19
|
+
\usepackage{babel}
|
20
|
+
\usepackage[ansinew]{inputenc}
|
21
|
+
\usepackage{hyperref}
|
22
|
+
% ----------------------------------------------------------------
|
23
|
+
<<head>>
|
24
|
+
% ----------------------------------------------------------------
|
25
|
+
\begin{document}
|
26
|
+
<<body>>
|
27
|
+
\end{document}
|
28
|
+
% ----------------------------------------------------------------
|
29
|
+
|)
|
29
30
|
|
30
31
|
|
31
32
|
|
32
|
-
class LoadLetterOption < Element
|
33
|
+
class LoadLetterOption < Element
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end #LoadLetterOption
|
35
|
+
def to_latex( options = {} )
|
36
|
+
cmd = ''
|
37
|
+
cmd << "\n" if @crbefore
|
38
|
+
cmd << "\\LoadLetterOption{#{@content.join(',')}}"
|
39
|
+
cmd << "\n" if @crafter
|
40
|
+
return cmd
|
41
|
+
end
|
42
|
+
end #LoadLetterOption
|
42
43
|
|
43
|
-
#Usage:
|
44
|
-
# element(:setkomavar,{:field => field}, .content).cr
|
45
|
-
# element(:setkomavar,{:field => field, :fieldtext=>'Text'}, .content).cr
|
46
|
-
class Setkomavar < Element
|
47
|
-
|
48
|
-
|
44
|
+
#Usage:
|
45
|
+
# element(:setkomavar,{:field => field}, .content).cr
|
46
|
+
# element(:setkomavar,{:field => field, :fieldtext=>'Text'}, .content).cr
|
47
|
+
class Setkomavar < Element
|
48
|
+
add_attribute :field, Attribute.create( [ :latex, :required ], [Symbol], 1 )
|
49
|
+
add_attribute :fieldtext, Attribute.create( [ :latex, :required ], [String], 2 )
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end #Setkomavar
|
51
|
+
def to_latex( options = {} )
|
52
|
+
cmd = ''
|
53
|
+
cmd << "\n" if @crbefore
|
54
|
+
cmd << "\\setkomavar{#{@attr[:field]}}"
|
55
|
+
cmd << "[#{@attr[:fieldtext]}]" if @attr[:fieldtext].filled?
|
56
|
+
cmd << "{#{@content.join(',')}}"
|
57
|
+
cmd << "\n" if @crafter
|
58
|
+
return cmd
|
59
|
+
end
|
60
|
+
end #Setkomavar
|
60
61
|
|
61
62
|
|
62
63
|
|
63
|
-
#Example:
|
64
|
-
# letter = Letter.new( {
|
65
|
-
# :address => [ 'Name',
|
66
|
-
# 'Strasse',
|
67
|
-
# 'PLZ Ort'
|
68
|
-
# ].map{|e| [e, element(:br)] },
|
69
|
-
# :date => '',
|
70
|
-
# :opening => '~',
|
71
|
-
# :closing => '~',
|
72
|
-
# }).cr
|
73
|
-
class Letter < Environments::Environment
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
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
|
-
|
112
|
-
|
64
|
+
#Example:
|
65
|
+
# letter = Letter.new( {
|
66
|
+
# :address => [ 'Name',
|
67
|
+
# 'Strasse',
|
68
|
+
# 'PLZ Ort'
|
69
|
+
# ].map{|e| [e, element(:br)] },
|
70
|
+
# :date => '',
|
71
|
+
# :opening => '~',
|
72
|
+
# :closing => '~',
|
73
|
+
# }).cr
|
74
|
+
class Letter < Environments::Environment
|
75
|
+
|
76
|
+
add_attributes( {
|
77
|
+
:address => Attribute.create( [ :latex, :required ] ),
|
78
|
+
:date => Attribute.create( [ :latex ], [String] ), #Date?
|
79
|
+
:opening => Attribute.create( [ :latex, :required ] ),
|
80
|
+
:letter_option => Attribute.create( [ :latex ] ), # Für \LoadLetterOption
|
81
|
+
:backaddress => Attribute.create( [ :latex ] ), # Rücksendeadresse für Fensterbriefumschläge
|
82
|
+
#~ backaddressseparator Trennzeichen innerhalb der Rücksendeadresse
|
83
|
+
#~ ccseparator Trennzeichen zwischen Verteilertitel und Verteiler
|
84
|
+
:customer => Attribute.create( [ :latex ] ), #Geschäftszeilenfeld ”Kundennummer“
|
85
|
+
#~ emailseparator Trennzeichen zwischen E-Mail-Bezeichner und E-Mail-Adresse
|
86
|
+
#~ enclseparator Trennzeichen zwischen Anlagetitel und Anlagen
|
87
|
+
#~ faxseparator Trennzeichen zwischen Faxbezeichner und Faxnummer
|
88
|
+
:fromaddress => Attribute.create( [ :latex ] ), #Absenderadresse ohne Absendername
|
89
|
+
:frombank => Attribute.create( [ :latex ] ), #Bankverbindung des Absenders
|
90
|
+
:fromemail => Attribute.create( [ :latex ] ), #E-Mail-Adresse des Absenders
|
91
|
+
:fromfax => Attribute.create( [ :latex ] ), #Faxnummer des Absenders
|
92
|
+
:fromlogo => Attribute.create( [ :latex ] ), #Anweisungen zum Setzen des Absenderlogos
|
93
|
+
:fromname => Attribute.create( [ :latex ] ), #vollständiger Absendername
|
94
|
+
:fromphone => Attribute.create( [ :latex ] ), #Telefonnummer des Absenders
|
95
|
+
:fromurl => Attribute.create( [ :latex ] ), #eine URL des Absenders
|
96
|
+
:invoice => Attribute.create( [ :latex ] ), #Geschäftszeilenfeld ”Rechnungsnummer“
|
97
|
+
#~ location erweiterte Absenderangabe
|
98
|
+
:myref => Attribute.create( [ :latex ] ), #Geschäftszeilenfeld ”Mein Zeichen“
|
99
|
+
#~ place Ort
|
100
|
+
#~ placeseparator Trennzeichen zwischen Ort und Datum
|
101
|
+
#~ phoneseparator Trennzeichen zwischen Telefonbezeichner und Telefonnummer
|
102
|
+
#~ specialmail Versandart
|
103
|
+
:subject => Attribute.create( [ :latex ] ), #Betreff
|
104
|
+
#~ subjectseparator Trennzeichen zwischen Betrefftitel und Betreff
|
105
|
+
:title => Attribute.create( [ :latex ] ), #Brieftitel
|
106
|
+
#~ toname vollständiger Empfängername
|
107
|
+
#~ toaddress Empfängeradresse ohne Empfängername
|
108
|
+
#~ yourmail Geschäftszeilenfeld ”Ihr Schreiben“
|
109
|
+
#~ yourref
|
110
|
+
:signature => Attribute.create( [ :latex ] ), #Signatur unter Unterschrift und Grußformel
|
111
|
+
:closing => Attribute.create( [ :latex, :required ] ),
|
112
|
+
}
|
113
|
+
)
|
113
114
|
|
114
115
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
116
|
+
def setkomavar( field )
|
117
|
+
if @attr[field].content.size > 0
|
118
|
+
return element(:setkomavar,{:field => field}, @attr[field].content).cr.to_latex
|
119
|
+
#~ return "\\setkomavar{#{field}}{#{@attr[field]}}\n"
|
120
|
+
else
|
121
|
+
return ''
|
122
|
+
end
|
123
|
+
end
|
123
124
|
=begin rdoc
|
124
125
|
Redefine to_latex_environment.
|
125
126
|
|
126
127
|
Parameters for letters are defined via #setkomavar.
|
127
128
|
|
128
129
|
=end
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
end
|
179
|
-
end #module Letter
|
180
|
-
end #module Packages
|
130
|
+
def to_latex_environment( environment, parameter = nil, options = {} )
|
131
|
+
cmd = ''
|
132
|
+
cmd << "\n" if @crbefore
|
133
|
+
cmd << "\n\\begin{#{environment}}"
|
134
|
+
cmd << "{#{@attr[:address]}}\n"
|
135
|
+
if @attr[:letter_option].filled?
|
136
|
+
cmd << element(:loadletteroption, {}, @attr[:letter_option].content).cr.to_latex(options)
|
137
|
+
end
|
138
|
+
#~ cmd << "{"
|
139
|
+
#~ cmd << @attr[:address].content.flatten.join( element(:br).to_latex)
|
140
|
+
#~ cmd << "}\n"
|
141
|
+
cmd << "\\date{#{@attr[:date]}}\n" if @attr[:date]
|
142
|
+
cmd << setkomavar( :backaddress )
|
143
|
+
cmd << setkomavar( :fromaddress )
|
144
|
+
cmd << setkomavar( :frombank )
|
145
|
+
cmd << setkomavar( :fromemail )
|
146
|
+
cmd << setkomavar( :fromfax )
|
147
|
+
cmd << setkomavar( :fromlogo )
|
148
|
+
cmd << setkomavar( :fromname )
|
149
|
+
cmd << setkomavar( :fromphone )
|
150
|
+
cmd << setkomavar( :fromurl )
|
151
|
+
cmd << setkomavar( :subject)
|
152
|
+
cmd << setkomavar( :customer)
|
153
|
+
cmd << setkomavar( :invoice)
|
154
|
+
cmd << setkomavar( :myref)
|
155
|
+
cmd << "\\opening{#{@attr[:opening]}}\n"
|
156
|
+
cmd << @content.to_latex(options)
|
157
|
+
cmd = cmd.chomp + "\n"
|
158
|
+
cmd << setkomavar( :signature)
|
159
|
+
cmd << "\\closing{#{@attr[:closing]}}\n"
|
160
|
+
cmd << "\\end{#{environment}}\n"
|
161
|
+
cmd << "\n" if @crafter
|
162
|
+
return cmd
|
163
|
+
end
|
164
|
+
def to_latex( options = {} )
|
165
|
+
return to_latex_environment( 'letter', nil, options )
|
166
|
+
end
|
167
|
+
def to_html( options = {})
|
168
|
+
cmd = element( :div ).CR
|
169
|
+
#~ cmd << "\n" if @crbefore
|
170
|
+
cmd << anr = element(:p,{}, 'An' )
|
171
|
+
anr << element(:br)
|
172
|
+
@attr[:address].content.each{|a| anr << [a, element(:br) ] }
|
173
|
+
cmd << element(:p,{}, @attr[:opening] )
|
174
|
+
cmd << @content.to_html
|
175
|
+
cmd << element(:p,{}, @attr[:closing] )
|
176
|
+
#~ cmd << "\n" if @crafter
|
177
|
+
return cmd.to_html(options)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end #module Letter
|
181
|
+
end #module Packages
|
181
182
|
end #module Docgenerator
|