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,208 +1,211 @@
1
1
  module Docgenerator
2
- module Lists
2
+ module Lists
3
3
  =begin rdoc
4
4
  Generic class for list environments.
5
5
 
6
6
  Used to define Itemize, Enumerate...
7
7
  =end
8
- class ListEnvironment < Environments::Environment
9
- add_attributes( HTML_ATTR_ALL )
10
- #Only items are allowed to be added.
11
- #
12
- #If an array is given, each item is added on it
13
- def << ( item)
14
- if item.is_a?(Array)
15
- item.each{|it| self << it }
16
- else
17
- if self.class == Description
18
- #fixme: Reihenfolge
19
- if ! ( item.is_a?( Element.get(:dt) ) or item.is_a?( Element.get(:dd) ) )
20
- @log.warn("Add non-item to list (#{item.inspect})") if @log.warn
21
- end
22
- elsif ! item.is_a?( Element.get(:item) )
23
- @log.warn("Add non-item to list (#{item.inspect})") if @log.warn
24
- end
25
- @content << item
26
- end
27
- end
28
- #Add parent-information to options. This is used by the list elements to get the list type.
29
- def to_doc( target, options = {} )
30
- o = set_option_defaults(options)
31
- o[:log].debug("enter to_doc for #{self.inspect}") if o[:log].debug?
32
- options[:parent] = self
33
- super
34
- end
35
- def to_wiki( options= {} )
36
- return "#{@content.to_doc(:wiki, options)}\n".gsub(/\n\n/, "\n")
37
- end
38
- def to_creole( options= {} )
39
- return "#{@content.to_doc(:wiki, options)}\n".gsub(/\n\n/, "\n")
40
- end
41
- def to_text( options={} )
42
- return "#{@content.to_doc(:text,options)}\n".gsub(/\n\n/, "\n")
43
- end
44
- end
8
+ class ListEnvironment < Environments::Environment
9
+ add_attributes( HTML_ATTR_ALL )
10
+ #Only items are allowed to be added.
11
+ #
12
+ #If an array is given, each item is added on it
13
+ def << ( item)
14
+ if item.is_a?(Array)
15
+ item.each{|it| self << it }
16
+ else
17
+ if self.class == Description
18
+ #fixme: Reihenfolge
19
+ if ! ( item.is_a?( Element.get(:dt) ) or item.is_a?( Element.get(:dd) ) )
20
+ @log.warn("Add non-item to list (get #{item.inspect})") if @log.warn
21
+ end
22
+ elsif ! item.is_a?( Element.get(:item) )
23
+ @log.warn("Add non-item to list (get #{item.inspect})") if @log.warn
24
+ end
25
+ @content << item
26
+ end
27
+ end
28
+ #Add parent-information to options. This is used by the list elements to get the list type.
29
+ def to_doc( target, options = {} )
30
+ o = set_option_defaults(options)
31
+ o[:log].debug("enter to_doc for #{self.inspect}") if o[:log].debug?
32
+ options[:parent] = self
33
+ super
34
+ end
35
+ def to_wiki( options= {} )
36
+ return "#{@content.to_doc(:wiki, options)}\n".gsub(/\n\n/, "\n")
37
+ end
38
+ def to_creole( options= {} )
39
+ return "#{@content.to_doc(:wiki, options)}\n".gsub(/\n\n/, "\n")
40
+ end
41
+ def to_text( options={} )
42
+ return "#{@content.to_doc(:text,options)}\n".gsub(/\n\n/, "\n")
43
+ end
44
+ end
45
45
 
46
46
  =begin rdoc
47
47
  Unnumbered list
48
48
  =end
49
- class Itemize < ListEnvironment
50
- add_attributes HTML_ATTR_ALL
51
- add_id :ul
52
- def htmltag(); 'ul'; end
53
- def to_latex( options={} )
54
- return to_latex_environment( 'itemize', nil, options )
55
- end
56
- def to_context( options={} )
57
- return to_context_environment( 'itemize', '[1]', options )
58
- end
59
- end
49
+ class Itemize < ListEnvironment
50
+ add_attributes HTML_ATTR_ALL
51
+ add_id :ul
52
+ def htmltag(); 'ul'; end
53
+ def to_latex( options={} )
54
+ return to_latex_environment( 'itemize', nil, options )
55
+ end
56
+ def to_context( options={} )
57
+ return to_context_environment( 'itemize', '[1]', options )
58
+ end
59
+ end
60
60
  =begin rdoc
