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,3 +1,6 @@
|
|
|
1
|
+
module Docgenerator
|
|
2
|
+
module Creole
|
|
3
|
+
|
|
1
4
|
=begin rdoc
|
|
2
5
|
Placeholder are defined in Creole-Syntax via <<< >>>
|
|
3
6
|
|
|
@@ -7,18 +10,33 @@ Placeholders get a name and optional parameters:
|
|
|
7
10
|
Placeholders collect the content between <<< and >>>.
|
|
8
11
|
|
|
9
12
|
Derived classes are:
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
- Creole_tabular
|
|
14
|
-
-
|
|
13
|
+
- Creole::Placeholders::Dummy
|
|
14
|
+
- Creole::Placeholders::Html
|
|
15
|
+
- Creole::Placeholders::Latex
|
|
16
|
+
- Creole::Creole_tabular
|
|
17
|
+
- Creole::Creole_tab
|
|
15
18
|
=end
|
|
16
|
-
class
|
|
17
|
-
|
|
19
|
+
class Placeholder
|
|
20
|
+
=begin rdoc
|
|
21
|
+
Define meta-methods for Creole_inclusion_and_plugin
|
|
22
|
+
=end
|
|
23
|
+
class << self
|
|
24
|
+
=begin rdoc
|
|
25
|
+
Define class as a placeholder.
|
|
26
|
+
You may use the class as:
|
|
27
|
+
{{key}}
|
|
28
|
+
=end
|
|
29
|
+
def set_placeholder_key(key)
|
|
30
|
+
Placeholders::Collection[key] = self
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
#Error is thrown, if the parameters don't fit the need of the placeholder
|
|
35
|
+
class ParameterError < ArgumentError; end;
|
|
18
36
|
=begin rdoc
|
|
19
37
|
Each placeholder get the wiki where it belongs to.
|
|
20
38
|
|
|
21
|
-
Parameters
|
|
39
|
+
Parameters is an optional string.
|
|
22
40
|
|
|
23
41
|
Definition inside the wiki:
|
|
24
42
|
<<<name|parameters
|
|
@@ -26,9 +44,8 @@ Definition inside the wiki:
|
|
|
26
44
|
>>>
|
|
27
45
|
Placeholders collect the content between <<< and >>>.
|
|
28
46
|
=end
|
|
29
|
-
def initialize( wiki, parameters = nil
|
|
47
|
+
def initialize( wiki, parameters = nil)
|
|
30
48
|
@wiki = wiki
|
|
31
|
-
#
|
|
32
49
|
@parameters = parameters
|
|
33
50
|
@log = @wiki.log
|
|
34
51
|
end
|
|
@@ -47,16 +64,30 @@ Placeholders collect the content between <<< and >>>.
|
|
|
47
64
|
def to_doc( target, options = {})
|
|
48
65
|
@source.to_doc( target, options )
|
|
49
66
|
end
|
|
50
|
-
end #
|
|
67
|
+
end #Placeholder
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
=begin rdoc
|
|
71
|
+
Collection of Placeholder-children
|
|
51
72
|
|
|
73
|
+
Placeholders are used via <<<...>>>.
|
|
74
|
+
=end
|
|
75
|
+
module Placeholders
|
|
52
76
|
=begin rdoc
|
|
53
77
|
Just a dummy for wrong definitions.
|
|
54
78
|
|
|
55
79
|
This class is used by Creole a default placeholder.
|
|
56
80
|
=end
|
|
57
|
-
class
|
|
58
|
-
|
|
59
|
-
|
|
81
|
+
class Dummy < Placeholder
|
|
82
|
+
end #Placeholder::Dummy
|
|
83
|
+
|
|
84
|
+
#List of defined Placeholders.
|
|
85
|
+
Collection = Hash.new( Dummy )
|
|
86
|
+
#Get a Placeholder.
|
|
87
|
+
def self.[](key)
|
|
88
|
+
Collection[key]
|
|
89
|
+
end
|
|
90
|
+
|
|
60
91
|
|
|
61
92
|
=begin rdoc
|
|
62
93
|
Placeholder for pure HTML-output.
|
|
@@ -71,8 +102,8 @@ Note:
|
|
|
71
102
|
There is also a plugin for short html:
|
|
72
103
|
{{html|code}}
|
|
73
104
|
=end
|
|
74
|
-
class Creole_html <
|
|
75
|
-
|
|
105
|
+
class Creole_html < Placeholder
|
|
106
|
+
set_placeholder_key 'html'
|
|
76
107
|
#Return content only for html
|
|
77
108
|
def to_doc( target, options = {})
|
|
78
109
|
target == :html ? @source.to_doc( target, options ) : ''
|
|
@@ -90,8 +121,8 @@ Pro:
|
|
|
90
121
|
Cons:
|
|
91
122
|
-unexpected conversions?
|
|
92
123
|
=end
|
|
93
|
-
class Creole_latex <
|
|
94
|
-
|
|
124
|
+
class Creole_latex < Placeholder
|
|
125
|
+
set_placeholder_key 'latex'
|
|
95
126
|
#Return content only for latex
|
|
96
127
|
def to_doc( target, options = {})
|
|
97
128
|
target == :latex ? @source.to_doc( target, options ) : ''
|
|
@@ -101,8 +132,8 @@ end #Creole_latex
|
|
|
101
132
|
#
|
|
102
133
|
#Collect
|
|
103
134
|
#
|
|
104
|
-
class Creole_comment <
|
|
105
|
-
|
|
135
|
+
class Creole_comment < Placeholder
|
|
136
|
+
set_placeholder_key 'comment'
|
|
106
137
|
#Return content as a comment
|
|
107
138
|
def to_doc( target, options = {})
|
|
108
139
|
case target
|
|
@@ -124,13 +155,16 @@ class Creole_comment < Creole_placeholder
|
|
|
124
155
|
def to_creole(options = {})
|
|
125
156
|
return "<<<comment\n#{@source.join}>>>"
|
|
126
157
|
end
|
|
127
|
-
end #
|
|
158
|
+
end #Creole_comment
|
|
159
|
+
|
|
160
|
+
end #module Placeholders
|
|
161
|
+
|
|
162
|
+
end #module Creole
|
|
163
|
+
end #module Docgenerator
|
|
128
164
|
|
|
129
165
|
|
|
130
166
|
__END__
|
|
131
167
|
To be done:
|
|
132
|
-
class Creole_rail
|
|
133
|
-
class Creole_struktogramm
|
|
134
168
|
rubycode (see plugin Creole_plugin_ruby )
|
|
135
169
|
|
|
136
170
|
Steuerparameter mit | nach plugin-name?
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
=begin rdoc
|
|
2
|
+
Creole plugins
|
|
3
|
+
|
|
4
|
+
This classes define plugins for creole.
|
|
5
|
+
|
|
6
|
+
Plugins are used later with <<xx>>
|
|
7
|
+
more at http://www.wikicreole.org/wiki/Plugin
|
|
8
|
+
|
|
9
|
+
You can extend Wikis with additional Plugin:
|
|
10
|
+
|
|
11
|
+
wiki = Creole.new()
|
|
12
|
+
wiki.plugin['xxx'] = Creole_plugin_xxx
|
|
13
|
+
=end
|
|
14
|
+
|
|
15
|
+
#
|
|
16
|
+
|
|
17
|
+
module Docgenerator
|
|
18
|
+
module Creole
|
|
19
|
+
|
|
20
|
+
=begin rdoc
|
|
21
|
+
Creole plugins
|
|
22
|
+
|
|
23
|
+
This classes define plugins for creole.
|
|
24
|
+
|
|
25
|
+
Plugins are used later with <<xx>>
|
|
26
|
+
more at http://www.wikicreole.org/wiki/Plugin
|
|
27
|
+
|
|
28
|
+
You can extend Wikis with additional Plugin:
|
|
29
|
+
|
|
30
|
+
wiki = Creole.new()
|
|
31
|
+
wiki.plugin['xxx'] = Creole_plugin_xxx
|
|
32
|
+
=end
|
|
33
|
+
module Plugins
|
|
34
|
+
|
|
35
|
+
=begin rdoc
|
|
36
|
+
Default Plugin for Creole.
|
|
37
|
+
<<xx>>
|
|
38
|
+
=end
|
|
39
|
+
class Creole_default_plugin < Creole_inclusion_and_plugin
|
|
40
|
+
def initialize( pluginname, description, options, wiki )
|
|
41
|
+
super
|
|
42
|
+
@wiki.log.warn("Use Default plugin instead requested #{pluginname}- nothing special done.") if @wiki.log.warn?
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
#Collection of Plugins
|
|
47
|
+
Collection = Hash.new(Creole_default_plugin)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
=begin rdoc
|
|
51
|
+
Collection of footnotes.
|
|
52
|
+
|
|
53
|
+
Makes sense for HTML-output.
|
|
54
|
+
|
|
55
|
+
For LaTeX the support of bigfoot/manyfoot... may be an idea.
|
|
56
|
+
=end
|
|
57
|
+
class Creole_footnote_group < Creole_inclusion_and_plugin
|
|
58
|
+
#
|
|
59
|
+
|
|
60
|
+
Collection['footnotes'] = self
|
|
61
|
+
|
|
62
|
+
def initialize( inclusionname, description, options, wiki )
|
|
63
|
+
super
|
|
64
|
+
description = Footnotegroup::DEFAULTGROUPID unless description
|
|
65
|
+
@footnotesgroup = wiki.footnotegroups[description]
|
|
66
|
+
wiki.log.error("Footnotesgroup #{description.inspect} not found") if ! @footnotesgroup and wiki.log.error?
|
|
67
|
+
end
|
|
68
|
+
=begin rdoc
|
|
69
|
+
Call Docgenerator::Footnotegroup#to_doc
|
|
70
|
+
=end
|
|
71
|
+
def to_doc(target, options = {})
|
|
72
|
+
#remove options for Docgenerator::Footnotegroup
|
|
73
|
+
l_options = options.dup
|
|
74
|
+
l_options.delete(:plugins)
|
|
75
|
+
l_options.delete(:inclusions)
|
|
76
|
+
@footnotesgroup.to_doc(target, l_options)
|
|
77
|
+
end
|
|
78
|
+
end #Creole_inclusion_footnote_group
|
|
79
|
+
|
|
80
|
+
=begin rdoc
|
|
81
|
+
One footnote
|
|
82
|
+
|
|
83
|
+
Usage:
|
|
84
|
+
<<footnote|text>>
|
|
85
|
+
<<footnote|text|label=l1>>
|
|
86
|
+
<<footnote|text|groupid=g1>>
|
|
87
|
+
|
|
88
|
+
Bug: If you create more documents, you get a common footnote counting.
|
|
89
|
+
|
|
90
|
+
Solution:
|
|
91
|
+
* LaTeX: no problem, LaTeX has it's own output mechanism.
|
|
92
|
+
* HTML: Use grouping.
|
|
93
|
+
=end
|
|
94
|
+
class Creole_footnote < Creole_inclusion_and_plugin
|
|
95
|
+
Collection['footnote'] = self
|
|
96
|
+
|
|
97
|
+
def initialize( inclusionname, description, options, wiki )
|
|
98
|
+
super
|
|
99
|
+
|
|
100
|
+
@groupid = Footnotegroup::DEFAULTGROUPID
|
|
101
|
+
label = nil
|
|
102
|
+
|
|
103
|
+
options.each{|option|
|
|
104
|
+
case option
|
|
105
|
+
when /label\s*=\s*(.*)/
|
|
106
|
+
label = $1
|
|
107
|
+
when /groupid\s*=\s*(.*)/
|
|
108
|
+
@groupid = $1
|
|
109
|
+
else
|
|
110
|
+
@wiki.log.warn("Footnote with unknown option #{option.inspect} not found") if @wiki.log.warn?
|
|
111
|
+
end
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if ! wiki.footnotegroups[@groupid]
|
|
115
|
+
wiki.footnotegroups[@groupid] = Footnotegroup.new(@groupid)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
group = wiki.footnotegroups[@groupid]
|
|
119
|
+
|
|
120
|
+
@footnote = element(:footnote,{
|
|
121
|
+
:group => group,
|
|
122
|
+
:label => label,
|
|
123
|
+
}, description )
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
end
|
|
127
|
+
def to_doc(target, options ={})
|
|
128
|
+
@footnote.to_doc(target, options)
|
|
129
|
+
end
|
|
130
|
+
end #Creole_inclusion_footnote
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
=begin rdoc
|
|
134
|
+
Eval the given ruby-code and put it as "raw text".
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
This is defined as a plugin.
|
|
138
|
+
=end
|
|
139
|
+
class Creole_plugin_ruby_raw < Creole_inclusion_and_plugin
|
|
140
|
+
set_plugin_key 'ruby_raw'
|
|
141
|
+
|
|
142
|
+
def initialize( inclusionname, description, options, wiki )
|
|
143
|
+
#The ruby-code may contain | - so we have to ad it again
|
|
144
|
+
description << "|#{options.join('|')}" unless options.empty?
|
|
145
|
+
options = nil
|
|
146
|
+
super
|
|
147
|
+
@code = description
|
|
148
|
+
begin
|
|
149
|
+
@result = eval(@code)
|
|
150
|
+
rescue => bang
|
|
151
|
+
wiki.log.error("Plugin ruby_raw: <#{@code}> results in #{bang.class}/#{bang}") if wiki.log.error?
|
|
152
|
+
end
|
|
153
|
+
end #initioliaze
|
|
154
|
+
def to_doc(target, options ={})
|
|
155
|
+
@result.to_s
|
|
156
|
+
end
|
|
157
|
+
def inspect()
|
|
158
|
+
"#<Creole_plugin_ruby_raw:#{@code}>"
|
|
159
|
+
end
|
|
160
|
+
end #Creole_plugin_ruby
|
|
161
|
+
|
|
162
|
+
=begin rdoc
|
|
163
|
+
Eval the given ruby-code and add it as a interpreted code.
|
|
164
|
+
|
|
165
|
+
This is defined as a plugin.
|
|
166
|
+
|
|
167
|
+
Ideas for further development: eval later, at doc generation.
|
|
168
|
+
=end
|
|
169
|
+
class Creole_plugin_ruby < Creole_inclusion_and_plugin
|
|
170
|
+
set_plugin_key 'ruby'
|
|
171
|
+
|
|
172
|
+
def initialize( inclusionname, description, options, wiki )
|
|
173
|
+
#The ruby-code may contain | - so we have to ad it again
|
|
174
|
+
description << "|#{options.join('|')}" unless options.empty?
|
|
175
|
+
options = nil
|
|
176
|
+
super
|
|
177
|
+
|
|
178
|
+
@code = description
|
|
179
|
+
begin
|
|
180
|
+
@result = eval(@code)
|
|
181
|
+
rescue => bang
|
|
182
|
+
wiki.log.error("Plugin ruby: <#{@code}> results in #{bang.class}/#{bang}") if wiki.log.error?
|
|
183
|
+
end
|
|
184
|
+
end #initioliaze
|
|
185
|
+
def to_doc(target, options = {})
|
|
186
|
+
@wiki.normsource2elements(
|
|
187
|
+
@wiki.parse(@result.to_s ), options
|
|
188
|
+
).to_doc(target, options )
|
|
189
|
+
end
|
|
190
|
+
def inspect()
|
|
191
|
+
"#<Creole_plugin_ruby:#{@code}>"
|
|
192
|
+
end
|
|
193
|
+
end #Creole_plugin_ruby
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
end #module Plugins
|
|
197
|
+
end #module Creole
|
|
198
|
+
end #module Docgenerator
|
|
@@ -16,6 +16,8 @@ lineoptions:
|
|
|
16
16
|
fixme
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
module Docgenerator
|
|
20
|
+
module Creole
|
|
19
21
|
|
|
20
22
|
=begin
|
|
21
23
|
"Original" creole tab.
|
|
@@ -33,8 +35,8 @@ Usage:
|
|
|
33
35
|
|also |align\\ it. |
|
|
34
36
|
|
|
35
37
|
=end
|
|
36
|
-
class
|
|
37
|
-
|
|
38
|
+
class Creole_tab < Placeholder
|
|
39
|
+
set_placeholder_key 'creole_tabular' #original creole-tab definition
|
|
38
40
|
|
|
39
41
|
#Extend the class by a little structure
|
|
40
42
|
Cell = Struct.new('Cell', :content, :type )
|
|
@@ -91,6 +93,8 @@ Usage:
|
|
|
91
93
|
<<<tabular
|
|
92
94
|
|!columns=3
|
|
93
95
|
|!columndescription=ccc
|
|
96
|
+
|!border=1px
|
|
97
|
+
|!css= color: red
|
|
94
98
|
|=1
|
|
95
99
|
|=2
|
|
96
100
|
|=3
|
|
@@ -113,8 +117,8 @@ You can add additional settings to cells:
|
|
|
113
117
|
|||class=empty
|
|
114
118
|
>>>
|
|
115
119
|
=end
|
|
116
|
-
class Creole_tabular <
|
|
117
|
-
|
|
120
|
+
class Creole_tabular < Placeholder
|
|
121
|
+
set_placeholder_key 'tabular'
|
|
118
122
|
|
|
119
123
|
#Extend the class by a little structure
|
|
120
124
|
class Cell
|
|
@@ -182,6 +186,8 @@ Supported additional settings:
|
|
|
182
186
|
case $~.post_match().strip
|
|
183
187
|
when /columns\s*=\s*(.*)/
|
|
184
188
|
options[:columns] = $1.to_i
|
|
189
|
+
when /border\s*=\s*(.*)/
|
|
190
|
+
options[:border] = $1
|
|
185
191
|
when /columndescription\s*=\s*(.*)/
|
|
186
192
|
options[:columndescription] = $1
|
|
187
193
|
when /css\s*=\s*(.*)\s*:\s*(.*)/
|
|
@@ -225,12 +231,13 @@ Supported additional settings:
|
|
|
225
231
|
def to_doc( target, options = {})
|
|
226
232
|
@tab.to_doc( target, options )
|
|
227
233
|
end
|
|
228
|
-
|
|
229
234
|
end
|
|
235
|
+
end #module Creole
|
|
236
|
+
end #module Docgenerator
|
|
230
237
|
|
|
231
238
|
|
|
232
239
|
if $0 == __FILE__
|
|
233
|
-
creole = Creole.new(
|
|
240
|
+
creole = Docgenerator::Creole::Creole.new(
|
|
234
241
|
:name => 'tabular_creole',
|
|
235
242
|
:content => <<'creole'
|
|
236
243
|
<<<tabular
|
|
@@ -238,15 +245,16 @@ if $0 == __FILE__
|
|
|
238
245
|
>>>
|
|
239
246
|
creole
|
|
240
247
|
)
|
|
241
|
-
|
|
248
|
+
p creole.to_html #testcode
|
|
242
249
|
end
|
|
243
250
|
__END__
|
|
244
251
|
|
|
245
252
|
class Creole_tabular_cvs
|
|
246
|
-
include
|
|
253
|
+
include Placeholder
|
|
247
254
|
>>>tab
|
|
248
255
|
|! Tabdefinition crl
|
|
249
256
|
|! implizit columns
|
|
257
|
+
|! border=1px
|
|
250
258
|
|= -> th
|
|
251
259
|
yy;yy;yy;
|
|
252
260
|
yy;yy;yy;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
=begin rdoc
|
|
2
|
+
Support for the rail package.
|
|
3
|
+
|
|
4
|
+
This is support for LaTeX-style rail.
|
|
5
|
+
Don't be confused with ruby on rails - there is no intersection of the two packages.
|
|
6
|
+
=end
|
|
7
|
+
|
|
8
|
+
require 'creole/creole2doc'
|
|
9
|
+
|
|
10
|
+
module Docgenerator
|
|
11
|
+
module Creole
|
|
12
|
+
=begin rdoc
|
|
13
|
+
Support for the rail package.
|
|
14
|
+
|
|
15
|
+
This is support for LaTeX-style rail.
|
|
16
|
+
|
|
17
|
+
* http://www.ctan.org/tex-archive/support/rail/
|
|
18
|
+
=end
|
|
19
|
+
module Rail
|
|
20
|
+
|
|
21
|
+
#
|
|
22
|
+
#A Wrapper for the Creole-placeholder for Rail-diagramms.
|
|
23
|
+
#
|
|
24
|
+
class Diagramm4Creole < Placeholder
|
|
25
|
+
set_placeholder_key 'rail'
|
|
26
|
+
|
|
27
|
+
def initialize( wiki, name = 'Raildiagramm')
|
|
28
|
+
super
|
|
29
|
+
@name = name
|
|
30
|
+
raise ParameterError, "Missing id for rail-diagramm" unless @name
|
|
31
|
+
raise ParameterError, "Id for rail-diagramm contains no-letter" unless @name =~ /\A\w+\Z/
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
#fixme
|
|
35
|
+
#Check if the rail-diagramm is available as a picture.
|
|
36
|
+
#~ @filename = "#{@key}.png"
|
|
37
|
+
#~ if ! File.exist?( @filename )
|
|
38
|
+
#~ @filename = nil
|
|
39
|
+
#~ end
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
=begin rdoc
|
|
43
|
+
Return content only for LaTeX
|
|
44
|
+
=end
|
|
45
|
+
def to_doc( target, options = {})
|
|
46
|
+
#fixme: Einmalig beim initialisieren
|
|
47
|
+
#fixme: Varianten erledigen
|
|
48
|
+
#fixme: Bild falls verf�gbar
|
|
49
|
+
#fixme: nur TeX (oder Bild)
|
|
50
|
+
#fixme logs
|
|
51
|
+
#~ case options[:elementtype]
|
|
52
|
+
#~ when nil #ignore diagramm
|
|
53
|
+
#~ when :minipage
|
|
54
|
+
#~ return to_element_minipage()
|
|
55
|
+
#~ when :figure
|
|
56
|
+
#~ return to_element_figure()
|
|
57
|
+
#~ when :figure_img
|
|
58
|
+
#~ return to_element_figure_img()
|
|
59
|
+
#~ when :latexonly
|
|
60
|
+
#~ return element(:latexonly,{}, self.to_latex_rail ).cr
|
|
61
|
+
#~ else
|
|
62
|
+
#~ option[:log].error("Raildiagramm#to_element: Undefined type #{@@elementtype}") if option[:log].error?
|
|
63
|
+
#~ end
|
|
64
|
+
|
|
65
|
+
#fixme Bild?
|
|
66
|
+
Rail_diagramm.new( @name, @source ).to_doc( target, options )
|
|
67
|
+
end
|
|
68
|
+
#Check for picture and return a :img-macro (Only html)
|
|
69
|
+
def to_img()
|
|
70
|
+
return element( :img, { :src => @filename }) if @filename
|
|
71
|
+
end
|
|
72
|
+
#~ def to_element_figure()
|
|
73
|
+
#~ figure = element(:figure).cr
|
|
74
|
+
#~ figure << self.to_s
|
|
75
|
+
#~ figure << element(:caption,{}, "Rail-Diagramm #{@key}" ).Cr
|
|
76
|
+
#~ return figure
|
|
77
|
+
#~ end
|
|
78
|
+
#~ def to_element_figure_img()
|
|
79
|
+
#~ if @filename
|
|
80
|
+
#~ figure = element(:figure, { :style => CSS.new(
|
|
81
|
+
#~ :text_align => 'center',
|
|
82
|
+
#~ :float => 'right'
|
|
83
|
+
#~ )}).cr
|
|
84
|
+
#~ figure << self.to_img
|
|
85
|
+
#~ figure << element(:br).cr
|
|
86
|
+
#~ figure << element(:caption,{}, "Rail-Diagramm #{@key}" ).Cr
|
|
87
|
+
#~ else
|
|
88
|
+
#~ figure = nil
|
|
89
|
+
#~ end
|
|
90
|
+
#~ return figure
|
|
91
|
+
#~ end
|
|
92
|
+
#~ #Requires caption.sty
|
|
93
|
+
#~ # doc.head << element(:usepackage,{}, 'caption')
|
|
94
|
+
#~ def to_element_minipage()
|
|
95
|
+
#~ figure = element(:minipage, {:width => '\textwidth'} ).CR
|
|
96
|
+
#~ figure << element(:centering)
|
|
97
|
+
#~ figure << self.to_s
|
|
98
|
+
#~ figure << element(:captionof,{ :float_type => 'figure' }, "Rail-Diagramm #{@key}" ).Cr
|
|
99
|
+
#~ return figure
|
|
100
|
+
#~ end
|
|
101
|
+
end #Rail_diagramm4Creole
|
|
102
|
+
|
|
103
|
+
#
|
|
104
|
+
#A Rail-diagramm
|
|
105
|
+
#
|
|
106
|
+
class Rail_diagramm
|
|
107
|
+
|
|
108
|
+
#Can be used in document header to load rail.sty
|
|
109
|
+
TEX_PACKAGE_RAIL = element(:usepackage,{ }, 'rail').cr
|
|
110
|
+
#Some command to be added in document header.
|
|
111
|
+
#Allows the usage of some characters as terminals.
|
|
112
|
+
RAIL_ALIAS = <<'RAIL_ALIAS'
|
|
113
|
+
\railalias{lbrace}{\{}
|
|
114
|
+
\railalias{rbrace}{\}}
|
|
115
|
+
\railalias{dollar}{\$}
|
|
116
|
+
\railalias{underscore}{\_}
|
|
117
|
+
\railalias{percent}{\%}
|
|
118
|
+
\railalias{at}{@}
|
|
119
|
+
\railalias{atat}{@@}
|
|
120
|
+
% \railalias{backslash}{\char"5C}
|
|
121
|
+
\railalias{backslash}{\ensuremath{\backslash}}
|
|
122
|
+
\railalias{lt}{\ensuremath{<}}
|
|
123
|
+
\railalias{le}{\ensuremath{<=}}
|
|
124
|
+
\railalias{gt}{\ensuremath{>}}
|
|
125
|
+
\railalias{ge}{\ensuremath{>=}}
|
|
126
|
+
\railalias{caret}{\ensuremath{\hat{}}}
|
|
127
|
+
\railalias{tildeeq}{\ensuremath{\sim=}}
|
|
128
|
+
\railalias{quote}{'}
|
|
129
|
+
\railalias{dquote}{"}%german: \dq
|
|
130
|
+
\railterm{quote,dquote}
|
|
131
|
+
\railterm{lbrace,rbrace,dollar,percent,backslash,underscore,at,atat}
|
|
132
|
+
\railterm{lt,le,gt,ge,caret,tildeeq}
|
|
133
|
+
RAIL_ALIAS
|
|
134
|
+
#~ \railalias{ampersand}{\&} -> umgesetht nachh << head>>
|
|
135
|
+
|
|
136
|
+
#Create new Rail diagramm.
|
|
137
|
+
#Parameter:
|
|
138
|
+
#-key
|
|
139
|
+
#-rail-definition
|
|
140
|
+
def initialize( key, code = '' )
|
|
141
|
+
@key = key
|
|
142
|
+
@code = code
|
|
143
|
+
end
|
|
144
|
+
#Implement << for Wikicollector
|
|
145
|
+
def << (code)
|
|
146
|
+
@code << code
|
|
147
|
+
end
|
|
148
|
+
=begin
|
|
149
|
+
Return LaTeX-environment rail
|
|
150
|
+
Requires rail.sty and rail.exe to generate the figure.
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
=end
|
|
154
|
+
def to_latex(options = {})
|
|
155
|
+
@code = @code.join if @code.respond_to?(:join) #if Array is given
|
|
156
|
+
return <<-RAIL
|
|
157
|
+
%
|
|
158
|
+
% Define a rail-diagramm #{@key}
|
|
159
|
+
%
|
|
160
|
+
\\begin{rail}
|
|
161
|
+
#{@key} :
|
|
162
|
+
#{@code.chomp}
|
|
163
|
+
;
|
|
164
|
+
\\end{rail}
|
|
165
|
+
RAIL
|
|
166
|
+
end #to_latex
|
|
167
|
+
def to_doc( target, options = {})
|
|
168
|
+
case target
|
|
169
|
+
when :latex
|
|
170
|
+
self.to_latex( options )
|
|
171
|
+
else
|
|
172
|
+
o = set_option_defaults(options)
|
|
173
|
+
#~ o[:log].debug("enter to_doc(#{target}) for #{self.inspect}, options: #{options.keys.inspect}") if o[:log].debug?
|
|
174
|
+
o[:log].error("Rail-diagramm not supported for #{target}") if o[:log].error?
|
|
175
|
+
''
|
|
176
|
+
end #case target
|
|
177
|
+
end #to_doc
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
end #module Rail
|
|
181
|
+
end #module Creole
|
|
182
|
+
end #module Docgenerator
|