docgenerator 0.1.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. data/examples/docgenerator_example.rb +76 -160
  2. data/examples/docgenerator_example_footnote.rb +98 -0
  3. data/examples/docgenerator_example_list.rb +62 -0
  4. data/examples/docgenerator_example_restrictions.rb +59 -0
  5. data/examples/docgenerator_example_tabular.rb +68 -0
  6. data/examples/docgenerator_example_tripfalls.rb +57 -0
  7. data/examples/wiki2docgenerator_example.rb +270 -0
  8. data/lib/docgenerator.rb +159 -0
  9. data/{docgenerator_attribute.rb → lib/docgenerator_attribute.rb} +32 -7
  10. data/{docgenerator_characters.rb → lib/docgenerator_characters.rb} +15 -0
  11. data/{docgenerator_css.rb → lib/docgenerator_css.rb} +6 -1
  12. data/{docgenerator_document.rb → lib/docgenerator_document.rb} +92 -93
  13. data/{docgenerator_element.rb → lib/docgenerator_element.rb} +125 -51
  14. data/{docgenerator_elements.rb → lib/docgenerator_elements.rb} +40 -56
  15. data/{docgenerator_environments.rb → lib/docgenerator_environments.rb} +16 -10
  16. data/{docgenerator_footnote.rb → lib/docgenerator_footnote.rb} +44 -22
  17. data/{docgenerator_lists.rb → lib/docgenerator_lists.rb} +44 -39
  18. data/{docgenerator_sections.rb → lib/docgenerator_sections.rb} +2 -2
  19. data/{docgenerator_tabular.rb → lib/docgenerator_tabular.rb} +71 -39
  20. data/{packages → lib/packages}/docgenerator_attachfile.rb +0 -0
  21. data/{packages → lib/packages}/docgenerator_caption.rb +0 -0
  22. data/{packages → lib/packages}/docgenerator_hyperref.rb +0 -0
  23. data/{packages → lib/packages}/docgenerator_listings.rb +1 -2
  24. data/{packages → lib/packages}/docgenerator_pdfpages.rb +0 -0
  25. data/{packages → lib/packages}/docgenerator_scrlettr2.rb +2 -2
  26. data/{packages → lib/packages}/docgenerator_scrpage2.rb +0 -0
  27. data/{packages → lib/packages}/docgenerator_url.rb +0 -0
  28. data/lib/templates/docgenerator_template.rb +176 -0
  29. data/lib/templates/docgenerator_template.yaml +105 -0
  30. data/lib/wiki2doc/wiki2docgenerator.rb +1161 -0
  31. data/self_docgenerator.rb +161 -0
  32. data/unittest/expected/test_beamer_note.html +1 -0
  33. data/unittest/expected/test_beamer_note.latex +1 -0
  34. data/unittest/expected/test_beamer_note.text +1 -0
  35. data/unittest/expected/test_beamer_note.wiki +1 -0
  36. data/unittest/expected/test_block.html +1 -0
  37. data/unittest/expected/test_block.latex +1 -0
  38. data/unittest/expected/test_block.text +1 -0
  39. data/unittest/expected/test_block.wiki +2 -0
  40. data/unittest/expected/test_css.css +1 -0
  41. data/unittest/expected/test_css2.css +1 -0
  42. data/unittest/expected/test_description.html +1 -0
  43. data/unittest/expected/test_description.latex +3 -0
  44. data/unittest/expected/test_description.text +3 -0
  45. data/unittest/expected/test_description.wiki +3 -0
  46. data/unittest/expected/test_document_article.latex +23 -0
  47. data/unittest/expected/test_document_html.html +14 -0
  48. data/unittest/expected/test_document_replacement_article.latex +23 -0
  49. data/unittest/expected/test_document_replacement_html.html +14 -0
  50. data/unittest/expected/test_document_replacement_text.text +5 -0
  51. data/unittest/expected/test_document_replacement_wiki.wiki +5 -0
  52. data/unittest/expected/test_document_text.text +5 -0
  53. data/unittest/expected/test_document_wiki.wiki +5 -0
  54. data/unittest/expected/test_enumerate.html +1 -0
  55. data/unittest/expected/test_enumerate.latex +3 -0
  56. data/unittest/expected/test_enumerate.text +1 -0
  57. data/unittest/expected/test_enumerate.wiki +2 -0
  58. data/unittest/expected/test_footnote.html +5 -0
  59. data/unittest/expected/test_footnote.latex +11 -0
  60. data/unittest/expected/test_footnote.text +13 -0
  61. data/unittest/expected/test_footnote.wiki +11 -0
  62. data/unittest/expected/test_footnote_group.html +8 -0
  63. data/unittest/expected/test_footnote_group.latex +17 -0
  64. data/unittest/expected/test_footnote_group.wiki +17 -0
  65. data/unittest/expected/test_href.html +2 -0
  66. data/unittest/expected/test_href.latex +8 -0
  67. data/unittest/expected/test_href.text +4 -0
  68. data/unittest/expected/test_html_css.html +1 -0
  69. data/unittest/expected/test_itemize.html +1 -0
  70. data/unittest/expected/test_itemize.latex +3 -0
  71. data/unittest/expected/test_itemize.text +1 -0
  72. data/unittest/expected/test_itemize.wiki +2 -0
  73. data/unittest/expected/test_section.html +8 -0
  74. data/unittest/expected/test_section.latex +20 -0
  75. data/unittest/expected/test_section.text +24 -0
  76. data/unittest/expected/test_section.wiki +20 -0
  77. data/unittest/expected/test_tabular.html +10 -0
  78. data/unittest/expected/test_tabular.latex +10 -0
  79. data/unittest/expected/test_tabular.wiki +31 -0
  80. data/unittest/expected/test_tabular_doc.latex +22 -0
  81. data/unittest/expected/test_wiki.html +6 -0
  82. data/unittest/expected/test_wiki.latex +12 -0
  83. data/unittest/expected/test_wiki.text +14 -0
  84. data/unittest/expected/test_wiki.wiki +12 -0
  85. data/unittest/expected/test_wiki_amazon.html +10 -0
  86. data/unittest/expected/test_wiki_description.html +7 -0
  87. data/unittest/expected/test_wiki_description.latex +11 -0
  88. data/unittest/expected/test_wiki_description.text +6 -0
  89. data/unittest/expected/test_wiki_description.wiki +6 -0
  90. data/unittest/expected/test_wiki_footnote.html +8 -0
  91. data/unittest/expected/test_wiki_footnote.latex +15 -0
  92. data/unittest/expected/test_wiki_footnote.text +12 -0
  93. data/unittest/expected/test_wiki_footnote.wiki +12 -0
  94. data/unittest/expected/test_wiki_footnote_groupid.html +21 -0
  95. data/unittest/expected/test_wiki_html_code.html +7 -0
  96. data/unittest/expected/test_wiki_html_code.latex +10 -0
  97. data/unittest/expected/test_wiki_html_code.text +6 -0
  98. data/unittest/expected/test_wiki_html_code.wiki +6 -0
  99. data/unittest/expected/test_wiki_inline.html +6 -0
  100. data/unittest/expected/test_wiki_inline.latex +12 -0
  101. data/unittest/expected/test_wiki_inline.text +8 -0
  102. data/unittest/expected/test_wiki_inline.wiki +8 -0
  103. data/unittest/expected/test_wiki_label.html +6 -0
  104. data/unittest/expected/test_wiki_link.html +8 -0
  105. data/unittest/expected/test_wiki_link.latex +14 -0
  106. data/unittest/expected/test_wiki_link.log +3 -0
  107. data/unittest/expected/test_wiki_link.wiki +6 -0
  108. data/unittest/expected/test_wiki_list_ol.html +24 -0
  109. data/unittest/expected/test_wiki_list_ol.latex +30 -0
  110. data/unittest/expected/test_wiki_list_ol.text +10 -0
  111. data/unittest/expected/test_wiki_list_ol.wiki +12 -0
  112. data/unittest/expected/test_wiki_list_ol_after_ul.html +16 -0
  113. data/unittest/expected/test_wiki_list_ol_after_ul.latex +24 -0
  114. data/unittest/expected/test_wiki_list_ol_after_ul.text +8 -0
  115. data/unittest/expected/test_wiki_list_ol_after_ul.wiki +10 -0
  116. data/unittest/expected/test_wiki_list_ol_ul.html +24 -0
  117. data/unittest/expected/test_wiki_list_ol_ul.latex +30 -0
  118. data/unittest/expected/test_wiki_list_ol_ul.text +10 -0
  119. data/unittest/expected/test_wiki_list_ol_ul.wiki +12 -0
  120. data/unittest/expected/test_wiki_list_ul.html +24 -0
  121. data/unittest/expected/test_wiki_list_ul.latex +30 -0
  122. data/unittest/expected/test_wiki_list_ul.text +10 -0
  123. data/unittest/expected/test_wiki_list_ul.wiki +12 -0
  124. data/unittest/expected/test_wiki_list_ul_too_much.html +39 -0
  125. data/unittest/expected/test_wiki_list_ul_too_much.latex +51 -0
  126. data/unittest/expected/test_wiki_list_ul_too_much.text +11 -0
  127. data/unittest/expected/test_wiki_list_ul_too_much.wiki +15 -0
  128. data/unittest/expected/test_wiki_picture.html +55 -0
  129. data/unittest/expected/test_wiki_picture.latex +76 -0
  130. data/unittest/expected/test_wiki_picture_thumb.html +5 -0
  131. data/unittest/expected/test_wiki_tab1.html +30 -0
  132. data/unittest/expected/test_wiki_tab1.latex +30 -0
  133. data/unittest/expected/test_wiki_tab1.wiki +29 -0
  134. data/unittest/expected/test_wiki_textformatting.html +7 -0
  135. data/unittest/expected/test_wiki_textformatting.latex +16 -0
  136. data/unittest/expected/test_wiki_textformatting.text +11 -0
  137. data/unittest/expected/test_wiki_textformatting.wiki +9 -0
  138. data/unittest/expected/test_wiki_toc.html +9 -0
  139. data/unittest/expected/test_wiki_toc.latex +18 -0
  140. data/unittest/expected/test_wiki_toc.text +21 -0
  141. data/unittest/expected/test_wiki_toc.wiki +18 -0
  142. data/unittest/expected/test_wiki_ul_multiple_line.html +18 -0
  143. data/unittest/expected/test_wiki_ul_multiple_line.latex +19 -0
  144. data/unittest/expected/test_wiki_ul_multiple_line.text +6 -0
  145. data/unittest/expected/test_wiki_ul_multiple_line.wiki +7 -0
  146. data/unittest/test_docgenerator.rb +85 -0
  147. data/unittest/unittest_docgenerator.rb +454 -0
  148. data/unittest/unittest_wiki2doc.rb +451 -0
  149. metadata +155 -31
  150. data/docgenerator.rb +0 -137
  151. data/docgenerator_template.rb +0 -103
  152. data/packages/docgenerator_beamer.rb +0 -250