61
61
  Numbered lists.
62
62
  =end
63
- class Enumerate < ListEnvironment
64
- add_attributes HTML_ATTR_ALL
65
- add_id :ol
66
- add_html_tag 'ol'
67
- def to_latex( options={} )
68
- return to_latex_environment( 'enumerate', nil, options )
69
- end
70
- def to_context( options={} )
71
- return to_context_environment( 'itemize', '[n]', options )
72
- end
73
- end
63
+ class Enumerate < ListEnvironment
64
+ add_attributes HTML_ATTR_ALL
65
+ add_id :ol
66
+ add_html_tag 'ol'
67
+ def to_latex( options={} )
68
+ return to_latex_environment( 'enumerate', nil, options )
69
+ end
70
+ def to_context( options={} )
71
+ return to_context_environment( 'itemize', '[n]', options )
72
+ end
73
+ end
74
74
 
75
75
  =begin rdoc
76
- HTML:
77
- <dl>
78
- <dt> <dd>
79
- </dl>
76
+ HTML:
77
+ <dl>
78
+ <dt> <dd>
79
+ </dl>
80
80
  =end
81
- class Description < ListEnvironment
82
- add_attributes( HTML_ATTR_ALL )
83
- add_id :dl
84
- add_html_tag 'dl'
85
- def to_latex( options={} )
86
- return to_latex_environment( 'description', nil, options )
87
- end
88
- end
81
+ class Description < ListEnvironment
82
+ add_attributes( HTML_ATTR_ALL )
83
+ add_id :dl
84
+ add_html_tag 'dl'
85
+ def to_latex( options={} )
86
+ return to_latex_environment( 'description', nil, options )
87
+ end
88
+ end
89
89
 
90
90
  =begin rdoc
91
91
  Item line in a list.
92
92
 
93
93
  The look will be defined by the environment where it is in (itemize/ul, enumerate/ol)
94
94
  =end
