docgenerator 1.2.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -2,10 +2,9 @@
|
|
2
2
|
if ! defined?( Document )
|
3
3
|
require 'docgenerator'
|
4
4
|
end
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
#-Stummfilm/Bezugsquellen
|
5
|
+
|
6
|
+
module Docgenerator
|
7
|
+
module Packages
|
9
8
|
|
10
9
|
#
|
11
10
|
#Small Administration class for websites and their description
|
@@ -39,8 +38,8 @@ class Url
|
|
39
38
|
def to_s()
|
40
39
|
return "#{self.url()}"
|
41
40
|
end
|
42
|
-
def
|
43
|
-
return element(:a, {:href=>self.url}, self.linktext())
|
41
|
+
def to_doc(target, attr = {})
|
42
|
+
return element(:a, {:href=>self.url}, self.linktext()).to_doc(target, attr)
|
44
43
|
end
|
45
44
|
#Output with all details.
|
46
45
|
#The ctrl-hash contains all elements which should be included.
|
@@ -80,3 +79,5 @@ class Url
|
|
80
79
|
return li_list
|
81
80
|
end
|
82
81
|
end
|
82
|
+
end #module Packages
|
83
|
+
end #module Docgenerator
|
@@ -2,95 +2,269 @@
|
|
2
2
|
#Headings and sectioning
|
3
3
|
#
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
if $0 == __FILE__
|
6
|
+
$:.unshift('..')
|
7
|
+
require 'docgenerator'
|
8
|
+
|
9
|
+
END{
|
10
|
+
[
|
11
|
+
Docgenerator::Sectioning::DummySectioning.new({}, 'aa'),
|
12
|
+
element(:section,{}, 'bb'),
|
13
|
+
element(:h1,{}, 'cc'),
|
14
|
+
element(:abstract,{}, 'cc'),
|
15
|
+
].each{|sec|
|
16
|
+
|
17
|
+
#~ puts sec.to_latex
|
18
|
+
#~ puts sec.to_html
|
19
|
+
#~ puts sec.to_wiki
|
20
|
+
#~ puts sec.to_creole
|
21
|
+
#~ puts sec.to_text
|
22
|
+
}
|
23
|
+
}
|
11
24
|
end
|
12
25
|
|
13
|
-
#
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
#
|
27
|
+
module Docgenerator
|
28
|
+
=begin rdoc
|
29
|
+
Collection of section elements.
|
30
|
+
|
31
|
+
Define of
|
32
|
+
* part, chapter, [sub]*section, [sub]paragraph
|
33
|
+
* h1...h6
|
34
|
+
|
35
|
+
=end
|
36
|
+
module Sectioning
|
37
|
+
|
38
|
+
=begin rdoc
|
39
|
+
Define Element :sectioning
|
40
|
+
|
41
|
+
This is a dummy-element as template for section...
|
42
|
+
|
43
|
+
Attributes may be:
|
44
|
+
* :short:
|
45
|
+
* HTML_ATTR_CORE
|
46
|
+
* HTML_ATTR_I18N
|
47
|
+
* HTML_ATTR_EVENTS
|
48
|
+
* :lang, ATTR_LANG
|
49
|
+
=end
|
50
|
+
class DummySectioning < Element
|
51
|
+
class << self
|
52
|
+
def inherited(subclass)
|
53
|
+
Element.inherited(subclass)
|
54
|
+
subclass.class_eval(<<-attr
|
55
|
+
add_attributes HTML_ATTR_CORE
|
56
|
+
add_attributes HTML_ATTR_I18N
|
57
|
+
add_attributes HTML_ATTR_EVENTS
|
58
|
+
add_attribute :lang, ATTR_LANG
|
59
|
+
add_attribute :short, Attribute.create( [ :latex ] )
|
60
|
+
attr
|
61
|
+
)
|
62
|
+
end
|
63
|
+
=begin rdoc
|
64
|
+
Define the number of '=' for this section-command in wiki syntax.
|
65
|
+
=end
|
66
|
+
def set_wikilevel( level )
|
67
|
+
class_eval( "def wikilevel(); '#{'=' * level}'; end")
|
68
|
+
end
|
69
|
+
end #class << self
|
70
|
+
=begin rdoc
|
71
|
+
Default marup for title for wikis.
|
72
|
+
|
73
|
+
Is redefined by set_wikilevel( level )
|
74
|
+
=end
|
75
|
+
def wikilevel(); ''; end
|
76
|
+
|
77
|
+
#Small helper to make TeX-Hyperlinks like in HTML (attribute id)
|
78
|
+
def hypertarget(id)
|
79
|
+
return "\\hypertarget{#{id}}{}" if id.is_a?(String)
|
80
|
+
#~ return '' if ! id.content or id.content.to_s =~/\A\s*\Z/
|
81
|
+
return '' if ! id.content or id.content.join =~/\A\s*\Z/ #Ruby 1.9
|
82
|
+
return "\\hypertarget{#{id}}{}"
|
83
|
+
end
|
84
|
+
=begin rdoc
|
85
|
+
Determine the TeX-Makroname from class name
|
86
|
+
=end
|
87
|
+
def texmakro()
|
88
|
+
self.class.name.split('::').last.downcase
|
89
|
+
end
|
90
|
+
|
91
|
+
add_latex_output '#{linebreak(@crbefore)}' + '\\#{texmakro}' +
|
34
92
|
'#{texoptional(:short)}' +
|
35
93
|
'{#{@content}}' +
|
36
94
|
'#{hypertarget(@attr[:id])}' +
|
37
|
-
'#{linebreak(@crafter)}'
|
38
|
-
|
95
|
+
'#{linebreak(@crafter)}'
|
96
|
+
|
97
|
+
add_context_output '#{linebreak(@crbefore)}' + '\\#{texmakro}' +
|
39
98
|
'#{texoptional(:short)}' +
|
40
99
|
'{#{@content}}' +
|
41
100
|
'#{hypertarget(@attr[:id])}' +
|
42
|
-
'#{linebreak(@crafter)}'
|
43
|
-
:text => "\n" + '#{linebreak(@crbefore)}#{@content}' + "\n" +
|
44
|
-
' ' * s.wiki * 2 + '-' * 30 + "\n" + '#{linebreak(@crafter)}',
|
45
|
-
:wiki => '#{linebreak(@crbefore)}' + "\n" + '='* (s.wiki ) + '#{@content}' + '='* (s.wiki) + "\n" + '#{linebreak(@crafter)}',
|
46
|
-
:creole => '#{linebreak(@crbefore)}' + "\n" + '='* (s.wiki ) + '#{@content}' + "\n" + '#{linebreak(@crafter)}',
|
47
|
-
} )
|
48
|
-
}
|
49
|
-
#~ Element.create( [:h1], HTML_ATTR_ALL, true,
|
50
|
-
#~ { :htmltag => 'h1',
|
51
|
-
#~ :latex => "\n" + '\section{#{@content}}' + "\n"
|
52
|
-
#~ } )
|
53
|
-
#~ Element.create( [:h2], HTML_ATTR_ALL, true,
|
54
|
-
#~ { :htmltag => 'h2',
|
55
|
-
#~ :latex => "\n" + '\subsection{#{@content}}' + "\n"
|
56
|
-
#~ } )
|
57
|
-
|
58
|
-
Element.create( [:addsec], HTML_ATTR_ALL, true,
|
59
|
-
{ :htmltag => 'h2',
|
60
|
-
:latex => '#{linebreak(@crbefore)}' + '\addsec{#{@content}}' + '#{linebreak(@crafter)}'
|
61
|
-
} )
|
62
|
-
|
63
|
-
|
64
|
-
class Caption < Element
|
65
|
-
#Make the key known to the complete key-list of elements.
|
66
|
-
Element.add( [:caption], Caption )
|
67
|
-
#
|
68
|
-
add_attributes( {
|
69
|
-
:optional => Attribute.create( [ :latex ] ),
|
70
|
-
} )
|
71
|
-
def to_latex()
|
72
|
-
cmd = ''
|
73
|
-
cmd << "\n" if @crbefore
|
74
|
-
cmd << "\\caption"
|
75
|
-
if @attr[:optional].content != []
|
76
|
-
cmd << "["
|
77
|
-
cmd << @attr[:optional].content.to_s
|
78
|
-
cmd << "]"
|
79
|
-
cmd << "\n\t" if @crmid
|
80
|
-
end
|
81
|
-
cmd << "{"
|
82
|
-
cmd << @content.to_s
|
83
|
-
cmd << "}"
|
84
|
-
cmd << "\n" if @crafter
|
85
|
-
return cmd
|
86
|
-
end
|
87
|
-
end
|
101
|
+
'#{linebreak(@crafter)}'
|
88
102
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
103
|
+
#'underlined' title
|
104
|
+
add_text_output "\n" + '#{linebreak(@crbefore)}#{@content}' + "\n" +
|
105
|
+
'#{wikilevel.gsub(/=/,\' \')}' +
|
106
|
+
'-' * 30 + "\n" + '#{linebreak(@crafter)}'
|
107
|
+
|
108
|
+
add_wiki_output '#{linebreak(@crbefore)}' + "\n" + '#{wikilevel}' + '#{@content}' + '#{wikilevel}' + "\n" + '#{linebreak(@crafter)}'
|
109
|
+
|
110
|
+
add_creole_output '#{linebreak(@crbefore)}' + "\n" + '#{wikilevel}' + '#{@content}' + "\n" + '#{linebreak(@crafter)}'
|
111
|
+
end #Sectioning
|
112
|
+
|
113
|
+
|
114
|
+
=begin rdoc
|
115
|
+
Define Element :part
|
116
|
+
|
117
|
+
Create an instance with
|
118
|
+
element( :part, [ attributes, [content]] )
|
119
|
+
or
|
120
|
+
Part.new( [ attributes, [content]] )
|
121
|
+
|
122
|
+
Attributes see class DummySectioning.
|
123
|
+
=end
|
124
|
+
class Part < DummySectioning
|
125
|
+
#~ add_html_tag ''
|
126
|
+
end #Part
|
127
|
+
|
128
|
+
=begin rdoc
|
129
|
+
Define Element :chapter
|
130
|
+
|
131
|
+
Create an instance with
|
132
|
+
element( :chapter, [ attributes, [content]] )
|
133
|
+
or
|
134
|
+
Chapter.new( [ attributes, [content]] )
|
135
|
+
|
136
|
+
Attributes see class DummySectioning.
|
137
|
+
=end
|
138
|
+
class Chapter < DummySectioning
|
139
|
+
set_wikilevel 1
|
140
|
+
#~ add_html_tag ''
|
141
|
+
end #Chapter
|
142
|
+
|
143
|
+
=begin rdoc
|
144
|
+
Define Element :h1, :section
|
145
|
+
|
146
|
+
Create an instance with
|
147
|
+
element( :h1, [ attributes, [content]] )
|
148
|
+
element( :section, [ attributes, [content]] )
|
149
|
+
or
|
150
|
+
Section.new( [ attributes, [content]] )
|
151
|
+
|
152
|
+
Attributes see class DummySectioning.
|
153
|
+
=end
|
154
|
+
class Section < DummySectioning
|
155
|
+
set_wikilevel 2
|
156
|
+
add_id :h1
|
157
|
+
add_html_tag 'h1'
|
158
|
+
end #H1
|
159
|
+
|
160
|
+
=begin rdoc
|
161
|
+
Define Element :h2, :subsection
|
162
|
+
|
163
|
+
Create an instance with
|
164
|
+
element( :h2, [ attributes, [content]] )
|
165
|
+
element( :subsection, [ attributes, [content]] )
|
166
|
+
or
|
167
|
+
Subsection.new( [ attributes, [content]] )
|
168
|
+
|
169
|
+
Attributes see class DummySectioning.
|
170
|
+
=end
|
171
|
+
class Subsection < DummySectioning
|
172
|
+
set_wikilevel 3
|
173
|
+
add_id :h2
|
174
|
+
add_html_tag 'h2'
|
175
|
+
end #H2
|
176
|
+
|
177
|
+
=begin rdoc
|
178
|
+
Define Element :h3, :subsubsection
|
179
|
+
|
180
|
+
Create an instance with
|
181
|
+
element( :h3, [ attributes, [content]] )
|
182
|
+
element( :subsubsection, [ attributes, [content]] )
|
183
|
+
or
|
184
|
+
Subsubsection.new( [ attributes, [content]] )
|
185
|
+
Attributes may be:
|
186
|
+
|
187
|
+
Attributes see class DummySectioning.
|
188
|
+
=end
|
189
|
+
class Subsubsection < DummySectioning
|
190
|
+
set_wikilevel 4
|
191
|
+
add_id :h3
|
192
|
+
add_html_tag 'h3'
|
193
|
+
end #H3
|
194
|
+
|
195
|
+
=begin rdoc
|
196
|
+
Define Element :h4, :paragraph
|
197
|
+
|
198
|
+
Create an instance with
|
199
|
+
element( :h4, [ attributes, [content]] )
|
200
|
+
element( :paragraph, [ attributes, [content]] )
|
201
|
+
or
|
202
|
+
Paragraph.new( [ attributes, [content]] )
|
203
|
+
|
204
|
+
Attributes see class DummySectioning.
|
205
|
+
=end
|
206
|
+
class Paragraph < DummySectioning
|
207
|
+
set_wikilevel 5
|
208
|
+
add_id :h4
|
209
|
+
add_html_tag 'h4'
|
210
|
+
end #H4
|
211
|
+
|
212
|
+
|
213
|
+
=begin rdoc
|
214
|
+
Define Element :h5, :subparagraph
|
215
|
+
|
216
|
+
Create an instance with
|
217
|
+
element( :h5, [ attributes, [content]] )
|
218
|
+
element( :subparagraph, [ attributes, [content]] )
|
219
|
+
or
|
220
|
+
Subparagraph.new( [ attributes, [content]] )
|
221
|
+
|
222
|
+
Attributes see class DummySectioning.
|
223
|
+
=end
|
224
|
+
class Subparagraph < DummySectioning
|
225
|
+
set_wikilevel 6
|
226
|
+
add_id :h5
|
227
|
+
add_html_tag 'h5'
|
228
|
+
end #H5
|
229
|
+
|
230
|
+
=begin rdoc
|
231
|
+
Define Element :h6, :minisec
|
232
|
+
|
233
|
+
Create an instance with
|
234
|
+
element( :h6, [ attributes, [content]] )
|
235
|
+
element( :minisec, [ attributes, [content]] )
|
236
|
+
or
|
237
|
+
Minisec.new( [ attributes, [content]] )
|
238
|
+
|
239
|
+
Attributes see class DummySectioning.
|
240
|
+
=end
|
241
|
+
class Minisec < DummySectioning
|
242
|
+
set_wikilevel 7
|
243
|
+
add_id :h6
|
244
|
+
add_html_tag 'h6'
|
245
|
+
end #H6
|
246
|
+
|
247
|
+
|
248
|
+
=begin rdoc
|
249
|
+
Define Element :addsec
|
250
|
+
|
251
|
+
\\addsec is a command provided by koma-script.
|
252
|
+
|
253
|
+
Create an instance with
|
254
|
+
element( :addsec, [ attributes, [content]] )
|
255
|
+
or
|
256
|
+
Addsec.new( [ attributes, [content]] )
|
257
|
+
|
258
|
+
Attributes may be:
|
259
|
+
* HTML_ATTR_ALL
|
260
|
+
=end
|
261
|
+
class Addsec < Element
|
262
|
+
add_attributes HTML_ATTR_CORE
|
263
|
+
add_attributes HTML_ATTR_I18N
|
264
|
+
add_attributes HTML_ATTR_EVENTS
|
265
|
+
add_attribute :lang, ATTR_LANG
|
266
|
+
add_html_tag 'h2'
|
267
|
+
add_latex_output '#{linebreak(@crbefore)}' + '\addsec{#{@content}}' + '#{linebreak(@crafter)}'
|
268
|
+
end #Addsec
|
269
|
+
end #module Sectioning
|
270
|
+
end #module Docgenerator
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#encoding: utf-8
|
2
2
|
=begin rdoc
|
3
|
-
This file change the behaviour of each Object
|
3
|
+
This file change the behaviour of each Object and extends Array
|
4
4
|
=end
|
5
5
|
|
6
6
|
=begin rdoc
|
@@ -9,36 +9,44 @@ Extend all objects by the methods
|
|
9
9
|
- to_html
|
10
10
|
- to_latex
|
11
11
|
- to_wiki
|
12
|
+
- to_creole
|
12
13
|
- to_text
|
13
14
|
- to_context
|
14
15
|
Redefine is_a?:
|
15
|
-
|
16
|
+
Allows comparison with a symbol.
|
16
17
|
=end
|
17
18
|
class Object
|
18
19
|
alias :old_is_a? :is_a?
|
19
20
|
=begin rdoc
|
20
|
-
Redefine the standard is_a?
|
21
|
+
Redefine the standard is_a? to allow to
|
22
|
+
compare with Symbol.
|
21
23
|
|
22
|
-
Returns also true, if
|
24
|
+
Returns also true, if you compare Docgenerator::Element with a Symbol
|
25
|
+
and one of the ids if the element corresponds to the Symbol.
|
26
|
+
|
27
|
+
Example:
|
28
|
+
newline = element(:br)
|
29
|
+
newline.is_a?(:newline) #true
|
23
30
|
=end
|
24
31
|
def is_a?( testvalue)
|
25
32
|
if testvalue.old_is_a?(Symbol)
|
26
|
-
if old_is_a?(Element)
|
27
|
-
return
|
33
|
+
if old_is_a?(Docgenerator::Element)
|
34
|
+
return element_ids.include?(testvalue)
|
28
35
|
else
|
29
36
|
return false
|
30
37
|
end
|
31
|
-
else
|
38
|
+
else #old/normal behaviour.
|
32
39
|
return old_is_a?(testvalue)
|
33
40
|
end
|
34
41
|
end
|
35
42
|
=begin rdoc
|
36
43
|
to_doc returns the object as a string.
|
37
|
-
will be redefined for Element
|
44
|
+
will be redefined for Docgenerator::Element
|
45
|
+
|
38
46
|
=end
|
39
47
|
def to_doc(target, options = {})
|
40
|
-
o =
|
41
|
-
if self.is_a?(Element) and ! self.respond_to?(:to_doc)
|
48
|
+
o = Docgenerator.set_option_defaults(options)
|
49
|
+
if self.is_a?(Docgenerator::Element) and ! self.respond_to?(:to_doc)
|
42
50
|
o[:log].error( "Missing to_doc routine for #{self.class}") if o[:log].error?
|
43
51
|
end
|
44
52
|
self.respond_to?(:to_str) ? self.to_str : self.to_s
|
@@ -59,7 +67,7 @@ class Array
|
|
59
67
|
Returns the element for each parameter
|
60
68
|
=end
|
61
69
|
def to_doc(target, options = {})
|
62
|
-
o =
|
70
|
+
o = Docgenerator.set_option_defaults(options)
|
63
71
|
o[:log].debug("enter to_doc(#{target}) for Array, options: #{options.keys.inspect}") if o[:log].debug?
|
64
72
|
str = ""
|
65
73
|
self.each{|el|
|