@@ -0,0 +1,451 @@
1
+ require 'test_docgenerator.rb'
2
+ $fixme = []
3
+ END { puts $fixme }
4
+
5
+ class Testcase < Test::Unit::TestCase
6
+ def test_wiki()
7
+ wiki = Wikitext.new(:content => <<wiki
8
+ ==Titel 1==
9
+ Text
10
+ ===Titel 2===
11
+ Text unter Titel 2
12
+ wiki
13
+ )
14
+ assert_equal_filecontent( "expected/test_wiki.html", wiki.to_doc(:html))
15
+ assert_equal_filecontent( "expected/test_wiki.latex", wiki.to_doc(:latex))
16
+ assert_equal_filecontent( "expected/test_wiki.wiki", wiki.to_doc(:wiki))
17
+ assert_equal_filecontent( "expected/test_wiki.text", wiki.to_doc(:text))
18
+ end
19
+ #
20
+ #Including the definition of a label tor the toc.
21
+ def test_wiki_toc()
22
+ wiki = Wikitext.new(:content => <<wiki
23
+ ==Titel 1==
24
+ Text
25
+ ===Titel 2===
26
+ Text unter Titel 2
27
+ ===[2b]Titel 2b===
28
+ Text unter Titel 2b
29
+ wiki
30
+ )
31
+ assert_equal_filecontent( "expected/test_wiki_toc.html", wiki.to_doc(:html))
32
+ assert_equal_filecontent( "expected/test_wiki_toc.latex", wiki.to_doc(:latex))
33
+ assert_equal_filecontent( "expected/test_wiki_toc.wiki", wiki.to_doc(:wiki))
34
+ assert_equal_filecontent( "expected/test_wiki_toc.text", wiki.to_doc(:text))
35
+ end
36
+ def test_wiki_inline()
37
+ wiki = Wikitext.new(:content => <<wiki
38
+ Inline-Tags ''kursiv'', '''fett''', ''''kursiv und fett''''
39
+
40
+ ''kursiv'',
41
+ '''fett''',
42
+ ''''kursiv und fett''''
43
+ wiki
44
+ )
45
+ #fixme tex unklar. wie zwei dd-tags in tex nachbilden?
46
+ assert_equal_filecontent( "expected/test_wiki_inline.html", wiki.to_doc(:html))
47
+ assert_equal_filecontent( "expected/test_wiki_inline.latex", wiki.to_doc(:latex))
48
+ #~ bug! fixme
49
+ $fixme << 'inline 2 wiki'
50
+ #~ assert_equal_filecontent( "expected/test_wiki_inline.wiki", wiki.to_doc(:wiki))
51
+ assert_equal_filecontent( "expected/test_wiki_inline.text", wiki.to_doc(:text))
52
+ end
53
+
54
+ def test_wiki_textformatting()
55
+ #Clear in newline is used by HTML (needed to handle floats)
56
+ wiki = Wikitext.new(:content => <<wiki
57
+ vorher{{newline}}Nachher
58
+
59
+ vorher{{newline|clear}}Nachher
60
+ ----
61
+ Nach einer Trennlinie
62
+ wiki
63
+ )
64
+ assert_equal_filecontent( "expected/test_wiki_textformatting.html", wiki.to_doc(:html))
65
+ assert_equal_filecontent( "expected/test_wiki_textformatting.latex", wiki.to_doc(:latex))
66
+ assert_equal_filecontent( "expected/test_wiki_textformatting.wiki", wiki.to_doc(:wiki))
67
+ assert_equal_filecontent( "expected/test_wiki_textformatting.text", wiki.to_doc(:text))
68
+ end
69
+
70
+ def test_wiki_label()
71
+ wiki = Wikitext.new(:content => <<wiki
72
+ [[label:a]]
73
+
74
+ text text
75
+ [[#a|hier]]
76
+ [[#a|hier]]
77
+ wiki
78
+ )
79
+ #~ fixme: TeX href hyperlabel??
80
+ assert_equal_filecontent( "expected/test_wiki_label.html", wiki.to_doc(:html))
81
+ #~ assert_equal_filecontent( "expected/test_wiki_label.latex", wiki.to_doc(:latex))
82
+ #~ assert_equal_filecontent( "expected/test_wiki_label.wiki", wiki.to_doc(:wiki)) #fixme
83
+ #~ assert_equal_filecontent( "expected/test_wiki_label.text", wiki.to_doc(:text))
84
+ end
85
+
86
+ def test_wiki_list_ul()
87
+ wiki = Wikitext.new(:content => <<wiki
88
+ Text before
89
+ *Listentry 1
90
+ *Listentry 2
91
+ **Listentry 2.1
92
+ **Listentry 2.2
93
+ *Listentry 3
94
+ Text afterwords
95
+ wiki
96
+ )
97
+ assert_equal_filecontent( "expected/test_wiki_list_ul.html", wiki.to_doc(:html))
98
+ assert_equal_filecontent( "expected/test_wiki_list_ul.latex", wiki.to_doc(:latex))
99
+ assert_equal_filecontent( "expected/test_wiki_list_ul.wiki", wiki.to_doc(:wiki))
100
+ assert_equal_filecontent( "expected/test_wiki_list_ul.text", wiki.to_doc(:text))
101
+ end
102
+ #It works fine here, but LaTeX will give you an error.
103
+ def test_wiki_list_ul_too_much()
104
+ wiki = Wikitext.new(:content => <<wiki
105
+ Text before
106
+ *Listentry 1
107
+ *Listentry 2
108
+ **Listentry 2.1
109
+ **Listentry 2.2
110
+ ***Listentry 2.2.1
111
+ ****Listentry 2.2.1.1
112
+ *****Listentry 2.2.1.1.1
113
+ *Listentry 3
114
+ Text afterwords
115
+ wiki
116
+ )
117
+ assert_equal_filecontent( "expected/test_wiki_list_ul_too_much.html", wiki.to_doc(:html))
118
+ assert_equal_filecontent( "expected/test_wiki_list_ul_too_much.latex", wiki.to_doc(:latex))
119
+ assert_equal_filecontent( "expected/test_wiki_list_ul_too_much.wiki", wiki.to_doc(:wiki))
120
+ assert_equal_filecontent( "expected/test_wiki_list_ul_too_much.text", wiki.to_doc(:text))
121
+ end
122
+ def test_wiki_list_ol()
123
+ wiki = Wikitext.new(:content => <<wiki
124
+ Text before
125
+ #Listentry 1
126
+ #Listentry 2
127
+ ##Listentry 2.1
128
+ ##Listentry 2.2
129
+ #Listentry 3
130
+ Text afterwords
131
+ wiki
132
+ )
133
+ assert_equal_filecontent( "expected/test_wiki_list_ol.html", wiki.to_doc(:html))
134
+ assert_equal_filecontent( "expected/test_wiki_list_ol.latex", wiki.to_doc(:latex))
135
+ assert_equal_filecontent( "expected/test_wiki_list_ol.wiki", wiki.to_doc(:wiki))
136
+ assert_equal_filecontent( "expected/test_wiki_list_ol.text", wiki.to_doc(:text))
137
+ end #ol
138
+
139
+ def test_wiki_list_ol_ul()
140
+ wiki = Wikitext.new(:content => <<wiki
141
+ Text before
142
+ #Listentry 1
143
+ #Listentry 2
144
+ #*Listentry 2.1
145
+ #*Listentry 2.2
146
+ #Listentry 3
147
+ Text afterwords
148
+ wiki
149
+ )
150
+ assert_equal_filecontent( "expected/test_wiki_list_ol_ul.html", wiki.to_doc(:html))
151
+ assert_equal_filecontent( "expected/test_wiki_list_ol_ul.latex", wiki.to_doc(:latex))
152
+ assert_equal_filecontent( "expected/test_wiki_list_ol_ul.wiki", wiki.to_doc(:wiki))
153
+ assert_equal_filecontent( "expected/test_wiki_list_ol_ul.text", wiki.to_doc(:text))
154
+ $fixmes << "nested lists/wiki: bug"
155
+ $fixmes << "nested lists/text: bug"
156
+ end
157
+
158
+ def test_wiki_list_ol_after_ul()
159
+ wiki = Wikitext.new(:content => <<wiki
160
+ Text before
161
+ *Listentry 1
162
+ #Listentry 2
163
+ Text afterwords
164
+ wiki
165
+ )
166
+ assert_equal_filecontent( "expected/test_wiki_list_ol_after_ul.html", wiki.to_doc(:html))
167
+ assert_equal_filecontent( "expected/test_wiki_list_ol_after_ul.latex", wiki.to_doc(:latex))
168
+ assert_equal_filecontent( "expected/test_wiki_list_ol_after_ul.wiki", wiki.to_doc(:wiki))
169
+ assert_equal_filecontent( "expected/test_wiki_list_ol_after_ul.text", wiki.to_doc(:text))
170
+ end
171
+
172
+ #Line breaks will be lost.
173
+ def test_wiki_ul_multiple_line()
174
+ wiki = Wikitext.new(:content => <<wiki
175
+ * vorher
176
+ * text
177
+ mehr text zum item
178
+ * nachher und vorher
179
+ * text
180
+ mehr text zum item
181
+
182
+ neuer Absatz im Item funktioniert auch.
183
+ * nachher
184
+ wiki
185
+ )
186
+ assert_equal_filecontent( "expected/test_wiki_ul_multiple_line.html", wiki.to_doc(:html))
187
+ assert_equal_filecontent( "expected/test_wiki_ul_multiple_line.latex", wiki.to_doc(:latex))
188
+ assert_equal_filecontent( "expected/test_wiki_ul_multiple_line.wiki", wiki.to_doc(:wiki))
189
+ assert_equal_filecontent( "expected/test_wiki_ul_multiple_line.text", wiki.to_doc(:text)) #fixme
190
+ end
191
+ def test_wiki_description()
192
+ wiki = Wikitext.new(:content => <<wiki
193
+ ;Komplizierter Begriff
194
+ :Jetzt eine Lange Beschreibung des begriffes
195
+ der auch �ber eine zweite Zeile geht
196
+ :Noch ein Eintrag
197
+ ;Begriff
198
+ :Definition des Begriffs
199
+ wiki
200
+ )
201
+ #~ fixme - latex how to implement different <dd> values
202
+ assert_equal_filecontent( "expected/test_wiki_description.html", wiki.to_doc(:html))
203
+ assert_equal_filecontent( "expected/test_wiki_description.latex", wiki.to_doc(:latex))
204
+ assert_equal_filecontent( "expected/test_wiki_description.wiki", wiki.to_doc(:wiki))
205
+ assert_equal_filecontent( "expected/test_wiki_description.text", wiki.to_doc(:text))
206
+ end
207
+
208
+ #~ Die Syntax:
209
+ #~ *{| beginnt eine Tabelle. Hier k�nnen zus�tzliche Formatierungseigenschaften kommen.
210
+ #~ **Zumindest columns==__ sollte gesetzt sein
211
+ #~ *! beginnt eine neue Zelle einer Titelzeile
212
+ #~ *| beginnt eine neue Zelle
213
+ #~ *|format| z.B. rowspan...
214
+ #~ *|format|| Zwei || beenden die Parameter der Zelle.
215
+ #~ Dann sinnvoll, wenn im Text selbst ein | vorkommt
216
+ #~ (z.B. ein Macro verwendet wird)
217
+ #~ *|- trennt zwei Zeilen der Tabelle
218
+ #~ **hline: Zus�tzlicher Trennstrich �ber der Zeile
219
+ #~ **toprule, midrule, bottomrule: Zus�tzlicher Trennstrich �ber der Zeile (erfordert booktabs.sty)
220
+ #~ *|} beendet eine Tabelle
221
+
222
+
223
+ def mk_wiki_tab( columns, lines )
224
+ tab = [ "{|columns=#{columns.size}|columndescription=#{'c' * columns.size}" ]
225
+ tab << "|colspan=#{columns.size}|pos=c|Titel"
226
+ lines.each{|line|
227
+ tab << "|-"
228
+ columns.each{|column|
229
+ tab << "|#{line}#{column}"
230
+ }
231
+ }
232
+ tab << "|}"
233
+ return tab.join("\n")
234
+ end
235
+ def test_wiki_tab1()
236
+ wiki = Wikitext.new(:content => mk_wiki_tab(Array('A'..'D'), Array(1..5) ) )
237
+ assert_equal_filecontent( "expected/test_wiki_tab1.html", wiki.to_doc(:html))
238
+ assert_equal_filecontent( "expected/test_wiki_tab1.latex", wiki.to_doc(:latex))
239
+ assert_equal_filecontent( "expected/test_wiki_tab1.wiki", wiki.to_doc(:wiki))
240
+ $fixmes << "text-output for tables"
241
+ #~ assert_equal_filecontent( "expected/test_wiki_tab1.text", wiki.to_doc(:text))
242
+ end
243
+
244
+ #With >>> you can call ''WikiCollector''
245
+ #This collector gets teh content between the start and <<<.
246
+ #
247
+ #Collectors must support the methods << and to_doc.
248
+ #
249
+ #One predefined collector is html. It takes the content as 'plain text'.
250
+ #
251
+ def test_wiki_html_code()
252
+ wiki = Wikitext.new(:content => <<wiki
253
+ Beispiel:
254
+ >>>html{}
255
+ <div style = "float: right; background-color: yellow">
256
+ <strong>Fett</strong>
257
+ <em>kursiv</em>
258
+ </div>
259
+ <<<
260
+ Ende Beispiel
261
+ wiki
262
+ )
263
+ assert_equal_filecontent( "expected/test_wiki_html_code.html", wiki.to_doc(:html))
264
+ assert_equal_filecontent( "expected/test_wiki_html_code.latex", wiki.to_doc(:latex))
265
+ assert_equal_filecontent( "expected/test_wiki_html_code.wiki", wiki.to_doc(:wiki))
266
+ assert_equal_filecontent( "expected/test_wiki_html_code.text", wiki.to_doc(:text))
267
+ end
268
+ #
269
+ #Add File as verbatimtext
270
+ def test_wiki_verbatimfile()
271
+ #
272
+ #This test uses the coding of the test itself.
273
+ #
274
+ wiki = Wikitext.new(:content => <<wiki
275
+ {{verbatimfile|#{__FILE__}}}
276
+ wiki
277
+ )
278
+ #~ puts wiki.to_latex[1..50].inspect
279
+ #~ puts wiki.to_latex[-50..-1].inspect
280
+ assert_equal( "<p ><pre >#{File.read(__FILE__)}</pre></p>\n", wiki.to_doc(:html))
281
+ assert_equal( "\n\n\n\\begin{verbatim}#{File.read(__FILE__)}\\end{verbatim}\n\n\n", wiki.to_doc(:latex))
282
+
283
+ #Add some attributes to the pre-environment.
284
+ wiki = Wikitext.new(:content => <<wiki
285
+ {{verbatimfile|#{__FILE__}|class=cssklasse}}
286
+ wiki
287
+ )
288
+ assert_equal( "<p ><pre class = \"cssklasse\" >#{File.read(__FILE__)}</pre></p>\n",
289
+ wiki.to_doc(:html))
290
+ end
291
+ #Add File as verbatimtext
292
+ def test_wiki_filecontent()
293
+ #
294
+ #This test uses the coding of the test itself.
295
+ #
296
+ wiki = Wikitext.new(:content => <<wiki
297
+ {{filecontent|#{__FILE__}}}
298
+ wiki
299
+ )
300
+ #~ puts wiki.to_latex[1..50].inspect
301
+ assert_equal( "<p ><div >#{File.read(__FILE__)}</div></p>\n", wiki.to_doc(:html))
302
+ assert_equal( "\n\n\\begingroup #{File.read(__FILE__)}\\endgroup \n\n", wiki.to_doc(:latex))
303
+
304
+ #Add some attributes to the pre-environment.
305
+ wiki = Wikitext.new(:content => <<wiki
306
+ {{filecontent|#{__FILE__}|class=cssklasse}}
307
+ wiki
308
+ )
309
+ assert_equal( "<p ><div class = \"cssklasse\" >#{File.read(__FILE__)}</div></p>\n",
310
+ wiki.to_doc(:html))
311
+ end
312
+ def test_wiki_footnote()
313
+ wiki = Wikitext.new(:content => <<wiki
314
+ Here is a footnote{{footnote|some remarks}}, and
315
+ a second footnote{{footnote|more remarks}}.
316
+
317
+ ----
318
+ {{footnotes}}
319
+ wiki
320
+ )
321
+ assert_equal_filecontent( "expected/test_wiki_footnote.html", wiki.to_doc(:html))
322
+ assert_equal_filecontent( "expected/test_wiki_footnote.latex", wiki.to_doc(:latex))
323
+ assert_equal_filecontent( "expected/test_wiki_footnote.wiki", wiki.to_doc(:wiki))
324
+ assert_equal_filecontent( "expected/test_wiki_footnote.text", wiki.to_doc(:text))
325
+ end
326
+ def test_wiki_footnote_groupid()
327
+ wiki = Wikitext.new(:content => <<wiki
328
+ There are normal footnotes{{footnote|Like this one}}. But:
329
+ Here is a footnote in group 1{{footnote[group1]some remarks}}, and
330
+ a second footnote{{footnote[group1]more remarks}}.
331
+ In another group{{footnote[group2]Each group gets a name}}, we can define further remarks.
332
+
333
+ ----
334
+ Normal Footnotes:
335
+ {{footnotes}}
336
+ ----
337
+ Footnote group 1:
338
+ {{footnotes|group1}}
339
+ ----
340
+ Footnote group 2:
341
+ {{footnotes|group2}}
342
+ wiki
343
+ )
344
+ assert_equal_filecontent( "expected/test_wiki_footnote_groupid.html", wiki.to_doc(:html))
345
+ #~ assert_equal_filecontent( "expected/test_wiki_footnote_groupid.latex", wiki.to_doc(:latex))
346
+ #~ assert_equal_filecontent( "expected/test_wiki_footnote_groupid.wiki", wiki.to_doc(:wiki))
347
+ #~ assert_equal_filecontent( "expected/test_wiki_footnote_groupid.text", wiki.to_doc(:text))
348
+ end
349
+ def test_wiki_amazon()
350
+ wiki = Wikitext.new(:content => <<wiki
351
+ {{amazon|asin=B000AFEJAM}}
352
+
353
+ {{amazon|asin=B000AFEJAM|right}}
354
+ wiki
355
+ )
356
+ assert_equal_filecontent( "expected/test_wiki_amazon.html", wiki.to_doc(:html))
357
+ #~ assert_equal_filecontent( "expected/test_wiki_amazon.latex", wiki.to_doc(:latex))
358
+ #~ assert_equal_filecontent( "expected/test_wiki_amazon.wiki", wiki.to_doc(:wiki))
359
+ #~ assert_equal_filecontent( "expected/test_wiki_amazon.text", wiki.to_doc(:text))
360
+ end
361
+ #~ Bilder lassen sich mit [ [Bild:Dateiname|Beschreibung]] in Artikel einf�gen.
362
+ #~ Das Bild wird dann in Originalgr��e links im Artikel angezeigt.
363
+
364
+ #~ Parameter sind optional mit [ [Bild:Dateiname|parameter|Beschreibung]] anzugeben.
365
+ #~ Es sind beliebig viele, mit | getrennte Parameter m�glich.
366
+ def test_wiki_picture()
367
+ wiki = Wikitext.new(:content => <<wiki
368
+ [[Bild:test.jpg]]
369
+
370
+ [[Bild:test.jpg|alt=description]]
371
+ [[Bild:test.jpg|alt=description|beforetitle=vorher]]
372
+ [[Bild:test.jpg|alt=description|aftertitle=nachher]]
373
+
374
+ [[Bild:test.jpg|href=http://ruby.lickert.net]]
375
+ [[Bild:test.jpg|href=http://ruby.lickert.net|alt=test]]
376
+
377
+ [[Bild:test.jpg|right]]
378
+ [[Bild:test.jpg|left]]
379
+
380
+ [[Bild:test.jpg|width=123px]]
381
+
382
+ [[Bild:test.jpg|class=pictureclass]]
383
+ [[Bild:test.jpg|imgclass=imgclass]]
384
+ [[Bild:test.jpg|figureclass=imgclass]]
385
+ wiki
386
+ )
387
+ assert_equal_filecontent( "expected/test_wiki_picture.html", wiki.to_doc(:html))
388
+ assert_equal_filecontent( "expected/test_wiki_picture.latex", wiki.to_doc(:latex))
389
+ #~ assert_equal_filecontent( "expected/test_wiki_picture.wiki", wiki.to_doc(:wiki))
390
+ #~ assert_equal_filecontent( "expected/test_wiki_picture.text", wiki.to_doc(:text))
391
+
392
+ wiki = Wikitext.new(:content => <<wiki
393
+ [[Bild:test.jpg|thumb=testthumb.jpg]]
394
+ wiki
395
+ )
396
+ wiki.log.level = Log4r::FATAL #Avoid warning for missing picture
397
+ assert_equal_filecontent( "expected/test_wiki_picture_thumb.html", wiki.to_doc(:html))
398
+ #~ assert_equal_filecontent( "expected/test_wiki_picture_thumb.latex", wiki.to_doc(:latex))
399
+ #~ assert_equal_filecontent( "expected/test_wiki_picture_thumb.wiki", wiki.to_doc(:wiki))
400
+ #~ assert_equal_filecontent( "expected/test_wiki_picture_thumb.text", wiki.to_doc(:text))
401
+ end
402
+ def test_wiki_link()
403
+ wiki = Wikitext.new(:content => <<wiki
404
+ [./#{__FILE__} link to test]
405
+
406
+ [./unexisting_file.xx link with error]
407
+ wiki
408
+ )
409
+ wiki.log.level = Log4r::FATAL
410
+ #~ wiki.log.outputters = Log4r::FileOutputter.new('wiki_link', :filename => "expected/test_wiki_link.log")
411
+
412
+ assert_equal_filecontent( "expected/test_wiki_link.html", wiki.to_doc(:html))
413
+ #~ assert_equal_filecontent( "expected/test_wiki_link.log", wiki.to_doc(:html))
414
+ assert_equal_filecontent( "expected/test_wiki_link.latex", wiki.to_doc(:latex))
415
+ assert_equal_filecontent( "expected/test_wiki_link.wiki", wiki.to_doc(:wiki))
416
+ #~ assert_equal_filecontent( "expected/test_wiki_link.text", wiki.to_doc(:text))
417
+ end
418
+ end #TestWiki
419
+
420
+ def newtest(text)
421
+ code = <<code
422
+ def test_wiki_??()
423
+ wiki = Wikitext.new(:content => <<wiki
424
+ ==Titel 1==
425
+ Text
426
+ wiki
427
+ )
428
+ assert_equal_filecontent( "expected/test_wiki_??.html", wiki.to_doc(:html))
429
+ assert_equal_filecontent( "expected/test_wiki_??.latex", wiki.to_doc(:latex))
430
+ assert_equal_filecontent( "expected/test_wiki_??.wiki", wiki.to_doc(:wiki))
431
+ assert_equal_filecontent( "expected/test_wiki_??.text", wiki.to_doc(:text))
432
+ end
433
+ code
434
+ puts code.gsub(/\?\?/, text)
435
+ end
436
+ #~ newtest('link')
437
+
438
+ __END__
439
+ ==Wiki2docgenerator.rb==
440
+ ===Einr�ckungen===
441
+ Nicht realisiert, macht implizit Definitionsliste (fixme)
442
+ : Text macht implizit Definitionsliste (fixme)
443
+ :: Noch tiefer
444
+
445
+ ==Makros==
446
+ Makros sind eingeleitet mit {{.
447
+ nach dem Makronamen sind Parameter mit | getrennt.
448
+
449
+ ===Link ins ODP===
450
+ *{{dmoz|World/Deutsch}}
451
+ *{{dmoz|World/Deutsch|Deutschsprachige Inhalte}}
metadata CHANGED
@@ -3,14 +3,14 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: docgenerator
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.1
7
- date: 2008-03-16 00:00:00 +01:00
8
- summary: "The docgenerator-package allows the definition of documents and export to *LaTeX *HTML *Wiki (not very goog supported) *plain text (also not very good supported) This package is the base of *wiki2docgenerator - a wiki to TeX/HTML-Translator *Sitegenerator - A offline website generator ------------- Urspr\xFCnglich als TeX-Code-Generator gebaut ist das Paket inzwischen ein LaTeX, HTML, Wiki und Textgenerator geworden. Das Paket ist Basis eines \"Datei-Wiki\" und Sitegenerators."
6
+ version: 1.0.2
7
+ date: 2008-05-06 00:00:00 +02:00
8
+ summary: The docgenerator-package allows the definition of documents and export to *LaTeX *HTML *Wiki (not very good supported) *plain text (also not very good supported) This package is the base of *wiki2docgenerator.rb - a Wiki to TeX/HTML-Translator (part of the distribution) *yaml2presentation.rb - a presentation generator for LaTeX-Beamer-class. Can also be used to build image galleries. *Sitegenerator - An offline website generator (No generation on the fly)
9
9
  require_paths:
10
- - .
10
+ - ./lib
11
11
  email: knut@lickert.net
12
12
  homepage: http://ruby.lickert.net/
13
- rubyforge_project:
13
+ rubyforge_project: docgenerator
14
14
  description:
15
15
  autorequire:
16
16
  default_executable:
@@ -29,31 +29,155 @@ post_install_message:
29
29
  authors:
30
30
  - Knut Lickert
31
31
  files:
32
- - docgenerator.rb
33
- - docgenerator_attribute.rb
34
- - docgenerator_characters.rb
35
- - docgenerator_css.rb
36
- - docgenerator_document.rb
37
- - docgenerator_element.rb
38
- - docgenerator_elements.rb
39
- - docgenerator_environments.rb
40
- - docgenerator_footnote.rb
41
- - docgenerator_lists.rb
42
- - docgenerator_sections.rb
43
- - docgenerator_tabular.rb
44
- - docgenerator_template.rb
45
- - packages/docgenerator_attachfile.rb
46
- - packages/docgenerator_beamer.rb
47
- - packages/docgenerator_caption.rb
48
- - packages/docgenerator_hyperref.rb
49
- - packages/docgenerator_listings.rb
50
- - packages/docgenerator_pdfpages.rb
51
- - packages/docgenerator_scrlettr2.rb
52
- - packages/docgenerator_scrpage2.rb
53
- - packages/docgenerator_url.rb
32
+ - lib/docgenerator.rb
33
+ - lib/docgenerator_attribute.rb
34
+ - lib/docgenerator_characters.rb
35
+ - lib/docgenerator_css.rb
36
+ - lib/docgenerator_document.rb
37
+ - lib/docgenerator_element.rb
38
+ - lib/docgenerator_elements.rb
39
+ - lib/docgenerator_environments.rb
40
+ - lib/docgenerator_footnote.rb
41
+ - lib/docgenerator_lists.rb
42
+ - lib/docgenerator_sections.rb
43
+ - lib/docgenerator_tabular.rb
44
+ - lib/templates/docgenerator_template.rb
45
+ - lib/templates/docgenerator_template.yaml
46
+ - lib/packages/docgenerator_attachfile.rb
47
+ - lib/packages/docgenerator_caption.rb
48
+ - lib/packages/docgenerator_hyperref.rb
49
+ - lib/packages/docgenerator_listings.rb
50
+ - lib/packages/docgenerator_pdfpages.rb
51
+ - lib/packages/docgenerator_scrlettr2.rb
52
+ - lib/packages/docgenerator_scrpage2.rb
53
+ - lib/packages/docgenerator_url.rb
54
54
  - examples/docgenerator_example.rb
55
- test_files: []
56
-
55
+ - examples/docgenerator_example_list.rb
56
+ - examples/docgenerator_example_tabular.rb
57
+ - examples/docgenerator_example_footnote.rb
58
+ - examples/docgenerator_example_restrictions.rb
59
+ - examples/docgenerator_example_tripfalls.rb
60
+ - lib/wiki2doc/wiki2docgenerator.rb
61
+ - examples/wiki2docgenerator_example.rb
62
+ - self_docgenerator.rb
63
+ test_files:
64
+ - unittest/test_docgenerator.rb
65
+ - unittest/unittest_docgenerator.rb
66
+ - unittest/unittest_wiki2doc.rb
67
+ - unittest/expected/test_beamer_note.html
68
+ - unittest/expected/test_beamer_note.latex
69
+ - unittest/expected/test_beamer_note.text
70
+ - unittest/expected/test_beamer_note.wiki
71
+ - unittest/expected/test_block.html
72
+ - unittest/expected/test_block.latex
73
+ - unittest/expected/test_block.text
74
+ - unittest/expected/test_block.wiki
75
+ - unittest/expected/test_css.css
76
+ - unittest/expected/test_css2.css
77
+ - unittest/expected/test_description.html
78
+ - unittest/expected/test_description.latex
79
+ - unittest/expected/test_description.text
80
+ - unittest/expected/test_description.wiki
81
+ - unittest/expected/test_document_article.latex
82
+ - unittest/expected/test_document_html.html
83
+ - unittest/expected/test_document_replacement_article.latex
84
+ - unittest/expected/test_document_replacement_html.html
85
+ - unittest/expected/test_document_replacement_text.text
86
+ - unittest/expected/test_document_replacement_wiki.wiki
87
+ - unittest/expected/test_document_text.text
88
+ - unittest/expected/test_document_wiki.wiki
89
+ - unittest/expected/test_enumerate.html
90
+ - unittest/expected/test_enumerate.latex
91
+ - unittest/expected/test_enumerate.text
92
+ - unittest/expected/test_enumerate.wiki
93
+ - unittest/expected/test_footnote.html
94
+ - unittest/expected/test_footnote.latex
95
+ - unittest/expected/test_footnote.text
96
+ - unittest/expected/test_footnote.wiki
97
+ - unittest/expected/test_footnote_group.html
98
+ - unittest/expected/test_footnote_group.latex
99
+ - unittest/expected/test_footnote_group.wiki
100
+ - unittest/expected/test_href.html
101
+ - unittest/expected/test_href.latex
102
+ - unittest/expected/test_href.text
103
+ - unittest/expected/test_html_css.html
104
+ - unittest/expected/test_itemize.html
105
+ - unittest/expected/test_itemize.latex
106
+ - unittest/expected/test_itemize.text
107
+ - unittest/expected/test_itemize.wiki
108
+ - unittest/expected/test_section.html
109
+ - unittest/expected/test_section.latex
110
+ - unittest/expected/test_section.text
111
+ - unittest/expected/test_section.wiki
112
+ - unittest/expected/test_tabular.html
113
+ - unittest/expected/test_tabular.latex
114
+ - unittest/expected/test_tabular.wiki
115
+ - unittest/expected/test_tabular_doc.latex
116
+ - unittest/expected/test_wiki.html
117
+ - unittest/expected/test_wiki.latex
118
+ - unittest/expected/test_wiki.text
119
+ - unittest/expected/test_wiki.wiki
120
+ - unittest/expected/test_wiki_amazon.html
121
+ - unittest/expected/test_wiki_description.html
122
+ - unittest/expected/test_wiki_description.latex
123
+ - unittest/expected/test_wiki_description.text
124
+ - unittest/expected/test_wiki_description.wiki
125
+ - unittest/expected/test_wiki_footnote.html
126
+ - unittest/expected/test_wiki_footnote.latex
127
+ - unittest/expected/test_wiki_footnote.text
128
+ - unittest/expected/test_wiki_footnote.wiki
129
+ - unittest/expected/test_wiki_footnote_groupid.html
130
+ - unittest/expected/test_wiki_html_code.html
131
+ - unittest/expected/test_wiki_html_code.latex
132
+ - unittest/expected/test_wiki_html_code.text
133
+ - unittest/expected/test_wiki_html_code.wiki
134
+ - unittest/expected/test_wiki_inline.html
135
+ - unittest/expected/test_wiki_inline.latex
136
+ - unittest/expected/test_wiki_inline.text
137
+ - unittest/expected/test_wiki_inline.wiki
138
+ - unittest/expected/test_wiki_label.html
139
+ - unittest/expected/test_wiki_link.html
140
+ - unittest/expected/test_wiki_link.latex
141
+ - unittest/expected/test_wiki_link.log
142
+ - unittest/expected/test_wiki_link.wiki
143
+ - unittest/expected/test_wiki_list_ol.html
144
+ - unittest/expected/test_wiki_list_ol.latex
145
+ - unittest/expected/test_wiki_list_ol.text
146
+ - unittest/expected/test_wiki_list_ol.wiki
147
+ - unittest/expected/test_wiki_list_ol_after_ul.html
148
+ - unittest/expected/test_wiki_list_ol_after_ul.latex
149
+ - unittest/expected/test_wiki_list_ol_after_ul.text
150
+ - unittest/expected/test_wiki_list_ol_after_ul.wiki
151
+ - unittest/expected/test_wiki_list_ol_ul.html
152
+ - unittest/expected/test_wiki_list_ol_ul.latex
153
+ - unittest/expected/test_wiki_list_ol_ul.text
154
+ - unittest/expected/test_wiki_list_ol_ul.wiki
155
+ - unittest/expected/test_wiki_list_ul.html
156
+ - unittest/expected/test_wiki_list_ul.latex
157
+ - unittest/expected/test_wiki_list_ul.text
158
+ - unittest/expected/test_wiki_list_ul.wiki
159
+ - unittest/expected/test_wiki_list_ul_too_much.html
160
+ - unittest/expected/test_wiki_list_ul_too_much.latex
161
+ - unittest/expected/test_wiki_list_ul_too_much.text
162
+ - unittest/expected/test_wiki_list_ul_too_much.wiki
163
+ - unittest/expected/test_wiki_picture.html
164
+ - unittest/expected/test_wiki_picture.latex
165
+ - unittest/expected/test_wiki_picture_thumb.html
166
+ - unittest/expected/test_wiki_tab1.html
167
+ - unittest/expected/test_wiki_tab1.latex
168
+ - unittest/expected/test_wiki_tab1.wiki
169
+ - unittest/expected/test_wiki_textformatting.html
170
+ - unittest/expected/test_wiki_textformatting.latex
171
+ - unittest/expected/test_wiki_textformatting.text
172
+ - unittest/expected/test_wiki_textformatting.wiki
173
+ - unittest/expected/test_wiki_toc.html
174
+ - unittest/expected/test_wiki_toc.latex
175
+ - unittest/expected/test_wiki_toc.text
176
+ - unittest/expected/test_wiki_toc.wiki
177
+ - unittest/expected/test_wiki_ul_multiple_line.html
178
+ - unittest/expected/test_wiki_ul_multiple_line.latex
179
+ - unittest/expected/test_wiki_ul_multiple_line.text
180
+ - unittest/expected/test_wiki_ul_multiple_line.wiki
57
181
  rdoc_options: []
58
182
 
59
183
  extra_rdoc_files: []
@@ -62,7 +186,7 @@ executables: []
62
186
 
63
187
  extensions: []
64
188
 
65
- requirements: []
66
-
189
+ requirements:
190
+ - A (La)TeX-system if used as TeX-generator (in fact, you can create TeX-Files, but without a TeX-System you will have no fun with it ;-))
67
191
  dependencies: []
68
192