95
- class Item < Element
96
- add_id :li
97
- add_attribute :text, Attribute.create( [ :latex ] )
98
- add_attributes HTML_ATTR_ALL
99
- add_html_tag 'li'
100
- def to_latex( options={} )
101
- cmd = ''
102
- cmd << "\n" if @crbefore
103
- cmd << "\n\\item "
104
- cmd << "[#{@attr[:text]}] " if @attr[:text].filled?
105
- cmd << @content.to_doc(:latex, options)
106
- cmd << "\n" if @crafter
107
- return cmd
108
- end
109
- #Item is the same like in LaTeX,but we have to use to_context() for the sub-elements.
110
- def to_context( options={} )
111
- cmd = ''
112
- cmd << "\n" if @crbefore
113
- cmd << "\n\\item "
114
- #~ cmd << "[#{@attr[:text]}] " if @attr[:text].filled? #fixme
115
- cmd << @content.to_doc(:context, options)
116
- cmd << "\n" if @crafter
117
- return cmd
118
- end
119
- def to_text(options={})
120
- cmd = ''
121
- cmd << "\n" if @crbefore
122
- cmd << "- #{@content.to_doc(:text, options)}"
123
- cmd << "\n" if @crafter
124
- return cmd
125
- end
126
- #fixme geschachtete
127
- #- ** auf stufe 2
128
- #- kein * wenn als n�chstes eine Liste kommt.
129
- def to_wiki(options={})
130
- o = set_option_defaults(options)
131
- o[:log].debug("enter to_latex for row") if o[:log].debug?
132
- cmd = ''
133
- #~ cmd << "\n" if @crbefore
134
- case o[:parent] #check for class to get the item type
135
- when Docgenerator::Lists::Itemize
136
- cmd << "\n* #{@content.to_doc(:wiki, options)}"
137
- when Docgenerator::Lists::Enumerate
138
- cmd << "\n# #{@content.to_doc(:wiki, options)}"
139
- else
140
- o[:log].error(":li/wiki: Unknown list type #{o[:parent].inspect}") if o[:log].error?
141
- cmd << "\n* #{@content.to_doc(:wiki, options)}"
142
- end
143
- #~ cmd << "\n" if cmd[-1,1] != "\n"
144
- cmd << "\n" if @crafter and cmd[-1,1] != "\n"
145
- return cmd
146
- end
147
- #
148
- alias :to_creole :to_wiki #fixme/to_doc(:wiki falsch
149
- end #Item
95
+ class Item < Element
96
+ add_id :li
97
+ add_attribute :text, Attribute.create( [ :latex ] )
98
+ add_attribute :type, Attribute.create( [ :html ], %w{disc square circle 1 a A i I} )
99
+ add_attribute :position, Attribute.create( [ :html ], %w{inside outside} )
100
+ add_attributes HTML_ATTR_ALL
101
+ add_html_tag 'li'
102
+ def to_latex( options={} )
103
+ cmd = ''
104
+ cmd << "\n" if @crbefore
105
+ cmd << "\n\\item "
106
+ cmd << "[#{@attr[:text]}] " if @attr[:text].filled?
107
+ cmd << @content.to_doc(:latex, options)
108
+ cmd << "\n" if @crafter
109
+ return cmd
110
+ end
111
+ #Item is the same like in LaTeX,but we have to use to_context() for the sub-elements.
112
+ def to_context( options={} )
113
+ cmd = ''
114
+ cmd << "\n" if @crbefore
115
+ cmd << "\n\\item "
116
+ #~ cmd << "[#{@attr[:text]}] " if @attr[:text].filled? #fixme
117
+ cmd << @content.to_doc(:context, options)
118
+ cmd << "\n" if @crafter
119
+ return cmd
120
+ end
121
+ def to_text(options={})
122
+ cmd = ''
123
+ cmd << "\n" if @crbefore
124
+ cmd << "- #{@content.to_doc(:text, options)}"
125
+ cmd << "\n" if @crafter
126
+ return cmd
127
+ end
128
+ #fixme cascaded lists will not work!!
129
+ #each list will be on first level.
130
+ #- wanted: ** on level 2
131
+ #- no * if followed by another list.
132
+ def to_wiki(options={})
133
+ o = set_option_defaults(options)
134
+ o[:log].debug("enter to_latex for row") if o[:log].debug?
135
+ cmd = ''
136
+ #~ cmd << "\n" if @crbefore
137
+ case o[:parent] #check for class to get the item type
138
+ when Docgenerator::Lists::Itemize
139
+ cmd << "\n* #{@content.to_doc(:wiki, options)}"
140
+ when Docgenerator::Lists::Enumerate
141
+ cmd << "\n# #{@content.to_doc(:wiki, options)}"
142
+ else
143
+ o[:log].error(":li/wiki: Unknown list type #{o[:parent].inspect}") if o[:log].error?
144
+ cmd << "\n* #{@content.to_doc(:wiki, options)}"
145
+ end
146
+ #~ cmd << "\n" if cmd[-1,1] != "\n"
147
+ cmd << "\n" if @crafter and cmd[-1,1] != "\n"
148
+ return cmd
149
+ end
150
+ #
151
+ alias :to_creole :to_wiki #fixme/to_doc(:wiki falsch
152
+ end #Item
150
153
 
151
154
  =begin rdoc
152
- HTML:
153
- <dl>
154
- <dt> <dd>
155
- </dl>
155
+ HTML:
156
+ <dl>
157
+ <dt> <dd>
158
+ </dl>
156
159
 
157
160
  LaTeX:
158
161
  item with optional parameter.
159
162
  Should be used only inside List::Description.
160
163
  =end
161
- class DT < Element
162
- add_attributes HTML_ATTR_ALL
163
- add_html_tag 'dt'
164
- def to_text(options={}); "\n#{@content.to_doc(:text, options )}: " end
165
- def to_wiki(options={})
166
- cmd = ''
167
- cmd << "\n" if @crbefore
168
- cmd << "\n;#{@content.to_doc(:wiki, options )}"
169
- cmd << "\n"
170
- return cmd
171
- end
172
- def to_latex( options={} )
173
- cmd = ''
174
- cmd << "\n" if @crbefore
175
- cmd << "\n\\item[#{@content.to_doc(:latex, options)}] "
176
- cmd << "\n" if @crafter
177
- return cmd
178
- end
179
- end
164
+ class DT < Element
165
+ add_attributes HTML_ATTR_ALL
166
+ add_html_tag 'dt'
167
+ def to_text(options={}); "\n#{@content.to_doc(:text, options )}: " end
168
+ def to_wiki(options={})
169
+ cmd = ''
170
+ cmd << "\n" if @crbefore
171
+ cmd << "\n;#{@content.to_doc(:wiki, options )}"
172
+ cmd << "\n"
173
+ return cmd
174
+ end
175
+ def to_latex( options={} )
176
+ cmd = ''
177
+ cmd << "\n" if @crbefore
178
+ cmd << "\n\\item[#{@content.to_doc(:latex, options)}] "
179
+ cmd << "\n" if @crafter
180
+ return cmd
181
+ end
182
+ end
180
183
  =begin rdoc
