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
@@ -0,0 +1,56 @@
|
|
1
|
+
=begin rdoc
|
2
|
+
Creole characters
|
3
|
+
|
4
|
+
This classes define special characters as inclusions.
|
5
|
+
|
6
|
+
* Inclusions are used later with {{xx}}
|
7
|
+
more at http://www.wikicreole.org/wiki/Inclusion
|
8
|
+
=end
|
9
|
+
|
10
|
+
#
|
11
|
+
|
12
|
+
module Docgenerator
|
13
|
+
module Creole
|
14
|
+
|
15
|
+
=begin rdoc
|
16
|
+
Define special characters as inclusions.
|
17
|
+
|
18
|
+
See also Creole::CHARACTERS
|
19
|
+
=end
|
20
|
+
module Characters
|
21
|
+
=begin rdoc
|
22
|
+
Define a 'shy' as {{shy}}
|
23
|
+
=end
|
24
|
+
class Creole_shy < Creole_inclusion_and_plugin
|
25
|
+
set_inclusions_key '-'
|
26
|
+
set_inclusions_key 'shy'
|
27
|
+
|
28
|
+
def to_doc(target, options = {})
|
29
|
+
element(:shy).to_doc(target, options)
|
30
|
+
end
|
31
|
+
end #Creole_shy
|
32
|
+
|
33
|
+
=begin rdoc
|
34
|
+
Define a 'radic' as {{radic}}
|
35
|
+
=end
|
36
|
+
class Creole_radic < Creole_inclusion_and_plugin
|
37
|
+
set_inclusions_key 'radic'
|
38
|
+
|
39
|
+
def to_doc(target, options = {})
|
40
|
+
element(:radic).to_doc(target, options)
|
41
|
+
end
|
42
|
+
end #Creole_shy
|
43
|
+
|
44
|
+
=begin rdoc
|
45
|
+
Define a 'nil' as {{nil}}
|
46
|
+
=end
|
47
|
+
class Creole_nil < Creole_inclusion_and_plugin
|
48
|
+
set_inclusions_key 'nil'
|
49
|
+
|
50
|
+
def to_doc(target, options = {})
|
51
|
+
''
|
52
|
+
end
|
53
|
+
end #Creole_nil
|
54
|
+
end #module Characters
|
55
|
+
end #module Creole
|
56
|
+
end #module Docgenerator
|
@@ -1,20 +1,25 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
1
|
+
=begin rdoc
|
2
|
+
Creole inclusions and plugins
|
3
|
+
|
4
|
+
This classes are defined to implement transclusions (http://en.wikipedia.org/wiki/Transclusion)
|
5
|
+
|
6
|
+
* Inclusions are used later with {{xx}}
|
7
|
+
more at http://www.wikicreole.org/wiki/Inclusion
|
8
|
+
* Plugins are used later with <<xx>>
|
9
|
+
more at http://www.wikicreole.org/wiki/Plugin
|
10
|
+
|
11
|
+
By default, an inclusion expects a pictures, unless it es defined something else.
|
12
|
+
|
13
|
+
You can extend Wikis with additional inclusions:
|
14
|
+
|
15
|
+
wiki = Creole.new()
|
16
|
+
wiki.inclusion['xxx'] = Creole_inclusion_xxx
|
17
|
+
=end
|
18
|
+
|
16
19
|
#
|
17
20
|
|
21
|
+
module Docgenerator
|
22
|
+
module Creole
|
18
23
|
|
19
24
|
=begin rdoc
|
20
25
|
Dummy class for all inclusions and plugins.
|
@@ -27,6 +32,7 @@ Derived classes (Inclusions):
|
|
27
32
|
- Creole_inclusion_img
|
28
33
|
- Creole_inclusion_footnote_group
|
29
34
|
- Creole_inclusion_footnote
|
35
|
+
|
30
36
|
Derived classes (Plugins):
|
31
37
|
- Creole_default_plugin
|
32
38
|
- Creole_plugin_ruby
|
@@ -34,8 +40,18 @@ Derived classes (Plugins):
|
|
34
40
|
More subclasses may be possible.
|
35
41
|
=end
|
36
42
|
class Creole_inclusion_and_plugin
|
37
|
-
|
38
|
-
|
43
|
+
=begin rdoc
|
44
|
+
Example:
|
45
|
+
{{inclusionname|description|option1=1,option2=2}}
|
46
|
+
|
47
|
+
Parameters:
|
48
|
+
* inclusionname: Name of the inclusion (normally fix for an instance, unless e.g. Creole_inclusion_img)
|
49
|
+
* description: First parameter of the plugin.
|
50
|
+
* options: Array with the comma separated values.
|
51
|
+
In the example:
|
52
|
+
['option1=1','option2=2']
|
53
|
+
* wiki: creole-instance, where the plugin/inclusion is defined.
|
54
|
+
=end
|
39
55
|
def initialize( inclusionname, description, options, wiki )
|
40
56
|
@inclusionname = inclusionname
|
41
57
|
@description = description
|
@@ -43,286 +59,45 @@ class Creole_inclusion_and_plugin
|
|
43
59
|
@wiki = wiki
|
44
60
|
|
45
61
|
raise "Inclusion received no wiki but #{wiki.inspect}" unless wiki.is_a?(Creole)
|
46
|
-
|
47
62
|
end
|
48
63
|
#Reader for the wiki.
|
49
64
|
attr_reader :wiki
|
50
|
-
end #Creole_inclusion
|
51
|
-
|
52
|
-
#
|
53
|
-
#Default Plugin.
|
54
|
-
class Creole_default_plugin < Creole_inclusion_and_plugin
|
55
|
-
Creole::Plugins.default = self
|
56
|
-
def initialize( pluginname, description, options, wiki )
|
57
|
-
super
|
58
|
-
@wiki.log.warn("Use Default plugin instead requested #{pluginname}- nothing special done.") if @wiki.log.warn?
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
|
63
|
-
#
|
64
|
-
#Define a 'shy' as {{shy}}
|
65
|
-
#
|
66
|
-
class Creole_shy < Creole_inclusion_and_plugin
|
67
|
-
#
|
68
|
-
#~ Creole::Plugins['-'] = self
|
69
|
-
Creole::Inclusions['-'] = self
|
70
|
-
Creole::Inclusions['shy'] = self
|
71
|
-
|
72
|
-
def to_doc(target, options = {})
|
73
|
-
element(:shy).to_doc(target, options)
|
74
|
-
end
|
75
|
-
end #Creole_inclusion_footnote_group
|
76
|
-
|
77
|
-
#
|
78
|
-
#Define a 'nil' as {{nil}}
|
79
|
-
#
|
80
|
-
class Creole_nil < Creole_inclusion_and_plugin
|
81
|
-
#
|
82
|
-
#~ Creole::Plugins['-'] = self
|
83
|
-
#~ Creole::Inclusions['-'] = self
|
84
|
-
Creole::Inclusions['nil'] = self
|
85
|
-
|
86
|
-
def to_doc(target, options = {})
|
87
|
-
''
|
88
|
-
end
|
89
|
-
end #Creole_inclusion_footnote_group
|
90
|
-
|
91
65
|
|
92
66
|
=begin rdoc
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
There are yet more features than in standard.
|
97
|
-
|
98
|
-
This is also the default for inclusions.
|
99
|
-
|
100
|
-
Usage:
|
101
|
-
{{picurl.jpg|Alternate text|class=cc}}
|
102
|
-
{{picurl.jpg|Alternate text|css=width:50%}}
|
103
|
-
|
104
|
-
=end
|
105
|
-
class Creole_inclusion_img < Creole_inclusion_and_plugin
|
106
|
-
Creole::Inclusions.default = self
|
67
|
+
Define meta-methods for Creole_inclusion_and_plugin
|
68
|
+
=end
|
69
|
+
class << self
|
107
70
|
=begin rdoc
|
108
|
-
Define
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
* longdesc (can take a url, at leas opera offers to call the description)
|
116
|
-
* width (only LaTeX. For HTML, use css-option).
|
117
|
-
|
118
|
-
=end
|
119
|
-
def initialize( picname, alt_text, options, wiki )
|
120
|
-
super
|
121
|
-
@img = element(:img,{ :src => @inclusionname })
|
122
|
-
@img[:alt] << alt_text if alt_text
|
123
|
-
#Check existence of Picture. Only possible if the related wiki is available.
|
124
|
-
wiki.check_link_existence( @inclusionname, wiki.log )
|
125
|
-
|
126
|
-
css = CSS.new( :log => wiki.log )
|
127
|
-
|
128
|
-
#
|
129
|
-
#Check for options
|
130
|
-
#
|
131
|
-
#Missing options:
|
132
|
-
#* align
|
133
|
-
#* border
|
134
|
-
#* height
|
135
|
-
#* hspace
|
136
|
-
#* name
|
137
|
-
#* vspace
|
138
|
-
options.each{|option|
|
139
|
-
case option
|
140
|
-
when /^(img)?css\s*=\s*(.*)/
|
141
|
-
$2.split(/\s*;\s*/).each{|css_assignment|
|
142
|
-
css_assignment =~ /(.+?)\s*:\s*(.+)/
|
143
|
-
css[$1] = $2
|
144
|
-
}
|
145
|
-
when /^(img)?class\s*=\s*(.*)/
|
146
|
-
@img[:class] << $2
|
147
|
-
when /^width\s*=\s*(.*)/
|
148
|
-
@img[:width] << $1
|
149
|
-
when /^longdesc\s*=\s*(.*)/ #gibt einen URI (nach RFC 2396) an, wo eine Langbeschreibung der Grafik zu finden ist
|
150
|
-
@img[:longdesc] << $1
|
151
|
-
else
|
152
|
-
wiki.log.warn("Img: Undefined option #{option}") if wiki.log.warn?
|
153
|
-
end #case option
|
154
|
-
} if options
|
155
|
-
@img.attr[:style] << css
|
156
|
-
|
157
|
-
end
|
158
|
-
def to_doc(target, options = {})
|
159
|
-
@img.to_doc(target, options)
|
160
|
-
end
|
161
|
-
end #Creole_inclusion_img
|
162
|
-
|
163
|
-
#
|
164
|
-
#Collection of footnotes.
|
165
|
-
#
|
166
|
-
class Creole_footnote_group < Creole_inclusion_and_plugin
|
167
|
-
#
|
168
|
-
Creole::Plugins['footnotes'] = self
|
169
|
-
#~ Creole::Inclusions['footnotes'] = self
|
170
|
-
|
171
|
-
def initialize( inclusionname, description, options, wiki )
|
172
|
-
super
|
173
|
-
description = Footnotegroup::DEFAULTGROUPID unless description
|
174
|
-
@footnotesgroup = wiki.footnotegroups[description]
|
175
|
-
wiki.log.error("Footnotesgroup #{description.inspect} not found") if ! @footnotesgroup and wiki.log.error?
|
176
|
-
end
|
177
|
-
def to_doc(target, options = {})
|
178
|
-
@footnotesgroup.to_doc(target, options)
|
179
|
-
end
|
180
|
-
end #Creole_inclusion_footnote_group
|
181
|
-
|
71
|
+
Define class as a Inclusion.
|
72
|
+
You may use the class as:
|
73
|
+
{{key}}
|
74
|
+
=end
|
75
|
+
def set_inclusions_key(key)
|
76
|
+
Inclusions::Collection[key] = self
|
77
|
+
end
|
182
78
|
=begin rdoc
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
Has to be repaired one day.
|
190
|
-
=end
|
191
|
-
class Creole_footnote < Creole_inclusion_and_plugin
|
192
|
-
Creole::Plugins['footnote'] = self
|
193
|
-
#~ Creole::Inclusions['footnote'] = self
|
194
|
-
def initialize( inclusionname, description, options, wiki )
|
195
|
-
super
|
196
|
-
|
197
|
-
@groupid = Footnotegroup::DEFAULTGROUPID
|
198
|
-
label = nil
|
199
|
-
|
200
|
-
options.each{|option|
|
201
|
-
case option
|
202
|
-
when /label\s*=\s*(.*)/
|
203
|
-
label = $1
|
204
|
-
when /groupid\s*=\s*(.*)/
|
205
|
-
@groupid = $1
|
206
|
-
else
|
207
|
-
@wiki.log.warn("Footnote with unknown option #{option.inspect} not found") if @wiki.log.warn?
|
208
|
-
end
|
209
|
-
}
|
210
|
-
|
211
|
-
if ! wiki.footnotegroups[@groupid]
|
212
|
-
wiki.footnotegroups[@groupid] = Footnotegroup.new(@groupid)
|
79
|
+
Define class as a Plugin.
|
80
|
+
You may use the class as:
|
81
|
+
<<key>>
|
82
|
+
=end
|
83
|
+
def set_plugin_key(key)
|
84
|
+
Plugins::Collection[key] = self
|
213
85
|
end
|
214
|
-
|
215
|
-
group = wiki.footnotegroups[@groupid]
|
216
|
-
|
217
|
-
@footnote = element(:footnote,{
|
218
|
-
:group => group,
|
219
|
-
:label => label,
|
220
|
-
}, description )
|
221
|
-
|
222
|
-
|
223
|
-
end
|
224
|
-
def to_doc(target, options ={})
|
225
|
-
@footnote.to_doc(target, options)
|
226
|
-
end
|
227
|
-
end #Creole_inclusion_footnote
|
228
|
-
|
229
86
|
=begin rdoc
|
230
|
-
|
231
|
-
|
232
|
-
Usage:
|
233
|
-
{{html|code}}
|
87
|
+
fixme
|
234
88
|
|
235
|
-
|
236
|
-
|
237
|
-
<<<html
|
238
|
-
content
|
239
|
-
>>>
|
240
|
-
=end
|
241
|
-
class Creole_short_html < Creole_inclusion_and_plugin
|
242
|
-
#We don't use it as plugin. Closing > from html may e confusing as in:
|
243
|
-
# <<html|<em>kursuiv</em>>>
|
244
|
-
#~ Creole::Plugins['html'] = self
|
245
|
-
Creole::Inclusions['html'] = self
|
246
|
-
#~ Creole::Inclusions['footnote'] = self
|
247
|
-
def initialize( inclusionname, description, options, wiki )
|
248
|
-
super
|
249
|
-
options.each{|option|
|
250
|
-
#~ case option
|
251
|
-
#~ else
|
252
|
-
@wiki.log.warn("HTML with unknown option #{option.inspect} not found") if @wiki.log.warn?
|
253
|
-
#~ end
|
254
|
-
}
|
255
|
-
@source = description
|
89
|
+
define to_doc...
|
90
|
+
=end
|
256
91
|
|
257
|
-
end
|
258
|
-
|
259
|
-
def to_doc( target, options = {})
|
260
|
-
target == :html ? @source.to_doc( target, options ) : ''
|
261
|
-
end
|
262
|
-
end #Creole_inclusion_html
|
263
|
-
|
264
|
-
=begin rdoc
|
265
|
-
Eval the given ruby-code and put it as "raw text".
|
266
|
-
|
267
|
-
|
268
|
-
This is defined as a plugin.
|
269
|
-
=end
|
270
|
-
class Creole_plugin_ruby_raw < Creole_inclusion_and_plugin
|
271
|
-
#~ Creole::Inclusions['ruby'] = self
|
272
|
-
Creole::Plugins['ruby_raw'] = self
|
273
|
-
|
274
|
-
def initialize( inclusionname, description, options, wiki )
|
275
|
-
#The ruby-code may contain | - so we have to ad it again
|
276
|
-
description << "|#{options.join('|')}" unless options.empty?
|
277
|
-
options = nil
|
278
|
-
super
|
279
|
-
@code = description
|
280
|
-
begin
|
281
|
-
@result = eval(@code)
|
282
|
-
rescue => bang
|
283
|
-
wiki.log.error("Plugin ruby_raw: <#{@code}> results in #{bang.class}/#{bang}") if wiki.log.error?
|
284
|
-
end
|
285
|
-
end #initioliaze
|
286
|
-
def to_doc(target, options ={})
|
287
|
-
@result.to_s
|
288
|
-
end
|
289
|
-
def inspect()
|
290
|
-
"#<Creole_plugin_ruby_raw:#{@code}>"
|
291
|
-
end
|
292
|
-
end #Creole_plugin_ruby
|
293
|
-
|
294
|
-
=begin rdoc
|
295
|
-
Eval the given ruby-code and add it as a interpreted code.
|
92
|
+
end #Meta-methods
|
93
|
+
end #Creole_inclusion_and_plugin
|
296
94
|
|
297
|
-
|
95
|
+
require_relative 'creole_inclusions.rb'
|
96
|
+
require_relative 'creole_characters.rb' #inclusions
|
97
|
+
require_relative 'creole_plugins.rb'
|
298
98
|
|
299
|
-
|
300
|
-
|
301
|
-
class Creole_plugin_ruby < Creole_inclusion_and_plugin
|
302
|
-
#~ Creole::Inclusions['ruby'] = self
|
303
|
-
Creole::Plugins['ruby'] = self
|
304
|
-
def initialize( inclusionname, description, options, wiki )
|
305
|
-
#The ruby-code may contain | - so we have to ad it again
|
306
|
-
description << "|#{options.join('|')}" unless options.empty?
|
307
|
-
options = nil
|
308
|
-
super
|
309
|
-
|
310
|
-
@code = description
|
311
|
-
begin
|
312
|
-
@result = eval(@code)
|
313
|
-
rescue => bang
|
314
|
-
wiki.log.error("Plugin ruby: <#{@code}> results in #{bang.class}/#{bang}") if wiki.log.error?
|
315
|
-
end
|
316
|
-
end #initioliaze
|
317
|
-
def to_doc(target, options = {})
|
318
|
-
@wiki.normsource2elements(
|
319
|
-
@wiki.parse(@result.to_s ), options
|
320
|
-
).to_doc(target, options )
|
321
|
-
end
|
322
|
-
def inspect()
|
323
|
-
"#<Creole_plugin_ruby:#{@code}>"
|
324
|
-
end
|
325
|
-
end #Creole_plugin_ruby
|
99
|
+
end #module Creole
|
100
|
+
end #module Docgenerator
|
326
101
|
|
327
102
|
#~ if $0 == __FILE__
|
328
103
|
#~ require 'quicktest'
|
@@ -0,0 +1,142 @@
|
|
1
|
+
=begin rdoc
|
2
|
+
Creole inclusions.
|
3
|
+
|
4
|
+
This classes are defined to implement inclusions.
|
5
|
+
|
6
|
+
* Inclusions are used later with {{xx}}
|
7
|
+
more at http://www.wikicreole.org/wiki/Inclusion
|
8
|
+
|
9
|
+
By default, an inclusion expects a pictures, unless it es defined something else.
|
10
|
+
|
11
|
+
You can extend Wikis with additional inclusions:
|
12
|
+
|
13
|
+
wiki = Creole.new()
|
14
|
+
wiki.inclusion['xxx'] = Creole_inclusion_xxx
|
15
|
+
=end
|
16
|
+
|
17
|
+
#
|
18
|
+
|
19
|
+
module Docgenerator
|
20
|
+
module Creole
|
21
|
+
|
22
|
+
=begin rdoc
|
23
|
+
Define Inclusions
|
24
|
+
|
25
|
+
Inclusions are used via {{...}}
|
26
|
+
|
27
|
+
Default: Creole_inclusion_img (defined in class definition Creole_inclusion_img)
|
28
|
+
=end
|
29
|
+
module Inclusions
|
30
|
+
Collection = Hash.new()
|
31
|
+
|
32
|
+
|
33
|
+
=begin rdoc
|
34
|
+
Include images.
|
35
|
+
http://www.wikicreole.org/wiki/Images
|
36
|
+
|
37
|
+
There are yet more features than in standard.
|
38
|
+
|
39
|
+
This is also the default for inclusions.
|
40
|
+
|
41
|
+
Usage:
|
42
|
+
{{picurl.jpg|Alternate text|class=cc}}
|
43
|
+
{{picurl.jpg|Alternate text|css=width:50%}}
|
44
|
+
|
45
|
+
=end
|
46
|
+
class Creole_inclusion_img < Creole_inclusion_and_plugin
|
47
|
+
Collection.default = self
|
48
|
+
=begin rdoc
|
49
|
+
Define an image.
|
50
|
+
The existence of the picture is checked.
|
51
|
+
|
52
|
+
Supported options:
|
53
|
+
* alt (2nd parameter of {{picsrc|...}}
|
54
|
+
* css or imgcss
|
55
|
+
* class or imgclass
|
56
|
+
* longdesc (can take a url, at leas opera offers to call the description)
|
57
|
+
* width (only LaTeX. For HTML, use css-option).
|
58
|
+
|
59
|
+
=end
|
60
|
+
def initialize( picname, alt_text, options, wiki )
|
61
|
+
super
|
62
|
+
@img = element(:img,{ :src => @inclusionname })
|
63
|
+
@img[:alt] << alt_text if alt_text
|
64
|
+
#Check existence of Picture. Only possible if the related wiki is available.
|
65
|
+
wiki.check_link_existence( @inclusionname, wiki.log )
|
66
|
+
|
67
|
+
css = CSS.new( :log => wiki.log )
|
68
|
+
|
69
|
+
#
|
70
|
+
#Check for options
|
71
|
+
#
|
72
|
+
#Missing options:
|
73
|
+
#* align
|
74
|
+
#* border
|
75
|
+
#* height
|
76
|
+
#* hspace
|
77
|
+
#* name
|
78
|
+
#* vspace
|
79
|
+
options.each{|option|
|
80
|
+
case option
|
81
|
+
when /^(img)?css\s*=\s*(.*)/
|
82
|
+
$2.split(/\s*;\s*/).each{|css_assignment|
|
83
|
+
css_assignment =~ /(.+?)\s*:\s*(.+)/
|
84
|
+
css[$1] = $2
|
85
|
+
}
|
86
|
+
when /^(img)?class\s*=\s*(.*)/
|
87
|
+
@img[:class] << $2
|
88
|
+
when /^width\s*=\s*(.*)/
|
89
|
+
@img[:width] << $1
|
90
|
+
when /^longdesc\s*=\s*(.*)/ #gibt einen URI (nach RFC 2396) an, wo eine Langbeschreibung der Grafik zu finden ist
|
91
|
+
@img[:longdesc] << $1
|
92
|
+
else
|
93
|
+
wiki.log.warn("Img: Undefined option #{option}") if wiki.log.warn?
|
94
|
+
end #case option
|
95
|
+
} if options
|
96
|
+
@img.attr[:style] << css
|
97
|
+
|
98
|
+
end
|
99
|
+
def to_doc(target, options = {})
|
100
|
+
@img.to_doc(target, options)
|
101
|
+
end
|
102
|
+
end #Creole_inclusion_img
|
103
|
+
|
104
|
+
=begin rdoc
|
105
|
+
Some short html
|
106
|
+
|
107
|
+
Usage:
|
108
|
+
{{html|code}}
|
109
|
+
|
110
|
+
Note:
|
111
|
+
There is also a placeholder for larger html:
|
112
|
+
<<<html
|
113
|
+
content
|
114
|
+
>>>
|
115
|
+
=end
|
116
|
+
class Creole_short_html < Creole_inclusion_and_plugin
|
117
|
+
#We don't use it as plugin. Closing > from html may e confusing as in:
|
118
|
+
# <<html|<em>kursuiv</em>>>
|
119
|
+
set_inclusions_key 'html'
|
120
|
+
|
121
|
+
|
122
|
+
def initialize( inclusionname, description, options, wiki )
|
123
|
+
super
|
124
|
+
options.each{|option|
|
125
|
+
#~ case option
|
126
|
+
#~ else
|
127
|
+
@wiki.log.warn("HTML with unknown option #{option.inspect} not found") if @wiki.log.warn?
|
128
|
+
#~ end
|
129
|
+
}
|
130
|
+
@source = description
|
131
|
+
|
132
|
+
end
|
133
|
+
#Return content only for html
|
134
|
+
def to_doc( target, options = {})
|
135
|
+
target == :html ? @source.to_doc( target, options ) : ''
|
136
|
+
end
|
137
|
+
end #Creole_inclusion_html
|
138
|
+
|
139
|
+
|
140
|
+
end #module Inclusions
|
141
|
+
end #module Creole
|
142
|
+
end #module Docgenerator
|