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
data/self_docgenerator.rb
DELETED
@@ -1,163 +0,0 @@
|
|
1
|
-
#
|
2
|
-
#This program creates element-description in TARGETDIR
|
3
|
-
#
|
4
|
-
require 'docgenerator'
|
5
|
-
require 'wiki2doc/wiki2docgenerator'
|
6
|
-
puts "==> Version #{Gem.loaded_specs['docgenerator'].version}"
|
7
|
-
TARGETDIR = 'self_docgenerator'
|
8
|
-
|
9
|
-
|
10
|
-
class DocElement
|
11
|
-
@@all = []
|
12
|
-
def initialize(objekt)
|
13
|
-
@@all << self
|
14
|
-
@el_class = objekt
|
15
|
-
@el_object = objekt.new()
|
16
|
-
@el_object.ids.each{|key|
|
17
|
-
@key = key if "#{key}" =~ /\A[A-Za-z]+\Z/
|
18
|
-
break if @key
|
19
|
-
}
|
20
|
-
@el_object << 'content' if @el_object.content?
|
21
|
-
puts "No key: #{objekt.inspect}" if ! @key
|
22
|
-
end
|
23
|
-
attr_reader :key
|
24
|
-
attr_reader :el_object
|
25
|
-
def self.each()
|
26
|
-
@@all.uniq!
|
27
|
-
@@all.each{|o| yield o }
|
28
|
-
end
|
29
|
-
|
30
|
-
def mk_doc( nav )
|
31
|
-
descr = []
|
32
|
-
descr << element(:label,{ :name => @key }).cr
|
33
|
-
descr << element(:h2,{}, @el_object.ids.join(', ')).cr
|
34
|
-
#~ descr << @el_class.inspect
|
35
|
-
descr << element(:h3, {}, 'Ids' ).cr
|
36
|
-
descr << ul = element(:ul).cr
|
37
|
-
@el_object.ids.map{|id| ul << element(:li, {}, id) }
|
38
|
-
|
39
|
-
#
|
40
|
-
#Attributes
|
41
|
-
#
|
42
|
-
descr << element(:h3, {}, "Attributes").cr
|
43
|
-
attr_code = [] #attr-list for usage
|
44
|
-
if Element.get_attribute_list( @el_class ).empty?
|
45
|
-
descr << element(:p, {}, "No attributes available").cr
|
46
|
-
else
|
47
|
-
descr << attr_tab = element(:tabular, { :columns => 10, :border => '1px' } ).cr
|
48
|
-
#title
|
49
|
-
attr_tab << row = element(:row).cr
|
50
|
-
row << element(:col, {}, 'Attribute' ).cr
|
51
|
-
[ :required, :content, :unique,
|
52
|
-
:html, :latex, :text, :wiki, :texkeyval
|
53
|
-
].map{ |akey|
|
54
|
-
row << element(:col, {:align => 'center'}, akey ).cr
|
55
|
-
}
|
56
|
-
row << element(:col, {:align => 'center'}, 'Allowed values' ).cr
|
57
|
-
#description of attributes
|
58
|
-
@el_object.attr.sort_by{|key, attr|attr.sortkey}.each{|key, attr|
|
59
|
-
attr_tab << row = element(:row).cr
|
60
|
-
row << element(:col,{}, key)
|
61
|
-
[ :required, :content, :unique,
|
62
|
-
:html, :latex, :text, :wiki, :texkeyval
|
63
|
-
].map{ |akey|
|
64
|
-
if @el_object[key].send("#{akey}?".to_sym )
|
65
|
-
row << element(:col,{:align => 'center'}, element(:radic ))
|
66
|
-
else
|
67
|
-
row << element(:col,{:align => 'center'},element(:empty ))
|
68
|
-
end
|
69
|
-
}
|
70
|
-
row << element(:col,{},
|
71
|
-
@el_object[key].allowed_values ? @el_object[key].allowed_values.join(", ") : nil
|
72
|
-
)
|
73
|
-
|
74
|
-
attr_code << "\t\t#{key} => "
|
75
|
-
attr_code.last << @el_object[key].allowed_values.join("|") if @el_object[key].allowed_values
|
76
|
-
} #Attributelist
|
77
|
-
end #Attributes
|
78
|
-
|
79
|
-
descr << element(:h3, {}, "Output").cr
|
80
|
-
descr << element(:p, {}, "As example content, the text 'content' was added.").cr if @el_object.content?
|
81
|
-
descr << tab = element(:tabular, { :columns => 3, :border => '1px' } ).cr
|
82
|
-
tab << row = element(:row).cr
|
83
|
-
row << element(:col,{}, 'HTML')
|
84
|
-
row << element(:col,{}, element(:pre, {}, @el_object.to_html))
|
85
|
-
row << element(:col,{}, element(:pre, {}, @el_object.htmltag))
|
86
|
-
tab << row = element(:row).cr
|
87
|
-
row << element(:col,{}, 'LaTeX')
|
88
|
-
row << element(:col,{}, element(:pre, {}, @el_object.to_latex))
|
89
|
-
tab << row = element(:row).cr
|
90
|
-
row << element(:col,{}, 'Wiki')
|
91
|
-
row << element(:col,{}, element(:pre, {}, @el_object.to_wiki))
|
92
|
-
tab << row = element(:row).cr
|
93
|
-
row << element(:col,{}, 'Text')
|
94
|
-
row << element(:col,{}, element(:pre, {}, @el_object.to_text))
|
95
|
-
|
96
|
-
descr << element(:h2, {}, "Usage:").cr
|
97
|
-
code = "element( #{@key.inspect}"
|
98
|
-
if attr_code.empty?
|
99
|
-
code << ", {}, " if @el_object.content?
|
100
|
-
else
|
101
|
-
code << ", {\n#{attr_code.join("\n")}\n\t}"
|
102
|
-
end
|
103
|
-
code << ", 'content'" if @el_object.content?
|
104
|
-
code << ' )'
|
105
|
-
descr << element(:pre, {}, code ).cr
|
106
|
-
|
107
|
-
doc = Document.new(
|
108
|
-
:title => "selfdocgenerator: #{@el_object.ids.join(', ')}"
|
109
|
-
)
|
110
|
-
doc.body << nav
|
111
|
-
doc.body << descr
|
112
|
-
at_exit{ doc.save("#{TARGETDIR}/#{@key}.html") }
|
113
|
-
return "#{@key}.html"
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
ObjectSpace.garbage_collect
|
118
|
-
ObjectSpace.each_object(Class){|o|
|
119
|
-
DocElement.new(o) if o.ancestors.include?(Element)
|
120
|
-
}
|
121
|
-
|
122
|
-
doc = Document.new(
|
123
|
-
:title => 'Element Overview for docgenerator.rb'
|
124
|
-
)
|
125
|
-
#~ doc.body << element(:tableofcontents).cr
|
126
|
-
wiki = Wikitext.new(:content => <<wiki
|
127
|
-
==Element-Overview for docgenerator.rb, version #{Gem.loaded_specs['docgenerator'].version}==
|
128
|
-
This overview is generated by #{__FILE__}.
|
129
|
-
|
130
|
-
.
|
131
|
-
wiki
|
132
|
-
)
|
133
|
-
#Index to all elements
|
134
|
-
index = {}
|
135
|
-
nav = element(:ul)
|
136
|
-
letters = []
|
137
|
-
DocElement.each{|o|
|
138
|
-
odoc = o.mk_doc( nav )
|
139
|
-
o.el_object.ids.each{|id|
|
140
|
-
index[id] = element(:href, { :href => "#{odoc}" }, id )
|
141
|
-
letters << id.to_s[0,1]
|
142
|
-
}
|
143
|
-
}
|
144
|
-
#Prepare letters
|
145
|
-
'A'.upto('Z'){|letter| wiki << "[[##{letter}|#{letter}]] " if letters.include?(letter)}
|
146
|
-
'a'.upto('z'){|letter| wiki << "[[##{letter}|#{letter}]] " if letters.include?(letter)}
|
147
|
-
|
148
|
-
doc.body << wiki
|
149
|
-
doc.body << element(:h1,{},"Index")
|
150
|
-
act_letter = nil
|
151
|
-
doc.body << indexlist = element(:ul).cr
|
152
|
-
index.sort_by{|id, entry| id.to_s }.map{|id, entry|
|
153
|
-
if act_letter != id.to_s[0..0] and id.to_s[0..0] =~ /\w/
|
154
|
-
act_letter = id.to_s[0..0]
|
155
|
-
doc.body << element(:label, { :name => "#{act_letter}" })
|
156
|
-
doc.body << element(:h2,{},act_letter )
|
157
|
-
doc.body << indexlist = element(:ul).cr
|
158
|
-
end
|
159
|
-
indexlist << element(:li,{}, entry).cr
|
160
|
-
nav << element(:li,{:style => CSS.new(:display => 'inline') }, [ entry, ' - '] )
|
161
|
-
}
|
162
|
-
|
163
|
-
doc.save("#{TARGETDIR}/_command_overview.html" )
|
@@ -1,55 +0,0 @@
|
|
1
|
-
<p ><span >
|
2
|
-
<img src = "test.jpg" />
|
3
|
-
</span>
|
4
|
-
|
5
|
-
</p>
|
6
|
-
<p ><span >
|
7
|
-
<img src = "test.jpg" alt = "description" />
|
8
|
-
</span>
|
9
|
-
|
10
|
-
<span >
|
11
|
-
vorher<img src = "test.jpg" alt = "description" /><br clear = "all" />
|
12
|
-
</span>
|
13
|
-
|
14
|
-
<span >
|
15
|
-
<img src = "test.jpg" alt = "description" /><br clear = "all" />
|
16
|
-
nachher
|
17
|
-
</span>
|
18
|
-
|
19
|
-
</p>
|
20
|
-
<p ><span >
|
21
|
-
<a href = "http://ruby.lickert.net" ><img src = "test.jpg" /></a>
|
22
|
-
</span>
|
23
|
-
|
24
|
-
<span >
|
25
|
-
<a href = "http://ruby.lickert.net" ><img src = "test.jpg" alt = "test" /></a>
|
26
|
-
</span>
|
27
|
-
|
28
|
-
</p>
|
29
|
-
<p ><span style = "float: right;" >
|
30
|
-
<img src = "test.jpg" />
|
31
|
-
</span>
|
32
|
-
|
33
|
-
<span style = "float: left;" >
|
34
|
-
<img src = "test.jpg" />
|
35
|
-
</span>
|
36
|
-
|
37
|
-
</p>
|
38
|
-
<p ><span >
|
39
|
-
<img src = "test.jpg" style = "width: 123px;" />
|
40
|
-
</span>
|
41
|
-
|
42
|
-
</p>
|
43
|
-
<p ><span >
|
44
|
-
<img src = "test.jpg" class = "pictureclass" />
|
45
|
-
</span>
|
46
|
-
|
47
|
-
<span >
|
48
|
-
<img src = "test.jpg" class = "imgclass" />
|
49
|
-
</span>
|
50
|
-
|
51
|
-
<span class = "imgclass" >
|
52
|
-
<img src = "test.jpg" />
|
53
|
-
</span>
|
54
|
-
|
55
|
-
</p>
|
@@ -1,76 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
\bgroup
|
4
|
-
\includegraphics[]{test.jpg}
|
5
|
-
\egroup
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
\bgroup
|
12
|
-
\includegraphics[]{test.jpg}
|
13
|
-
\egroup
|
14
|
-
|
15
|
-
\bgroup
|
16
|
-
vorher\includegraphics[]{test.jpg}\newline
|
17
|
-
|
18
|
-
\egroup
|
19
|
-
|
20
|
-
\bgroup
|
21
|
-
\includegraphics[]{test.jpg}\newline
|
22
|
-
nachher
|
23
|
-
\egroup
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
\bgroup
|
30
|
-
\href{http://ruby.lickert.net}{\includegraphics[]{test.jpg}}
|
31
|
-
|
32
|
-
\egroup
|
33
|
-
|
34
|
-
\bgroup
|
35
|
-
\href{http://ruby.lickert.net}{\includegraphics[]{test.jpg}}
|
36
|
-
|
37
|
-
\egroup
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
\bgroup
|
44
|
-
\includegraphics[]{test.jpg}
|
45
|
-
\egroup
|
46
|
-
|
47
|
-
\bgroup
|
48
|
-
\includegraphics[]{test.jpg}
|
49
|
-
\egroup
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
\bgroup
|
56
|
-
\includegraphics[width={123px}]{test.jpg}
|
57
|
-
\egroup
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
\bgroup
|
64
|
-
\includegraphics[]{test.jpg}
|
65
|
-
\egroup
|
66
|
-
|
67
|
-
\bgroup
|
68
|
-
\includegraphics[]{test.jpg}
|
69
|
-
\egroup
|
70
|
-
|
71
|
-
\bgroup
|
72
|
-
\includegraphics[]{test.jpg}
|
73
|
-
\egroup
|
74
|
-
|
75
|
-
|
76
|
-
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# encoding: ASCII-8BIT
|
2
|
-
|
3
|
-
#
|
4
|
-
#This test rake must be in this directory.
|
5
|
-
#If not, we get a problem with
|
6
|
-
#require 'assert_equal_filecontent.rb'
|
7
|
-
#
|
8
|
-
|
9
|
-
#~ require 'ftools'
|
10
|
-
require 'rake'
|
11
|
-
require 'rake/testtask.rb'
|
12
|
-
|
13
|
-
#~ FileList['unittest_tools/unittest_yaml2pres.rb'].each{|testfile|
|
14
|
-
FileList['unittest*.rb'].each{|testfile|
|
15
|
-
#~ next unless %w{unittest_rubycode4doc.rb}.include?(testfile)
|
16
|
-
Rake::TestTask.new(testfile) do |t|
|
17
|
-
t.libs << "../lib"
|
18
|
-
t.test_files = testfile
|
19
|
-
t.verbose = true
|
20
|
-
end
|
21
|
-
task :test => testfile
|
22
|
-
#~ puts "task :default => #{testfile.inspect}"
|
23
|
-
}
|
24
|
-
|
25
|
-
Rake::TestTask.new(:testall) do |t|
|
26
|
-
t.libs << "../lib"
|
27
|
-
t.test_files = FileList['unittest*.rb']
|
28
|
-
t.verbose = true
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
if $0 == __FILE__
|
33
|
-
desc "Default: "
|
34
|
-
task :default => :testall
|
35
|
-
#~ task :default => :test
|
36
|
-
#~ task :default => "unittest_creole2doc.rb"
|
37
|
-
#~ task :default => "unittest_docgenerator.rb"
|
38
|
-
#~ task :default => "unittest_wiki2doc.rb"
|
39
|
-
|
40
|
-
app = Rake.application
|
41
|
-
app[:default].invoke
|
42
|
-
|
43
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
if $0 == __FILE__
|
3
|
-
$:.unshift("../lib")
|
4
|
-
end
|
5
|
-
require 'docgenerator'
|
6
|
-
require 'creole/creole2doc'
|
7
|
-
require 'wiki2doc/wiki2docgenerator'
|
8
|
-
|
9
|
-
#
|
10
|
-
#Test the global VERSION-ID
|
11
|
-
#
|
12
|
-
class Test_version < Test::Unit::TestCase
|
13
|
-
|
14
|
-
def test_version()
|
15
|
-
actversion = '1.2.1'
|
16
|
-
assert_equal( actversion, Docgenerator::VERSION )
|
17
|
-
assert_equal( actversion, Document::VERSION)
|
18
|
-
assert_equal( actversion, Element::VERSION)
|
19
|
-
ObjectSpace.each_object( Element ){| element |
|
20
|
-
assert_equal( actversion, element.class::VERSION)
|
21
|
-
}
|
22
|
-
|
23
|
-
assert_equal( actversion, Creole::VERSION)
|
24
|
-
assert_equal( actversion, Creole_document::VERSION)
|
25
|
-
assert_equal( actversion, Creole_placeholder::VERSION)
|
26
|
-
ObjectSpace.each_object( Creole_placeholder){| element |
|
27
|
-
assert_equal( actversion, element.class::VERSION)
|
28
|
-
}
|
29
|
-
assert_equal( actversion, Creole_inclusion_and_plugin::VERSION)
|
30
|
-
ObjectSpace.each_object( Creole_inclusion_and_plugin){| element |
|
31
|
-
assert_equal( actversion, element.class::VERSION)
|
32
|
-
}
|
33
|
-
|
34
|
-
assert_equal( actversion, Wikitext::VERSION)
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
__END__
|
40
|
-
Verbessern:
|
41
|
-
|
42
|
-
Modul Docgenerator und Docgenerator_logger fusionieren?
|
43
|
-
Alles in Modul Docgenerator?
|
44
|
-
-> C:\usr\Experiment\Ruby\module --> in jeder Datei extra machen.
|
@@ -1,464 +0,0 @@
|
|
1
|
-
# encoding: ASCII-8BIT
|
2
|
-
require 'test/unit'
|
3
|
-
require 'more_unit_test/assert_equal_filecontent.rb'
|
4
|
-
|
5
|
-
if $0 == __FILE__
|
6
|
-
$:.unshift("../lib")
|
7
|
-
#~ $:.unshift("../lib_privat")
|
8
|
-
end
|
9
|
-
require 'wiki2doc/wiki2docgenerator'
|
10
|
-
|
11
|
-
$fixmes = []
|
12
|
-
|
13
|
-
END { puts $fixmes }
|
14
|
-
|
15
|
-
class Testcase < Test::Unit::TestCase
|
16
|
-
def test_wiki()
|
17
|
-
wiki = Wikitext.new(:content => <<wiki
|
18
|
-
==Titel 1==
|
19
|
-
Text
|
20
|
-
===Titel 2===
|
21
|
-
Text unter Titel 2
|
22
|
-
wiki
|
23
|
-
)
|
24
|
-
assert_equal_filecontent( "expected_wiki/test_wiki.html", wiki.to_doc(:html))
|
25
|
-
assert_equal_filecontent( "expected_wiki/test_wiki.latex", wiki.to_doc(:latex))
|
26
|
-
assert_equal_filecontent( "expected_wiki/test_wiki.wiki", wiki.to_doc(:wiki))
|
27
|
-
assert_equal_filecontent( "expected_wiki/test_wiki.text", wiki.to_doc(:text))
|
28
|
-
end
|
29
|
-
#
|
30
|
-
#Including the definition of a label tor the toc.
|
31
|
-
def test_wiki_toc()
|
32
|
-
wiki = Wikitext.new(:content => <<wiki
|
33
|
-
==Titel 1==
|
34
|
-
Text
|
35
|
-
===Titel 2===
|
36
|
-
Text unter Titel 2
|
37
|
-
===[2b]Titel 2b===
|
38
|
-
Text unter Titel 2b
|
39
|
-
wiki
|
40
|
-
)
|
41
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_toc.html", wiki.to_doc(:html))
|
42
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_toc.latex", wiki.to_doc(:latex))
|
43
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_toc.wiki", wiki.to_doc(:wiki))
|
44
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_toc.text", wiki.to_doc(:text))
|
45
|
-
end
|
46
|
-
def test_wiki_inline()
|
47
|
-
wiki = Wikitext.new(:content => <<wiki
|
48
|
-
Inline-Tags ''kursiv'', '''fett''', ''''kursiv und fett''''
|
49
|
-
|
50
|
-
''kursiv'',
|
51
|
-
'''fett''',
|
52
|
-
''''kursiv und fett''''
|
53
|
-
wiki
|
54
|
-
)
|
55
|
-
#fixme tex unklar. wie zwei dd-tags in tex nachbilden?
|
56
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_inline.html", wiki.to_doc(:html))
|
57
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_inline.latex", wiki.to_doc(:latex))
|
58
|
-
#~ bug! fixme
|
59
|
-
$fixmes << 'inline 2 wiki'
|
60
|
-
#~ assert_equal_filecontent( "expected_wiki/test_wiki_inline.wiki", wiki.to_doc(:wiki))
|
61
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_inline.text", wiki.to_doc(:text))
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_wiki_textformatting()
|
65
|
-
#Clear in newline is used by HTML (needed to handle floats)
|
66
|
-
wiki = Wikitext.new(:content => <<wiki
|
67
|
-
vorher{{newline}}Nachher
|
68
|
-
|
69
|
-
vorher{{newline|clear}}Nachher
|
70
|
-
----
|
71
|
-
Nach einer Trennlinie
|
72
|
-
wiki
|
73
|
-
)
|
74
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_textformatting.html", wiki.to_doc(:html))
|
75
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_textformatting.latex", wiki.to_doc(:latex))
|
76
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_textformatting.wiki", wiki.to_doc(:wiki))
|
77
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_textformatting.text", wiki.to_doc(:text))
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_wiki_label()
|
81
|
-
wiki = Wikitext.new(:content => <<wiki
|
82
|
-
[[label:a]]
|
83
|
-
|
84
|
-
text text
|
85
|
-
[[#a|hier]]
|
86
|
-
[[#a|hier]]
|
87
|
-
wiki
|
88
|
-
)
|
89
|
-
#~ fixme: TeX href hyperlabel??
|
90
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_label.html", wiki.to_doc(:html))
|
91
|
-
#~ assert_equal_filecontent( "expected_wiki/test_wiki_label.latex", wiki.to_doc(:latex))
|
92
|
-
#~ assert_equal_filecontent( "expected_wiki/test_wiki_label.wiki", wiki.to_doc(:wiki)) #fixme
|
93
|
-
#~ assert_equal_filecontent( "expected_wiki/test_wiki_label.text", wiki.to_doc(:text))
|
94
|
-
end
|
95
|
-
|
96
|
-
def test_wiki_list_ul()
|
97
|
-
wiki = Wikitext.new(:content => <<wiki
|
98
|
-
Text before
|
99
|
-
*Listentry 1
|
100
|
-
*Listentry 2
|
101
|
-
**Listentry 2.1
|
102
|
-
**Listentry 2.2
|
103
|
-
*Listentry 3
|
104
|
-
Text afterwords
|
105
|
-
wiki
|
106
|
-
)
|
107
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ul.html", wiki.to_doc(:html))
|
108
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ul.latex", wiki.to_doc(:latex))
|
109
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ul.wiki", wiki.to_doc(:wiki))
|
110
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ul.text", wiki.to_doc(:text))
|
111
|
-
end
|
112
|
-
#It works fine here, but LaTeX will give you an error.
|
113
|
-
def test_wiki_list_ul_too_much()
|
114
|
-
wiki = Wikitext.new(:content => <<wiki
|
115
|
-
Text before
|
116
|
-
*Listentry 1
|
117
|
-
*Listentry 2
|
118
|
-
**Listentry 2.1
|
119
|
-
**Listentry 2.2
|
120
|
-
***Listentry 2.2.1
|
121
|
-
****Listentry 2.2.1.1
|
122
|
-
*****Listentry 2.2.1.1.1
|
123
|
-
*Listentry 3
|
124
|
-
Text afterwords
|
125
|
-
wiki
|
126
|
-
)
|
127
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ul_too_much.html", wiki.to_doc(:html))
|
128
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ul_too_much.latex", wiki.to_doc(:latex))
|
129
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ul_too_much.wiki", wiki.to_doc(:wiki))
|
130
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ul_too_much.text", wiki.to_doc(:text))
|
131
|
-
end
|
132
|
-
def test_wiki_list_ol()
|
133
|
-
wiki = Wikitext.new(:content => <<wiki
|
134
|
-
Text before
|
135
|
-
#Listentry 1
|
136
|
-
#Listentry 2
|
137
|
-
##Listentry 2.1
|
138
|
-
##Listentry 2.2
|
139
|
-
#Listentry 3
|
140
|
-
Text afterwords
|
141
|
-
wiki
|
142
|
-
)
|
143
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ol.html", wiki.to_doc(:html))
|
144
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ol.latex", wiki.to_doc(:latex))
|
145
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ol.wiki", wiki.to_doc(:wiki))
|
146
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ol.text", wiki.to_doc(:text))
|
147
|
-
end #ol
|
148
|
-
|
149
|
-
def test_wiki_list_ol_ul()
|
150
|
-
wiki = Wikitext.new(:content => <<wiki
|
151
|
-
Text before
|
152
|
-
#Listentry 1
|
153
|
-
#Listentry 2
|
154
|
-
#*Listentry 2.1
|
155
|
-
#*Listentry 2.2
|
156
|
-
#Listentry 3
|
157
|
-
Text afterwords
|
158
|
-
wiki
|
159
|
-
)
|
160
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ol_ul.html", wiki.to_doc(:html))
|
161
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ol_ul.latex", wiki.to_doc(:latex))
|
162
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ol_ul.wiki", wiki.to_doc(:wiki))
|
163
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ol_ul.text", wiki.to_doc(:text))
|
164
|
-
$fixmes << "nested lists/wiki: bug"
|
165
|
-
$fixmes << "nested lists/text: bug"
|
166
|
-
end
|
167
|
-
|
168
|
-
def test_wiki_list_ol_after_ul()
|
169
|
-
wiki = Wikitext.new(:content => <<wiki
|
170
|
-
Text before
|
171
|
-
*Listentry 1
|
172
|
-
#Listentry 2
|
173
|
-
Text afterwords
|
174
|
-
wiki
|
175
|
-
)
|
176
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ol_after_ul.html", wiki.to_doc(:html))
|
177
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ol_after_ul.latex", wiki.to_doc(:latex))
|
178
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ol_after_ul.wiki", wiki.to_doc(:wiki))
|
179
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_list_ol_after_ul.text", wiki.to_doc(:text))
|
180
|
-
end
|
181
|
-
|
182
|
-
#Line breaks will be lost.
|
183
|
-
def test_wiki_ul_multiple_line()
|
184
|
-
wiki = Wikitext.new(:content => <<wiki
|
185
|
-
* vorher
|
186
|
-
* text
|
187
|
-
mehr text zum item
|
188
|
-
* nachher und vorher
|
189
|
-
* text
|
190
|
-
mehr text zum item
|
191
|
-
|
192
|
-
neuer Absatz im Item funktioniert auch.
|
193
|
-
* nachher
|
194
|
-
wiki
|
195
|
-
)
|
196
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_ul_multiple_line.html", wiki.to_doc(:html))
|
197
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_ul_multiple_line.latex", wiki.to_doc(:latex))
|
198
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_ul_multiple_line.wiki", wiki.to_doc(:wiki))
|
199
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_ul_multiple_line.text", wiki.to_doc(:text)) #fixme
|
200
|
-
end
|
201
|
-
def test_wiki_description()
|
202
|
-
wiki = Wikitext.new(:content => <<wiki
|
203
|
-
;Something
|
204
|
-
:Now a long description of Something,
|
205
|
-
continued on a second liine.
|
206
|
-
:Another entry
|
207
|
-
;Something Else
|
208
|
-
:Definition of Something Else
|
209
|
-
wiki
|
210
|
-
)
|
211
|
-
#~ fixme - latex how to implement different <dd> values
|
212
|
-
# fixme UTF-fehler
|
213
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_description.html", wiki.to_doc(:html))
|
214
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_description.latex", wiki.to_doc(:latex))
|
215
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_description.wiki", wiki.to_doc(:wiki))
|
216
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_description.text", wiki.to_doc(:text))
|
217
|
-
end
|
218
|
-
|
219
|
-
#~ Die Syntax:
|
220
|
-
#~ *{| beginnt eine Tabelle. Hier k�nnen zus�tzliche Formatierungseigenschaften kommen.
|
221
|
-
#~ **Zumindest columns==__ sollte gesetzt sein
|
222
|
-
#~ *! beginnt eine neue Zelle einer Titelzeile
|
223
|
-
#~ *| beginnt eine neue Zelle
|
224
|
-
#~ *|format| z.B. rowspan...
|
225
|
-
#~ *|format|| Zwei || beenden die Parameter der Zelle.
|
226
|
-
#~ Dann sinnvoll, wenn im Text selbst ein | vorkommt
|
227
|
-
#~ (z.B. ein Macro verwendet wird)
|
228
|
-
#~ *|- trennt zwei Zeilen der Tabelle
|
229
|
-
#~ **hline: Zus�tzlicher Trennstrich �ber der Zeile
|
230
|
-
#~ **toprule, midrule, bottomrule: Zus�tzlicher Trennstrich �ber der Zeile (erfordert booktabs.sty)
|
231
|
-
#~ *|} beendet eine Tabelle
|
232
|
-
|
233
|
-
|
234
|
-
def mk_wiki_tab( columns, lines )
|
235
|
-
tab = [ "{|columns=#{columns.size}|columndescription=#{'c' * columns.size}" ]
|
236
|
-
tab << "|colspan=#{columns.size}|pos=c|Titel"
|
237
|
-
lines.each{|line|
|
238
|
-
tab << "|-"
|
239
|
-
columns.each{|column|
|
240
|
-
tab << "|#{line}#{column}"
|
241
|
-
}
|
242
|
-
}
|
243
|
-
tab << "|}"
|
244
|
-
return tab.join("\n")
|
245
|
-
end
|
246
|
-
def test_wiki_tab1()
|
247
|
-
wiki = Wikitext.new(:content => mk_wiki_tab(Array('A'..'D'), Array(1..5) ) )
|
248
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_tab1.html", wiki.to_doc(:html))
|
249
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_tab1.latex", wiki.to_doc(:latex))
|
250
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_tab1.wiki", wiki.to_doc(:wiki))
|
251
|
-
$fixmes << "text-output for tables"
|
252
|
-
#~ assert_equal_filecontent( "expected_wiki/test_wiki_tab1.text", wiki.to_doc(:text))
|
253
|
-
end
|
254
|
-
|
255
|
-
#With >>> you can call ''WikiCollector''
|
256
|
-
#This collector gets teh content between the start and <<<.
|
257
|
-
#
|
258
|
-
#Collectors must support the methods << and to_doc.
|
259
|
-
#
|
260
|
-
#One predefined collector is html. It takes the content as 'plain text'.
|
261
|
-
#
|
262
|
-
def test_wiki_html_code()
|
263
|
-
wiki = Wikitext.new(:content => <<wiki
|
264
|
-
Beispiel:
|
265
|
-
>>>html{}
|
266
|
-
<div style = "float: right; background-color: yellow">
|
267
|
-
<strong>Fett</strong>
|
268
|
-
<em>kursiv</em>
|
269
|
-
</div>
|
270
|
-
<<<
|
271
|
-
Ende Beispiel
|
272
|
-
wiki
|
273
|
-
)
|
274
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_html_code.html", wiki.to_doc(:html))
|
275
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_html_code.latex", wiki.to_doc(:latex))
|
276
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_html_code.wiki", wiki.to_doc(:wiki))
|
277
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_html_code.text", wiki.to_doc(:text))
|
278
|
-
end
|
279
|
-
#
|
280
|
-
#Add File as verbatimtext
|
281
|
-
def test_wiki_verbatimfile()
|
282
|
-
#
|
283
|
-
#This test uses the coding of the test itself.
|
284
|
-
#
|
285
|
-
wiki = Wikitext.new(:content => <<wiki
|
286
|
-
{{verbatimfile|#{__FILE__}}}
|
287
|
-
wiki
|
288
|
-
)
|
289
|
-
|
290
|
-
escaped_filecontent = File.read(__FILE__).gsub(/</, '<').gsub(/>/, '>')
|
291
|
-
#~ puts wiki.to_latex[1..50].inspect
|
292
|
-
#~ puts wiki.to_latex[-50..-1].inspect
|
293
|
-
assert_equal( "<p ><pre>#{escaped_filecontent}</pre></p>\n", wiki.to_doc(:html))
|
294
|
-
assert_equal( "\n\n\n\\begin{verbatim}#{File.read(__FILE__)}\\end{verbatim}\n\n\n", wiki.to_doc(:latex))
|
295
|
-
|
296
|
-
#Add some attributes to the pre-environment.
|
297
|
-
wiki = Wikitext.new(:content => <<wiki
|
298
|
-
{{verbatimfile|#{__FILE__}|class=cssklasse}}
|
299
|
-
wiki
|
300
|
-
)
|
301
|
-
assert_equal( "<p ><pre class = \"cssklasse\" >#{escaped_filecontent}</pre></p>\n",
|
302
|
-
wiki.to_doc(:html))
|
303
|
-
end
|
304
|
-
#Add File as verbatimtext
|
305
|
-
def test_wiki_filecontent()
|
306
|
-
#
|
307
|
-
#This test uses the coding of the test itself.
|
308
|
-
#
|
309
|
-
wiki = Wikitext.new(:content => <<wiki
|
310
|
-
{{filecontent|#{__FILE__}}}
|
311
|
-
wiki
|
312
|
-
)
|
313
|
-
#~ puts wiki.to_latex[1..50].inspect
|
314
|
-
assert_equal( "<p ><div >#{File.read(__FILE__)}</div></p>\n", wiki.to_doc(:html))
|
315
|
-
assert_equal( "\n\n\\begingroup #{File.read(__FILE__)}\\endgroup \n\n", wiki.to_doc(:latex))
|
316
|
-
|
317
|
-
#Add some attributes to the pre-environment.
|
318
|
-
wiki = Wikitext.new(:content => <<wiki
|
319
|
-
{{filecontent|#{__FILE__}|class=cssklasse}}
|
320
|
-
wiki
|
321
|
-
)
|
322
|
-
assert_equal( "<p ><div class = \"cssklasse\" >#{File.read(__FILE__)}</div></p>\n",
|
323
|
-
wiki.to_doc(:html))
|
324
|
-
end
|
325
|
-
def test_wiki_footnote()
|
326
|
-
wiki = Wikitext.new(:content => <<wiki
|
327
|
-
Here is a footnote{{footnote|some remarks}}, and
|
328
|
-
a second footnote{{footnote|more remarks}}.
|
329
|
-
|
330
|
-
----
|
331
|
-
{{footnotes}}
|
332
|
-
wiki
|
333
|
-
)
|
334
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_footnote.html", wiki.to_doc(:html))
|
335
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_footnote_2.html", wiki.to_doc(:html))
|
336
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_footnote.latex", wiki.to_doc(:latex))
|
337
|
-
#~ assert_equal_filecontent( "expected_wiki/test_wiki_footnote.wiki", wiki.to_doc(:wiki))
|
338
|
-
#~ assert_equal_filecontent( "expected_wiki/test_wiki_footnote.text", wiki.to_doc(:text))
|
339
|
-
end
|
340
|
-
def test_wiki_footnote_groupid()
|
341
|
-
wiki = Wikitext.new(:content => <<wiki
|
342
|
-
There are normal footnotes{{footnote|Like this one}}. But:
|
343
|
-
Here is a footnote in group 1{{footnote[group1]some remarks}}, and
|
344
|
-
a second footnote{{footnote[group1]more remarks}}.
|
345
|
-
In another group{{footnote[group2]Each group gets a name}}, we can define further remarks.
|
346
|
-
|
347
|
-
----
|
348
|
-
Normal Footnotes:
|
349
|
-
{{footnotes}}
|
350
|
-
----
|
351
|
-
Footnote group 1:
|
352
|
-
{{footnotes|group1}}
|
353
|
-
----
|
354
|
-
Footnote group 2:
|
355
|
-
{{footnotes|group2}}
|
356
|
-
wiki
|
357
|
-
)
|
358
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_footnote_groupid.html", wiki.to_doc(:html))
|
359
|
-
#~ assert_equal_filecontent( "expected_wiki/test_wiki_footnote_groupid.latex", wiki.to_doc(:latex))
|
360
|
-
#~ assert_equal_filecontent( "expected_wiki/test_wiki_footnote_groupid.wiki", wiki.to_doc(:wiki))
|
361
|
-
#~ assert_equal_filecontent( "expected_wiki/test_wiki_footnote_groupid.text", wiki.to_doc(:text))
|
362
|
-
end
|
363
|
-
#~ Bilder lassen sich mit [ [Bild:Dateiname|Beschreibung]] in Artikel einf�gen.
|
364
|
-
#~ Das Bild wird dann in Originalgr��e links im Artikel angezeigt.
|
365
|
-
|
366
|
-
#~ Parameter sind optional mit [ [Bild:Dateiname|parameter|Beschreibung]] anzugeben.
|
367
|
-
#~ Es sind beliebig viele, mit | getrennte Parameter m�glich.
|
368
|
-
def test_wiki_picture()
|
369
|
-
wiki = Wikitext.new(:content => <<wiki
|
370
|
-
[[Bild:test.jpg]]
|
371
|
-
|
372
|
-
[[Bild:test.jpg|alt=description]]
|
373
|
-
[[Bild:test.jpg|alt=description|beforetitle=vorher]]
|
374
|
-
[[Bild:test.jpg|alt=description|aftertitle=nachher]]
|
375
|
-
|
376
|
-
[[Bild:test.jpg|href=http://ruby.lickert.net]]
|
377
|
-
[[Bild:test.jpg|href=http://ruby.lickert.net|alt=test]]
|
378
|
-
|
379
|
-
[[Bild:test.jpg|right]]
|
380
|
-
[[Bild:test.jpg|left]]
|
381
|
-
|
382
|
-
[[Bild:test.jpg|width=123px]]
|
383
|
-
|
384
|
-
[[Bild:test.jpg|class=pictureclass]]
|
385
|
-
[[Bild:test.jpg|imgclass=imgclass]]
|
386
|
-
[[Bild:test.jpg|figureclass=imgclass]]
|
387
|
-
wiki
|
388
|
-
)
|
389
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_picture.html", wiki.to_doc(:html))
|
390
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_picture.latex", wiki.to_doc(:latex))
|
391
|
-
#~ assert_equal_filecontent( "expected_wiki/test_wiki_picture.wiki", wiki.to_doc(:wiki))
|
392
|
-
#~ assert_equal_filecontent( "expected_wiki/test_wiki_picture.text", wiki.to_doc(:text))
|
393
|
-
|
394
|
-
wiki = Wikitext.new(:content => <<wiki
|
395
|
-
[[Bild:test.jpg|thumb=testthumb.jpg]]
|
396
|
-
wiki
|
397
|
-
)
|
398
|
-
wiki.log.level = Log4r::FATAL #Avoid warning for missing picture
|
399
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_picture_thumb.html", wiki.to_doc(:html))
|
400
|
-
#~ assert_equal_filecontent( "expected_wiki/test_wiki_picture_thumb.latex", wiki.to_doc(:latex))
|
401
|
-
#~ assert_equal_filecontent( "expected_wiki/test_wiki_picture_thumb.wiki", wiki.to_doc(:wiki))
|
402
|
-
#~ assert_equal_filecontent( "expected_wiki/test_wiki_picture_thumb.text", wiki.to_doc(:text))
|
403
|
-
end
|
404
|
-
|
405
|
-
#
|
406
|
-
#
|
407
|
-
def test_wiki_link()
|
408
|
-
#thisfile is needed to avoid different values of __FILE__
|
409
|
-
#(Running stand alone it's the filename, with require it's './<<filename>>'
|
410
|
-
thisfile = File.basename(__FILE__)
|
411
|
-
|
412
|
-
wiki = Wikitext.new(:content => <<wiki
|
413
|
-
text before [./#{thisfile} link to test] text after
|
414
|
-
|
415
|
-
text before
|
416
|
-
[./#{thisfile} link to test]
|
417
|
-
text after
|
418
|
-
|
419
|
-
[./unexisting_file.xx link with error]
|
420
|
-
wiki
|
421
|
-
)
|
422
|
-
wiki.log.level = Log4r::FATAL
|
423
|
-
#~ wiki.log.outputters = Log4r::FileOutputter.new('wiki_link', :filename => "expected_wiki/test_wiki_link.log")
|
424
|
-
|
425
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_link.html", wiki.to_doc(:html))
|
426
|
-
#~ assert_equal_filecontent( "expected_wiki/test_wiki_link.log", wiki.to_doc(:html))
|
427
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_link.latex", wiki.to_doc(:latex))
|
428
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_link.wiki", wiki.to_doc(:wiki))
|
429
|
-
#~ assert_equal_filecontent( "expected_wiki/test_wiki_link.text", wiki.to_doc(:text))
|
430
|
-
end
|
431
|
-
end #TestWiki
|
432
|
-
|
433
|
-
def newtest(text)
|
434
|
-
code = <<code
|
435
|
-
def test_wiki_??()
|
436
|
-
wiki = Wikitext.new(:content => <<wiki
|
437
|
-
==Titel 1==
|
438
|
-
Text
|
439
|
-
wiki
|
440
|
-
)
|
441
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_??.html", wiki.to_doc(:html))
|
442
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_??.latex", wiki.to_doc(:latex))
|
443
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_??.wiki", wiki.to_doc(:wiki))
|
444
|
-
assert_equal_filecontent( "expected_wiki/test_wiki_??.text", wiki.to_doc(:text))
|
445
|
-
end
|
446
|
-
code
|
447
|
-
puts code.gsub(/\?\?/, text)
|
448
|
-
end
|
449
|
-
#~ newtest('link')
|
450
|
-
|
451
|
-
__END__
|
452
|
-
==Wiki2docgenerator.rb==
|
453
|
-
===Einr�ckungen===
|
454
|
-
Nicht realisiert, macht implizit Definitionsliste (fixme)
|
455
|
-
: Text macht implizit Definitionsliste (fixme)
|
456
|
-
:: Noch tiefer
|
457
|
-
|
458
|
-
==Makros==
|
459
|
-
Makros sind eingeleitet mit {{.
|
460
|
-
nach dem Makronamen sind Parameter mit | getrennt.
|
461
|
-
|
462
|
-
===Link ins ODP===
|
463
|
-
*{{dmoz|World/Deutsch}}
|
464
|
-
*{{dmoz|World/Deutsch|Deutschsprachige Inhalte}}
|