181
- HTML:
182
- <dl>
183
- <dt> <dd>
184
- </dl>
184
+ HTML:
185
+ <dl>
186
+ <dt> <dd>
187
+ </dl>
185
188
 
186
189
  Data for a description list.
187
190
  =end
188
- class DD < Element
189
- add_attributes( HTML_ATTR_ALL )
190
- def htmltag(); 'dd'; end
191
- def to_text(options={}); "\n\t#{@content.to_doc(:text, options)}\n" end
192
- def to_wiki(options={})
193
- cmd = ''
194
- cmd << "\n" if @crbefore
195
- cmd << "\n:#{@content.to_doc(:wiki, options )}"
196
- cmd << "\n"
197
- return cmd
198
- end
199
- def to_latex( options={} )
200
- cmd = ''
201
- cmd << "\n" if @crbefore
202
- cmd << " #{@content.to_doc(:latex, options )} "
203
- cmd << "\n" if @crafter
204
- return cmd
205
- end
206
- end
207
- end #module Lists
191
+ class DD < Element
192
+ add_attributes( HTML_ATTR_ALL )
193
+ def htmltag(); 'dd'; end
194
+ def to_text(options={}); "\n\t#{@content.to_doc(:text, options)}\n" end
195
+ def to_wiki(options={})
196
+ cmd = ''
197
+ cmd << "\n" if @crbefore
198
+ cmd << "\n:#{@content.to_doc(:wiki, options )}"
199
+ cmd << "\n"
200
+ return cmd
201
+ end
202
+ def to_latex( options={} )
203
+ cmd = ''
204
+ cmd << "\n" if @crbefore
205
+ cmd << " #{@content.to_doc(:latex, options )} "
206
+ cmd << "\n" if @crafter
207
+ return cmd
208
+ end
209
+ end
210
+ end #module Lists
208
211
  end #module Docgenerator
@@ -1,23 +1,26 @@
1
+ #encoding: utf-8
2
+
3
+ #
1
4
  module Docgenerator
2
- module Packages
5
+ module Packages
3
6
  =begin rdoc
4
7
  Support of package hyperref.sty
5
8
  =end
6
- module Hyperref
9
+ module Hyperref
7
10
 
8
11
  =begin rdoc
9
12
  Dynamic PDF-Features
10
13
  =end
11
- class HyperrefForm < Environments::Environment
12
- add_attribute:options, Attribute.create( [ :latex ], [nil] )
13
- add_id :Form
14
-
15
- add_latex_output {| options = {} |
16
- option = "[#{@attr[:options].content.join(',')}]"
17
- option = nil if option == '[]'
18
- to_latex_environment( 'Form', option, options )
19
- }
20
- end
14
+ class HyperrefForm < Environments::Environment
15
+ add_attribute:options, Attribute.create( [ :latex ], [nil] )
16
+ add_id :Form
17
+
18
+ add_latex_output {| options = {} |
19
+ option = "[#{@attr[:options].content.join(',')}]"
20
+ option = nil if option == '[]'
21
+ to_latex_environment( 'Form', option, options )
22
+ }
23
+ end
21
24
 
22
25
  =begin rdoc
23
26
  Define Element :Reset
@@ -28,9 +31,9 @@ or
28
31
  Reset.new( [ attributes, [content]] )
29
32
  Attributes are not defined for this element.
30
33
  =end
31
- class Reset < Element
32
- add_latex_output '#{linebreak(@crbefore)}\Reset{#{@content}}#{linebreak(@crafter)}'
33
- end #Reset
34
+ class Reset < Element
35
+ add_latex_output '#{linebreak(@crbefore)}\Reset{#{@content}}#{linebreak(@crafter)}'
36
+ end #Reset
34
37
 
