docgenerator 1.2.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/build_test_and_doc.rb +505 -0
- data/examples/creole_example.rb +82 -0
- data/examples/creole_example_footnote.rb +67 -0
- data/examples/creole_example_placeholder.rb +77 -0
- data/examples/creole_example_rail.rb +154 -0
- data/examples/creole_example_rubycode.rb +144 -0
- data/examples/creole_example_struktex.rb +169 -0
- data/examples/docgenerator_example.rb +1 -1
- data/examples/docgenerator_example_footnote.rb +1 -0
- data/examples/docgenerator_example_list.rb +3 -0
- data/examples/docgenerator_example_restrictions.rb +1 -1
- data/examples/docgenerator_example_tabular.rb +1 -1
- data/examples/docgenerator_example_tripfalls.rb +2 -2
- data/examples/results/readme +2 -1
- data/examples/wiki2docgenerator_example.rb +61 -32
- data/lib/creole/creole2doc.rb +57 -58
- data/lib/creole/creole_characters.rb +56 -0
- data/lib/creole/creole_inclusion_and_plugins.rb +59 -284
- data/lib/creole/creole_inclusions.rb +142 -0
- data/lib/creole/creole_placeholder.rb +57 -23
- data/lib/creole/creole_plugins.rb +198 -0
- data/lib/creole/creole_tabular.rb +16 -8
- data/lib/creole/plugins/rail.rb +182 -0
- data/lib/creole/plugins/rubycode4creole.rb +136 -0
- data/lib/creole/plugins/struktex.rb +59 -0
- data/lib/creole/plugins/todonotes.rb +70 -0
- data/lib/docgenerator.rb +161 -71
- data/lib/docgenerator/attribute.rb +189 -156
- data/lib/docgenerator/characters.rb +824 -267
- data/lib/docgenerator/compatibility_v1.rb +249 -0
- data/lib/docgenerator/css.rb +53 -32
- data/lib/docgenerator/document.rb +119 -56
- data/lib/docgenerator/element.rb +304 -351
- data/lib/docgenerator/element_meta.rb +303 -0
- data/lib/docgenerator/elements.rb +1112 -481
- data/lib/docgenerator/environments.rb +153 -62
- data/lib/docgenerator/footnote.rb +30 -9
- data/lib/docgenerator/lists.rb +71 -47
- data/lib/docgenerator/packages/attachfile.rb +136 -0
- data/lib/{packages/docgenerator_caption.rb → docgenerator/packages/caption.rb} +28 -19
- data/lib/docgenerator/packages/hyperref.rb +194 -0
- data/lib/docgenerator/packages/listings.rb +179 -0
- data/lib/docgenerator/packages/pdfpages.rb +43 -0
- data/lib/docgenerator/packages/rubycode4doc.rb +227 -0
- data/lib/{packages/docgenerator_scrlettr2.rb → docgenerator/packages/scrlettr2.rb} +25 -16
- data/lib/docgenerator/packages/scrpage2.rb +410 -0
- data/lib/docgenerator/packages/struktex.rb +447 -0
- data/lib/docgenerator/packages/todonotes.rb +85 -0
- data/lib/{packages/docgenerator_url.rb → docgenerator/packages/url.rb} +7 -6
- data/lib/docgenerator/sections.rb +257 -83
- data/lib/docgenerator/standard.rb +19 -11
- data/lib/docgenerator/tabular.rb +234 -118
- data/lib/{templates → docgenerator/templates}/docgenerator_template.rb +52 -44
- data/lib/{templates → docgenerator/templates}/docgenerator_template.yaml +0 -0
- data/lib/{templates → docgenerator/templates}/docgenerator_template_css.rb +22 -16
- data/lib/wiki2doc/plugins/rubycode4wiki.rb +53 -0
- data/lib/wiki2doc/plugins/struktex.rb +12 -0
- data/lib/wiki2doc/wiki2docgenerator.rb +39 -38
- data/lib/wiki2doc/wikimedia_document.rb +24 -0
- data/manpage_elements.rb +10411 -0
- data/readme.rd +34 -24
- data/unittest/creole_testtext.creole +11 -0
- data/unittest/expected/test_document_usepackage_undefined.log +2 -2
- data/unittest/expected/test_runtex.stdout +0 -1
- data/unittest/expected/test_runtex_2.stdout +0 -1
- data/unittest/expected/toc_css.css +3 -2
- data/unittest/expected_creole/test_creole_characters_all.creole +28 -0
- data/unittest/expected_creole/test_creole_characters_all.html +15 -15
- data/unittest/expected_creole/test_creole_characters_all.latex +15 -15
- data/unittest/expected_creole/test_creole_footnotes_groupid.html +15 -0
- data/unittest/expected_creole/test_creole_links_file.html +2 -2
- data/unittest/expected_creole/test_creole_links_file.latex +2 -2
- data/unittest/expected_creole/test_creole_links_file.text +2 -2
- data/unittest/expected_creole/test_creole_picture_link.html +1 -1
- data/unittest/expected_creole_rail/test_rail_creole_object.tex +33 -0
- data/unittest/expected_creole_rail/test_rail_creole_placeholder.tex +40 -0
- data/unittest/expected_rubycode4doc/creole_complete.html +26 -0
- data/unittest/expected_rubycode4doc/creole_complete.tex +40 -0
- data/unittest/expected_rubycode4doc/creole_in_tab.html +4 -0
- data/unittest/expected_rubycode4doc/creole_in_tab.tex +6 -0
- data/unittest/expected_rubycode4doc/creole_inline_ruby.html +7 -0
- data/unittest/expected_rubycode4doc/creole_output.html +2 -0
- data/unittest/expected_rubycode4doc/creole_output.tex +4 -0
- data/unittest/expected_rubycode4doc/creole_rubycode.html +1 -0
- data/unittest/expected_rubycode4doc/creole_rubycode.tex +3 -0
- data/unittest/expected_rubycode4doc/creole_rubycode_evaluated.html +1 -0
- data/unittest/expected_rubycode4doc/creole_rubycode_evaluated.tex +3 -0
- data/unittest/expected_rubycode4doc/creole_rubycode_evaluated_listings.html +3 -0
- data/unittest/expected_rubycode4doc/creole_rubycode_evaluated_listings.tex +5 -0
- data/unittest/expected_rubycode4doc/wiki_1.html +8 -0
- data/unittest/expected_rubycode4doc/wiki_2.html +8 -0
- data/unittest/expected_rubycode4doc/wiki_3.html +9 -0
- data/unittest/expected_rubycode4doc/wiki_immediate_1.html +5 -0
- data/unittest/expected_rubycode4doc/wiki_immediate_2.html +5 -0
- data/unittest/expected_rubycode4doc/wiki_immediate_3.html +8 -0
- data/unittest/expected_rubycode4doc/wiki_immediate_full.html +21 -0
- data/unittest/expected_struktex/test_struktex_krug.creole +15 -0
- data/unittest/expected_struktex/test_struktex_krug.tex +19 -0
- data/unittest/expected_struktex/test_struktex_krug.wiki +15 -0
- data/unittest/expected_struktex/test_struktex_statement.creole +7 -0
- data/unittest/expected_struktex/test_struktex_statement.tex +9 -0
- data/unittest/expected_struktex/test_struktex_statement.wiki +7 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.html +1 -1
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.latex +1 -1
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.text +1 -1
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.wiki +1 -1
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote_2.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote_groupid.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_label.html +0 -0
- data/unittest/expected_wikimedia/test_wiki_link.html +8 -0
- data/unittest/expected_wikimedia/test_wiki_link.latex +17 -0
- data/unittest/expected_wikimedia/test_wiki_link.wiki +11 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.wiki +0 -0
- data/unittest/expected_wikimedia/test_wiki_picture.html +55 -0
- data/unittest/expected_wikimedia/test_wiki_picture.latex +76 -0
- data/unittest/expected_wikimedia/test_wiki_picture_thumb.html +5 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_tab1.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_tab1.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_tab1.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.wiki +0 -0
- data/unittest/{unittest_creole2doc.rb → unittest_creole.rb} +385 -476
- data/unittest/unittest_creole_placeholders.rb +272 -0
- data/unittest/unittest_creole_plugin_rail.rb +147 -0
- data/unittest/unittest_docgenerator.rb +206 -332
- data/unittest/unittest_docgenerator_characters.rb +650 -0
- data/unittest/unittest_docgenerator_runtex.rb +48 -20
- data/unittest/unittest_packages_struktex.rb +187 -0
- data/unittest/unittest_rubycode4doc.rb +275 -0
- data/unittest/unittest_wikimedia.rb +479 -0
- metadata +245 -172
- data/examples/results_expected/docgenerator_example.html +0 -39
- data/examples/results_expected/docgenerator_example.pdf +0 -0
- data/examples/results_expected/docgenerator_example.tex +0 -56
- data/examples/results_expected/docgenerator_example_footnote.html +0 -40
- data/examples/results_expected/docgenerator_example_footnote.pdf +0 -0
- data/examples/results_expected/docgenerator_example_footnote.tex +0 -50
- data/examples/results_expected/docgenerator_example_list.html +0 -18
- data/examples/results_expected/docgenerator_example_list.pdf +0 -0
- data/examples/results_expected/docgenerator_example_list.tex +0 -46
- data/examples/results_expected/docgenerator_example_restrictions.html +0 -22
- data/examples/results_expected/docgenerator_example_restrictions.pdf +0 -0
- data/examples/results_expected/docgenerator_example_restrictions.tex +0 -31
- data/examples/results_expected/docgenerator_example_tabular.html +0 -37
- data/examples/results_expected/docgenerator_example_tabular.pdf +0 -0
- data/examples/results_expected/docgenerator_example_tabular.tex +0 -41
- data/examples/results_expected/docgenerator_example_tripfalls.html +0 -27
- data/examples/results_expected/docgenerator_example_tripfalls.pdf +0 -0
- data/examples/results_expected/docgenerator_example_tripfalls.tex +0 -31
- data/lib/packages/docgenerator_attachfile.rb +0 -71
- data/lib/packages/docgenerator_hyperref.rb +0 -109
- data/lib/packages/docgenerator_listings.rb +0 -103
- data/lib/packages/docgenerator_pdfpages.rb +0 -24
- data/lib/packages/docgenerator_scrpage2.rb +0 -172
- data/self_docgenerator.rb +0 -163
- data/unittest/expected_wiki/test_wiki_link.html +0 -8
- data/unittest/expected_wiki/test_wiki_link.latex +0 -17
- data/unittest/expected_wiki/test_wiki_link.wiki +0 -11
- data/unittest/expected_wiki/test_wiki_picture.html +0 -55
- data/unittest/expected_wiki/test_wiki_picture.latex +0 -76
- data/unittest/expected_wiki/test_wiki_picture_thumb.html +0 -5
- data/unittest/test_rakefile_docgenerator.rb +0 -43
- data/unittest/unittest_versions.rb +0 -44
- data/unittest/unittest_wiki2doc.rb +0 -464
|
@@ -1,30 +1,60 @@
|
|
|
1
|
+
module Docgenerator
|
|
2
|
+
=begin rdoc
|
|
3
|
+
Collection of Environments.
|
|
4
|
+
|
|
5
|
+
Enviroment are special LaTeX-constructs.
|
|
6
|
+
|
|
7
|
+
Instead
|
|
8
|
+
\makro{content}
|
|
9
|
+
environments are coded as
|
|
10
|
+
\begin{makro}
|
|
11
|
+
content
|
|
12
|
+
\end{makro}
|
|
13
|
+
=end
|
|
14
|
+
module Environments
|
|
15
|
+
=begin rdoc
|
|
16
|
+
Define Element :environment
|
|
17
|
+
|
|
18
|
+
This class is used for further class definitions.
|
|
19
|
+
Only for LaTeX
|
|
20
|
+
|
|
21
|
+
Create an instance with
|
|
22
|
+
element( :environment, [ attributes, [content]] )
|
|
23
|
+
or
|
|
24
|
+
Environment.new( [ attributes, [content]] )
|
|
25
|
+
=end
|
|
1
26
|
class Environment < Element
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
27
|
+
=begin rdoc
|
|
28
|
+
Parameters are given as a string (or anything what gives a String with to_s).
|
|
29
|
+
|
|
30
|
+
It is difficult to make a generic parameter interface.
|
|
31
|
+
|
|
32
|
+
If needed, redefine the method.
|
|
33
|
+
=end
|
|
6
34
|
def to_latex_environment( environment, parameter = nil, options={})
|
|
7
35
|
cmd = ''
|
|
8
36
|
cmd << "\n" if @crbefore
|
|
9
37
|
cmd << "\n\\begin{#{environment}}"
|
|
10
38
|
cmd << parameter.to_s if parameter
|
|
11
39
|
cmd << "\n" if @crmid
|
|
12
|
-
cmd << @content.to_latex
|
|
40
|
+
cmd << @content.to_latex(options)
|
|
13
41
|
cmd << "\n" if @crmid and cmd[-1,1] != "\n"
|
|
14
42
|
cmd << "\\end{#{environment}}\n"
|
|
15
43
|
cmd << "\n" if @crafter
|
|
16
44
|
return cmd
|
|
17
45
|
end
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
46
|
+
=begin rdoc
|
|
47
|
+
ConTeXt-environments start with start and end with stop.
|
|
48
|
+
|
|
49
|
+
Fixme: Parameters
|
|
50
|
+
=end
|
|
21
51
|
def to_context_environment( environment, parameter = nil, options={})
|
|
22
52
|
cmd = ''
|
|
23
53
|
cmd << "\n" if @crbefore
|
|
24
54
|
cmd << "\n\\start#{environment}"
|
|
25
55
|
cmd << parameter.to_s if parameter
|
|
26
56
|
cmd << "\n" if @crmid
|
|
27
|
-
cmd << @content.to_latex
|
|
57
|
+
cmd << @content.to_latex(options)
|
|
28
58
|
#~ cmd << "\n" if @crmid and cmd[-1,1] != "\n"
|
|
29
59
|
cmd << "\n\\stop#{environment}\n"
|
|
30
60
|
cmd << "\n" if @crafter
|
|
@@ -32,56 +62,94 @@ class Environment < Element
|
|
|
32
62
|
end #~ def htmltag()
|
|
33
63
|
#~ return 'table'
|
|
34
64
|
#~ end
|
|
35
|
-
#~ def to_latex( )
|
|
36
|
-
#~ return to_latex_environment( 'itemize' )
|
|
65
|
+
#~ def to_latex( options={} )
|
|
66
|
+
#~ return to_latex_environment( 'itemize', nil, options )
|
|
37
67
|
#~ end
|
|
38
68
|
end
|
|
39
69
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
70
|
+
=begin rdoc
|
|
71
|
+
Define Element :minipage
|
|
72
|
+
|
|
73
|
+
Create an instance with
|
|
74
|
+
element( :minipage, [ attributes, [content]] )
|
|
75
|
+
or
|
|
76
|
+
Minipage.new( [ attributes, [content]] )
|
|
77
|
+
Attributes may be:
|
|
78
|
+
* :width:
|
|
79
|
+
=end
|
|
80
|
+
class Minipage < Element
|
|
81
|
+
add_attribute :width, Attribute.create( [ :latex, :html ], [ String ] )
|
|
82
|
+
add_html_tag 'div'
|
|
83
|
+
add_latex_output '#{linebreak(@crbefore)}' +
|
|
44
84
|
'\begin{minipage}{#{@attr[:width]}}' + '#{linebreak(@crmid)}' +
|
|
45
85
|
'#{@content}' + '#{linebreak(@crmid)}' +
|
|
46
|
-
'\end{minipage}' + '#{linebreak(@crafter)}'
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
86
|
+
'\end{minipage}' + '#{linebreak(@crafter)}'
|
|
87
|
+
end #Minipage
|
|
88
|
+
|
|
89
|
+
=begin rdoc
|
|
90
|
+
Define Element :center
|
|
91
|
+
|
|
92
|
+
Create an instance with
|
|
93
|
+
element( :center, [ attributes, [content]] )
|
|
94
|
+
or
|
|
95
|
+
Center.new( [ attributes, [content]] )
|
|
96
|
+
Attributes may be:
|
|
97
|
+
* HTML_ATTR_CORE
|
|
98
|
+
|
|
99
|
+
=end
|
|
100
|
+
class Center < Element
|
|
101
|
+
add_attributes HTML_ATTR_CORE
|
|
102
|
+
add_html_tag 'center'
|
|
103
|
+
add_latex_output '#{linebreak(@crbefore)}\begin{center}#{linebreak(@crmid)}#{@content}#{linebreak(@crmid)}\end{center}#{linebreak(@crafter)}'
|
|
104
|
+
end #Center
|
|
105
|
+
|
|
106
|
+
=begin rdoc
|
|
107
|
+
Define Element :quote, :blockquote
|
|
108
|
+
|
|
109
|
+
Create an instance with
|
|
110
|
+
element( :quote, [ attributes, [content]] )
|
|
111
|
+
element( :blockquote, [ attributes, [content]] )
|
|
112
|
+
or
|
|
113
|
+
Quote.new( [ attributes, [content]] )
|
|
114
|
+
Attributes may be:
|
|
115
|
+
* HTML_ATTR_CORE
|
|
116
|
+
=end
|
|
117
|
+
class Quote < Element
|
|
118
|
+
add_id :blockquote
|
|
119
|
+
add_attributes HTML_ATTR_CORE
|
|
120
|
+
add_html_tag 'blockquote'
|
|
121
|
+
add_latex_output '#{linebreak(@crbefore)}\begin{quote}#{linebreak(@crmid)}#{@content}#{linebreak(@crmid)}\end{quote}#{linebreak(@crafter)}'
|
|
122
|
+
end #Quote
|
|
123
|
+
|
|
124
|
+
=begin rdoc
|
|
125
|
+
Define Element :landscape
|
|
126
|
+
|
|
127
|
+
Only LaTeX
|
|
128
|
+
|
|
129
|
+
Create an instance with
|
|
130
|
+
element( :landscape, [ attributes, [content]] )
|
|
131
|
+
or
|
|
132
|
+
Landscape.new( [ attributes, [content]] )
|
|
133
|
+
Attributes are not defined for this element.
|
|
134
|
+
=end
|
|
135
|
+
class Landscape < Element
|
|
136
|
+
add_latex_output '#{linebreak(@crbefore)}\begin{landscape}#{linebreak(@crmid)}#{@content}#{linebreak(@crmid)}\end{landscape}#{linebreak(@crafter)}'
|
|
137
|
+
end #Landscape
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
=begin rdoc
|
|
141
|
+
Environment Verbatim
|
|
142
|
+
|
|
143
|
+
See also Elements::Verb
|
|
144
|
+
=end
|
|
76
145
|
class Verbatim < Environment
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
#~ def htmltag(); 'pre' end
|
|
146
|
+
add_attribute :width, Attribute.create( [ :html ], [Integer], 1 ) #Number of characters
|
|
147
|
+
add_attributes HTML_ATTR_ALL
|
|
148
|
+
add_id :pre
|
|
149
|
+
=begin rdoc
|
|
150
|
+
=end
|
|
83
151
|
def to_html(options = {})
|
|
84
|
-
o =
|
|
152
|
+
o = set_option_defaults(options)
|
|
85
153
|
html = String.new()
|
|
86
154
|
html << "\n" if @crbefore
|
|
87
155
|
html << "<pre"
|
|
@@ -98,22 +166,45 @@ class Verbatim < Environment
|
|
|
98
166
|
return html
|
|
99
167
|
end #to_html
|
|
100
168
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
169
|
+
=begin rdoc
|
|
170
|
+
=end
|
|
171
|
+
def to_text(options = {}); "#{@content.join}" end
|
|
172
|
+
=begin rdoc
|
|
173
|
+
=end
|
|
174
|
+
def to_wiki(options = {} ); " #{@content.join}" end
|
|
175
|
+
=begin rdoc
|
|
176
|
+
=end
|
|
177
|
+
def to_creole(options = {} ); "{{{\n#{@content.join}\n}}}" end
|
|
178
|
+
=begin rdoc
|
|
179
|
+
=end
|
|
180
|
+
def to_latex(options = {} )
|
|
181
|
+
return to_latex_environment( 'verbatim', nil, options )
|
|
105
182
|
end
|
|
106
183
|
end
|
|
107
184
|
|
|
185
|
+
=begin rdoc
|
|
186
|
+
=end
|
|
108
187
|
class Figure < Environment
|
|
109
|
-
add_attributes
|
|
110
|
-
Element.add( [:figure], Figure)
|
|
188
|
+
add_attributes HTML_ATTR_ALL
|
|
111
189
|
def htmltag(); 'div'; end
|
|
112
190
|
def to_latex( options = {} )
|
|
113
|
-
return to_latex_environment( 'figure', options
|
|
191
|
+
return to_latex_environment( 'figure', nil, options )
|
|
114
192
|
end
|
|
115
193
|
end
|
|
116
194
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
195
|
+
=begin rdoc
|
|
196
|
+
Environment Abstract.
|
|
197
|
+
|
|
198
|
+
Only LaTeX
|
|
199
|
+
=end
|
|
200
|
+
class Abstract < Environment
|
|
201
|
+
#~ add_attributes( HTML_ATTR_ALL )
|
|
202
|
+
#~ def htmltag(); ''; end
|
|
203
|
+
=begin rdoc
|
|
204
|
+
=end
|
|
205
|
+
def to_latex( options = {} )
|
|
206
|
+
return to_latex_environment( 'abstract', nil, options )
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
end #module Environments
|
|
210
|
+
end #module Docgenerator
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
module Docgenerator
|
|
1
2
|
=begin rdoc
|
|
2
3
|
Footnotegroup.
|
|
3
4
|
|
|
4
|
-
A Footnote without group-attribute get it
|
|
5
|
+
A Footnote without group-attribute get it's own Footnotegroup.
|
|
5
6
|
For LaTeX it is ok, for HTML the content of the footnote will disappear.
|
|
6
7
|
=end
|
|
7
8
|
class Footnotegroup
|
|
@@ -42,9 +43,9 @@ Build a new footnote group.
|
|
|
42
43
|
ul = element(:p, @attr ).cr
|
|
43
44
|
@footnotes.each{|f|
|
|
44
45
|
#~ ul << element(:sup, {}, f.counter )
|
|
45
|
-
ul << footnotemark = element(:sup)
|
|
46
|
+
ul << footnotemark = element(:sup, { :log => options[:log] })
|
|
46
47
|
if @html_link
|
|
47
|
-
footnotemark << element(:label, { :name => "#{f.link}" }, f.label )
|
|
48
|
+
footnotemark << element(:label, { :name => "#{f.link}", :log => options[:log] }, f.label )
|
|
48
49
|
else
|
|
49
50
|
footnotemark << f.label
|
|
50
51
|
end
|
|
@@ -56,10 +57,12 @@ Build a new footnote group.
|
|
|
56
57
|
end #Footnotegroup
|
|
57
58
|
|
|
58
59
|
=begin rdoc
|
|
59
|
-
|
|
60
|
+
A Footnote.
|
|
61
|
+
|
|
62
|
+
==HTML
|
|
63
|
+
Footnotes should be assigned to a Footnotegroup
|
|
60
64
|
=end
|
|
61
65
|
class Footnote < Element
|
|
62
|
-
Element.add( [:footnote ], Footnote)
|
|
63
66
|
add_attributes( {
|
|
64
67
|
:label => Attribute.create(),
|
|
65
68
|
:group => Attribute.create([:required], [Footnotegroup] )
|
|
@@ -117,9 +120,27 @@ class Footnote < Element
|
|
|
117
120
|
end
|
|
118
121
|
end #Footnote
|
|
119
122
|
|
|
123
|
+
=begin rdoc
|
|
124
|
+
Define Element :footnotemark
|
|
125
|
+
|
|
126
|
+
Create an instance with
|
|
127
|
+
element( :footnotemark, [ attributes, [content]] )
|
|
128
|
+
or
|
|
129
|
+
Footnotemark.new( [ attributes, [content]] )
|
|
130
|
+
Attributes may be:
|
|
131
|
+
* HTML_ATTR_CORE
|
|
132
|
+
* HTML_ATTR_I18N
|
|
133
|
+
* HTML_ATTR_EVENTS
|
|
134
|
+
* :lang, ATTR_LANG
|
|
135
|
+
=end
|
|
136
|
+
class Footnotemark < Element
|
|
137
|
+
add_attributes HTML_ATTR_CORE
|
|
138
|
+
add_attributes HTML_ATTR_I18N
|
|
139
|
+
add_attributes HTML_ATTR_EVENTS
|
|
140
|
+
add_attribute :lang, ATTR_LANG
|
|
141
|
+
add_html_tag 'sup'
|
|
142
|
+
add_latex_output '#{linebreak(@crbefore)}\footnotemark[#{@content}]#{linebreak(@crafter)}'
|
|
143
|
+
end #Footnotemark
|
|
120
144
|
|
|
121
|
-
Element.create( [:footnotemark ], {}.update(HTML_ATTR_ALL),true,
|
|
122
|
-
{ :htmltag => 'sup',
|
|
123
|
-
:latex => '#{linebreak(@crbefore)}\footnotemark[#{@content.to_latex}]#{linebreak(@crafter)}' #fixme
|
|
124
|
-
} )
|
|
125
145
|
|
|
146
|
+
end #module Docgenerator
|
data/lib/docgenerator/lists.rb
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
module Docgenerator
|
|
2
|
+
module Lists
|
|
3
|
+
=begin rdoc
|
|
4
|
+
Generic class for list environments.
|
|
1
5
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
6
|
+
Used to define Itemize, Enumerate...
|
|
7
|
+
=end
|
|
8
|
+
class ListEnvironment < Environments::Environment
|
|
5
9
|
add_attributes( HTML_ATTR_ALL )
|
|
6
10
|
#Only items are allowed to be added.
|
|
7
11
|
#
|
|
@@ -13,22 +17,25 @@ class ListEnvironment < Environment
|
|
|
13
17
|
if self.class == Description
|
|
14
18
|
#fixme: Reihenfolge
|
|
15
19
|
if ! ( item.is_a?( Element.get(:dt) ) or item.is_a?( Element.get(:dd) ) )
|
|
16
|
-
@log.warn("Add non-item to list (#{item.
|
|
20
|
+
@log.warn("Add non-item to list (#{item.inspect})") if @log.warn
|
|
17
21
|
end
|
|
18
22
|
elsif ! item.is_a?( Element.get(:item) )
|
|
19
|
-
@log.warn("Add non-item to list (#{item.
|
|
23
|
+
@log.warn("Add non-item to list (#{item.inspect})") if @log.warn
|
|
20
24
|
end
|
|
21
25
|
@content << item
|
|
22
26
|
end
|
|
23
27
|
end
|
|
24
28
|
#Add parent-information to options. This is used by the list elements to get the list type.
|
|
25
29
|
def to_doc( target, options = {} )
|
|
26
|
-
o =
|
|
30
|
+
o = set_option_defaults(options)
|
|
27
31
|
o[:log].debug("enter to_doc for #{self.inspect}") if o[:log].debug?
|
|
28
32
|
options[:parent] = self
|
|
29
33
|
super
|
|
30
34
|
end
|
|
31
|
-
def to_wiki( options={} )
|
|
35
|
+
def to_wiki( options= {} )
|
|
36
|
+
return "#{@content.to_doc(:wiki, options)}\n".gsub(/\n\n/, "\n")
|
|
37
|
+
end
|
|
38
|
+
def to_creole( options= {} )
|
|
32
39
|
return "#{@content.to_doc(:wiki, options)}\n".gsub(/\n\n/, "\n")
|
|
33
40
|
end
|
|
34
41
|
def to_text( options={} )
|
|
@@ -36,9 +43,12 @@ class ListEnvironment < Environment
|
|
|
36
43
|
end
|
|
37
44
|
end
|
|
38
45
|
|
|
46
|
+
=begin rdoc
|
|
47
|
+
Unnumbered list
|
|
48
|
+
=end
|
|
39
49
|
class Itemize < ListEnvironment
|
|
40
|
-
add_attributes
|
|
41
|
-
|
|
50
|
+
add_attributes HTML_ATTR_ALL
|
|
51
|
+
add_id :ul
|
|
42
52
|
def htmltag(); 'ul'; end
|
|
43
53
|
def to_latex( options={} )
|
|
44
54
|
return to_latex_environment( 'itemize', nil, options )
|
|
@@ -47,10 +57,13 @@ class Itemize < ListEnvironment
|
|
|
47
57
|
return to_context_environment( 'itemize', '[1]', options )
|
|
48
58
|
end
|
|
49
59
|
end
|
|
60
|
+
=begin rdoc
|
|
61
|
+
Numbered lists.
|
|
62
|
+
=end
|
|
50
63
|
class Enumerate < ListEnvironment
|
|
51
|
-
add_attributes
|
|
52
|
-
|
|
53
|
-
|
|
64
|
+
add_attributes HTML_ATTR_ALL
|
|
65
|
+
add_id :ol
|
|
66
|
+
add_html_tag 'ol'
|
|
54
67
|
def to_latex( options={} )
|
|
55
68
|
return to_latex_environment( 'enumerate', nil, options )
|
|
56
69
|
end
|
|
@@ -58,33 +71,32 @@ class Enumerate < ListEnvironment
|
|
|
58
71
|
return to_context_environment( 'itemize', '[n]', options )
|
|
59
72
|
end
|
|
60
73
|
end
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
|
|
75
|
+
=begin rdoc
|
|
76
|
+
HTML:
|
|
77
|
+
<dl>
|
|
78
|
+
<dt> <dd>
|
|
79
|
+
</dl>
|
|
80
|
+
=end
|
|
67
81
|
class Description < ListEnvironment
|
|
68
82
|
add_attributes( HTML_ATTR_ALL )
|
|
69
|
-
|
|
70
|
-
|
|
83
|
+
add_id :dl
|
|
84
|
+
add_html_tag 'dl'
|
|
71
85
|
def to_latex( options={} )
|
|
72
86
|
return to_latex_environment( 'description', nil, options )
|
|
73
87
|
end
|
|
74
88
|
end
|
|
75
89
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
90
|
+
=begin rdoc
|
|
91
|
+
Item line in a list.
|
|
92
|
+
|
|
93
|
+
The look will be defined by the environment where it is in (itemize/ul, enumerate/ol)
|
|
94
|
+
=end
|
|
81
95
|
class Item < Element
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
)
|
|
87
|
-
def htmltag(); 'li'; end
|
|
96
|
+
add_id :li
|
|
97
|
+
add_attribute :text, Attribute.create( [ :latex ] )
|
|
98
|
+
add_attributes HTML_ATTR_ALL
|
|
99
|
+
add_html_tag 'li'
|
|
88
100
|
def to_latex( options={} )
|
|
89
101
|
cmd = ''
|
|
90
102
|
cmd << "\n" if @crbefore
|
|
@@ -115,14 +127,14 @@ class Item < Element
|
|
|
115
127
|
#- ** auf stufe 2
|
|
116
128
|
#- kein * wenn als n�chstes eine Liste kommt.
|
|
117
129
|
def to_wiki(options={})
|
|
118
|
-
o =
|
|
130
|
+
o = set_option_defaults(options)
|
|
119
131
|
o[:log].debug("enter to_latex for row") if o[:log].debug?
|
|
120
132
|
cmd = ''
|
|
121
133
|
#~ cmd << "\n" if @crbefore
|
|
122
|
-
case o[:parent]
|
|
123
|
-
when
|
|
134
|
+
case o[:parent] #check for class to get the item type
|
|
135
|
+
when Docgenerator::Lists::Itemize
|
|
124
136
|
cmd << "\n* #{@content.to_doc(:wiki, options)}"
|
|
125
|
-
when
|
|
137
|
+
when Docgenerator::Lists::Enumerate
|
|
126
138
|
cmd << "\n# #{@content.to_doc(:wiki, options)}"
|
|
127
139
|
else
|
|
128
140
|
o[:log].error(":li/wiki: Unknown list type #{o[:parent].inspect}") if o[:log].error?
|
|
@@ -132,16 +144,23 @@ class Item < Element
|
|
|
132
144
|
cmd << "\n" if @crafter and cmd[-1,1] != "\n"
|
|
133
145
|
return cmd
|
|
134
146
|
end
|
|
147
|
+
#
|
|
148
|
+
alias :to_creole :to_wiki #fixme/to_doc(:wiki falsch
|
|
135
149
|
end #Item
|
|
136
150
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
151
|
+
=begin rdoc
|
|
152
|
+
HTML:
|
|
153
|
+
<dl>
|
|
154
|
+
<dt> <dd>
|
|
155
|
+
</dl>
|
|
156
|
+
|
|
157
|
+
LaTeX:
|
|
158
|
+
item with optional parameter.
|
|
159
|
+
Should be used only inside List::Description.
|
|
160
|
+
=end
|
|
141
161
|
class DT < Element
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
def htmltag(); 'dt'; end
|
|
162
|
+
add_attributes HTML_ATTR_ALL
|
|
163
|
+
add_html_tag 'dt'
|
|
145
164
|
def to_text(options={}); "\n#{@content.to_doc(:text, options )}: " end
|
|
146
165
|
def to_wiki(options={})
|
|
147
166
|
cmd = ''
|
|
@@ -158,12 +177,15 @@ class DT < Element
|
|
|
158
177
|
return cmd
|
|
159
178
|
end
|
|
160
179
|
end
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
180
|
+
=begin rdoc
|
|
181
|
+
HTML:
|
|
182
|
+
<dl>
|
|
183
|
+
<dt> <dd>
|
|
184
|
+
</dl>
|
|
185
|
+
|
|
186
|
+
Data for a description list.
|
|
187
|
+
=end
|
|
165
188
|
class DD < Element
|
|
166
|
-
Element.add( [:dd], DD)
|
|
167
189
|
add_attributes( HTML_ATTR_ALL )
|
|
168
190
|
def htmltag(); 'dd'; end
|
|
169
191
|
def to_text(options={}); "\n\t#{@content.to_doc(:text, options)}\n" end
|
|
@@ -182,3 +204,5 @@ class DD < Element
|
|
|
182
204
|
return cmd
|
|
183
205
|
end
|
|
184
206
|
end
|
|
207
|
+
end #module Lists
|
|
208
|
+
end #module Docgenerator
|