docgenerator 2.0.0 → 2.1.0

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