35
38
  =begin rdoc
36
39
  Define Element :CheckBox
@@ -44,13 +47,14 @@ Attributes may be:
44
47
  * :onclick:
45
48
  * :onblur:
46
49
  =end
47
- class Checkbox < Element
48
- add_attribute :name, Attribute.create( [ :texkeyval ] )
49
- add_attribute :onblur, Attribute.create( [ :texkeyval ] )
50
- add_attribute :onclick, Attribute.create( [ :texkeyval ] )
51
-
52
- add_latex_output '#{linebreak(@crbefore)}\CheckBox[#{texkeyval()}]{#{@content}}#{linebreak(@crafter)}'
53
- end #Checkbox
50
+ class Checkbox < Element
51
+ add_attribute :name, Attribute.create( [ :texkeyval ] )
52
+ add_attribute :checked, Attribute.create( [ :texkeyval ], [true,false] )
53
+ add_attribute :onblur, Attribute.create( [ :texkeyval ] )
54
+ add_attribute :onclick, Attribute.create( [ :texkeyval ] )
55
+
56
+ add_latex_output '#{linebreak(@crbefore)}\CheckBox[#{texkeyval()}]{#{@content}}#{linebreak(@crafter)}'
57
+ end #Checkbox
54
58
 
55
59
  =begin rdoc
56
60
  Define Element :PushButton
@@ -68,18 +72,18 @@ Attributes may be:
68
72
  * :color:
69
73
  * :backgroundcolor:
70
74
  =end
71
- class Pushbutton < Element
72
- add_attribute :width, Attribute.create( [ :texkeyval ], nil, 5) #regexp not supported - CSS_WIDTH
73
- add_attribute :height, Attribute.create( [ :texkeyval ], nil, 6) #regexp not supported - CSS_WIDTH
74
- add_attribute :borderstyle, Attribute.create( [ :texkeyval ], ['S', 'D', 'B', 'I', 'U'], 10 ) #S (solid, durchgehend), D (dashed, gestrichelt), B (beveled, erh�ht), I (inset, versenkt), U (unterstrichen)
75
- add_attribute :bordercolor, Attribute.create( [ :texkeyval ], nil, 11 )
76
- add_attribute :color, Attribute.create( [ :texkeyval ], nil, 15 )
77
- add_attribute :backgroundcolor, Attribute.create( [ :texkeyval ], nil, 15 )
78
- add_attribute :onclick, Attribute.create( [ :texkeyval ] )
79
- #~ :onload => Attribute.create( [ :texkeyval ] ), - niht definiert
80
- #~ :onmousemove => Attribute.create( [ :texkeyval ] ), nee, ghet nicht
81
- add_latex_output '#{linebreak(@crbefore)}\PushButton[#{texkeyval()}]{#{@content}}#{linebreak(@crafter)}'
82
- end #Pushbutton
75
+ class Pushbutton < Element
76
+ add_attribute :width, Attribute.create( [ :texkeyval ], nil, 5) #regexp not supported - CSS_WIDTH
77
+ add_attribute :height, Attribute.create( [ :texkeyval ], nil, 6) #regexp not supported - CSS_WIDTH
78
+ add_attribute :borderstyle, Attribute.create( [ :texkeyval ], ['S', 'D', 'B', 'I', 'U'], 10 ) #S (solid, durchgehend), D (dashed, gestrichelt), B (beveled, erhöht), I (inset, versenkt), U (unterstrichen)
79
+ add_attribute :bordercolor, Attribute.create( [ :texkeyval ], nil, 11 )
80
+ add_attribute :color, Attribute.create( [ :texkeyval ], nil, 15 )
81
+ add_attribute :backgroundcolor, Attribute.create( [ :texkeyval ], nil, 15 )
82
+ add_attribute :onclick, Attribute.create( [ :texkeyval ] )
83
+ #~ :onload => Attribute.create( [ :texkeyval ] ), - niht definiert
84
+ #~ :onmousemove => Attribute.create( [ :texkeyval ] ), nee, ghet nicht
85
+ add_latex_output '#{linebreak(@crbefore)}\PushButton[#{texkeyval()}]{#{@content}}#{linebreak(@crafter)}'
86
+ end #Pushbutton
83
87
 
84
88
  =begin rdoc
85
89
  Define Element :ChoiceMenu
@@ -100,19 +104,19 @@ Attributes may be:
100
104
  * :color:
101
105
  * :backgroundcolor:
102
106
  =end
103
- class Choicemenu < Element
104
- add_attribute :name, Attribute.create( [ :required ] )
105
- add_attribute :onblur, Attribute.create( [ :texkeyval ] )
106
- add_attribute :default, Attribute.create( [ :texkeyval ] )
107
- add_attribute :type, Attribute.create( [], ['combo', 'radiobutton'] )
108
- add_attribute :width, Attribute.create( [ :texkeyval ], nil, 5)#regexp not supported - CSS_WIDTH
109
- add_attribute :height, Attribute.create( [ :texkeyval ], nil, 6)#regexp not supported - CSS_WIDTH
110
- add_attribute :borderstyle, Attribute.create( [ :texkeyval ], ['S', 'D', 'B', 'I', 'U'], 10 )
111
- add_attribute :bordercolor, Attribute.create( [ :texkeyval ], nil, 11 )
112
- add_attribute :color, Attribute.create( [ :texkeyval ], nil, 15 )
113
- add_attribute :backgroundcolor, Attribute.create( [ :texkeyval ], nil, 15 )
114
- add_latex_output '#{linebreak(@crbefore)}\ChoiceMenu[#{@attr[:type]},#{texkeyval()}]{#{@attr[:name]}}{#{@content}}#{linebreak(@crafter)}'
115
- end #Choicemenu
107
+ class Choicemenu < Element
108
+ add_attribute :name, Attribute.create( [ :required ] )
109
+ add_attribute :onblur, Attribute.create( [ :texkeyval ] )
110
+ add_attribute :default, Attribute.create( [ :texkeyval ] )
111
+ add_attribute :type, Attribute.create( [], ['combo', 'radiobutton'] )
112
+ add_attribute :width, Attribute.create( [ :texkeyval ], nil, 5)#regexp not supported - CSS_WIDTH
113
+ add_attribute :height, Attribute.create( [ :texkeyval ], nil, 6)#regexp not supported - CSS_WIDTH
114
+ add_attribute :borderstyle, Attribute.create( [ :texkeyval ], ['S', 'D', 'B', 'I', 'U'], 10 )
115
+ add_attribute :bordercolor, Attribute.create( [ :texkeyval ], nil, 11 )
116
+ add_attribute :color, Attribute.create( [ :texkeyval ], nil, 15 )
117
+ add_attribute :backgroundcolor, Attribute.create( [ :texkeyval ], nil, 15 )
118
+ add_latex_output '#{linebreak(@crbefore)}\ChoiceMenu[#{@attr[:type]},#{texkeyval()}]{#{@attr[:name]}}{#{@content}}#{linebreak(@crafter)}'
119
+ end #Choicemenu
116
120
 
117
121
  =begin rdoc
118
122
  Define Element :TextField
@@ -140,29 +144,29 @@ Attributes may be:
140
144
  * :validate:
141
145
  * :format:
142
146
  =end
143
- class Textfield < Element
144
- add_attribute :onclick, Attribute.create( [ :texkeyval ] )
145
- add_attribute :onblur, Attribute.create( [ :texkeyval ] ) #Action, when value changed
146
- add_attribute :name, Attribute.create( [ :texkeyval ], [String, Symbol], 1 )
147
- add_attribute :password, Attribute.create( [ :texkeyval ], nil, 3) #Ausgabe als *****
148
- add_attribute :width, Attribute.create( [ :texkeyval ], nil, 5)
149
- add_attribute :height, Attribute.create( [ :texkeyval ], nil, 6)
150
- add_attribute :align, Attribute.create( [ :texkeyval ], [0,1,2], 7) #0=links, 1= center, 2 = right
151
- add_attribute :borderstyle, Attribute.create( [ :texkeyval ], ['S', 'D', 'B', 'I', 'U'], 10 )
152
- add_attribute :bordercolor, Attribute.create( [ :texkeyval ], nil, 11 )
153
- add_attribute :color, Attribute.create( [ :texkeyval ], nil, 15 )
154
- add_attribute :backgroundcolor, Attribute.create( [ :texkeyval ], nil, 15 )
155
- add_attribute :multiline, Attribute.create( [ :texkeyval ], [true,false], 30 )
156
- add_attribute :readonly, Attribute.create( [ :texkeyval ], [true,false], 31 )
157
- add_attribute :hidden, Attribute.create( [ :texkeyval ], [true,false], 31 )
158
- add_attribute :value, Attribute.create( [ :texkeyval ], [String, Array], 40 )
159
- add_attribute :validate, Attribute.create( [ :texkeyval ], [String, Array], 40 )#Validation rule
160
- add_attribute :format, Attribute.create( [ :texkeyval ], [String, Array], 40 )#Format rule
161
- add_latex_output '#{linebreak(@crbefore)}\TextField[#{texkeyval()}]{#{@content}}#{linebreak(@crafter)}'
162
- end #Textfield
163
-
164
- end #module Hyperref
165
- end #module Packages
147
+ class Textfield < Element
148
+ add_attribute :onclick, Attribute.create( [ :texkeyval ] )
149
+ add_attribute :onblur, Attribute.create( [ :texkeyval ] ) #Action, when value changed
150
+ add_attribute :name, Attribute.create( [ :texkeyval ], [String, Symbol], 1 )
151
+ add_attribute :password, Attribute.create( [ :texkeyval ], nil, 3) #Ausgabe als *****
152
+ add_attribute :width, Attribute.create( [ :texkeyval ], nil, 5)
153
+ add_attribute :height, Attribute.create( [ :texkeyval ], nil, 6)
154
+ add_attribute :align, Attribute.create( [ :texkeyval ], [0,1,2], 7) #0=links, 1= center, 2 = right
155
+ add_attribute :borderstyle, Attribute.create( [ :texkeyval ], ['S', 'D', 'B', 'I', 'U'], 10 )
156
+ add_attribute :bordercolor, Attribute.create( [ :texkeyval ], nil, 11 )
157
+ add_attribute :color, Attribute.create( [ :texkeyval ], nil, 15 )
158
+ add_attribute :backgroundcolor, Attribute.create( [ :texkeyval ], nil, 15 )
159
+ add_attribute :multiline, Attribute.create( [ :texkeyval ], [true,false], 30 )
160
+ add_attribute :readonly, Attribute.create( [ :texkeyval ], [true,false], 31 )
161
+ add_attribute :hidden, Attribute.create( [ :texkeyval ], [true,false], 31 )
162
+ add_attribute :value, Attribute.create( [ :texkeyval ], [String, Array], 40 )
163
+ add_attribute :validate, Attribute.create( [ :texkeyval ], [String, Array], 40 )#Validation rule
164
+ add_attribute :format, Attribute.create( [ :texkeyval ], [String, Array], 40 )#Format rule
165
+ add_latex_output '#{linebreak(@crbefore)}\TextField[#{texkeyval()}]{#{@content}}#{linebreak(@crafter)}'
166
+ end #Textfield
167
+
168
+ end #module Hyperref
169
+ end #module Packages
166
170
  end #module Docgenerator
167
171
  __END__
168
172
 
@@ -0,0 +1,33 @@
1
+ module Docgenerator
2
+ module Packages
3
+ =begin rdoc
4
+
5
+ Example:
6
+ =end
7
+ class Multicols < Environments::Environment
8
+ add_attributes( {
9
+ :colnum => Attribute.create( [:latex], [ Fixnum ], 1 ),
10
+ :titleline => Attribute.create( [:latex], [ String], 2 ),
11
+ }#.update(HTML_ATTR_ALL)
12
+ )
13
+
14
+ def to_latex(options = {})
15
+ cmd = ''
16
+ cmd << "\n" if @crbefore
17
+ cmd << "\\begin{multicols}{"
18
+ cmd << @attr[:colnum].content.first.to_s
19
+ cmd << "}"
20
+ cmd << "[#{@attr[:titleline].content.join}]" if @attr[:titleline].filled?
21
+ cmd << "\n" if @crmid
22
+ cmd << @content.to_doc(:latex, options )
23
+ cmd << "\\end{multicols}"
24
+ cmd << "\n" if @crafter
25
+ return cmd
26
+ end
27
+ #Definition for header.
28
+ def self.head()
29
+ element(:usepackage, {}, 'multicol').cr
30
+ end
31
+ end
32
+ end #module Packages
33
+ end #Docgenerator