hikidoc 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +28 -0
- data/README +85 -0
- data/README.ja +82 -0
- data/Rakefile +48 -0
- data/TextFormattingRules +316 -0
- data/TextFormattingRules.ja +314 -0
- data/bin/hikidoc +53 -0
- data/lib/hikidoc.rb +902 -0
- data/setup.rb +1360 -0
- data/test/run-test.rb +9 -0
- data/test/test_hikidoc.rb +376 -0
- metadata +73 -0
data/test/run-test.rb
ADDED
@@ -0,0 +1,376 @@
|
|
1
|
+
require "test/unit"
|
2
|
+
rootdir = "#{File::dirname(__FILE__)}/.."
|
3
|
+
require "#{rootdir}/lib/hikidoc"
|
4
|
+
|
5
|
+
class HikiDocTestCase < Test::Unit::TestCase
|
6
|
+
def test_plugin
|
7
|
+
assert_convert("<div class=\"plugin\">{{hoge}}</div>\n",
|
8
|
+
"{{hoge}}")
|
9
|
+
assert_convert("<p>a<span class=\"plugin\">{{hoge}}</span>b</p>\n",
|
10
|
+
"a{{hoge}}b")
|
11
|
+
assert_convert("<p>\\<span class=\"plugin\">{{hoge}}</span></p>\n",
|
12
|
+
"\\{{hoge}}")
|
13
|
+
assert_convert("<p>a{{hoge</p>\n",
|
14
|
+
"a{{hoge")
|
15
|
+
assert_convert("<p>hoge}}b</p>\n",
|
16
|
+
"hoge}}b")
|
17
|
+
assert_convert("<p><span class=\"plugin\">{{hoge}}</span>\na</p>\n",
|
18
|
+
"{{hoge}}\na")
|
19
|
+
assert_convert("<div class=\"plugin\">{{hoge}}</div>\n<p>a</p>\n",
|
20
|
+
"{{hoge}}\n\na")
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_plugin_with_quotes
|
24
|
+
assert_convert("<div class=\"plugin\">{{hoge(\"}}\")}}</div>\n",
|
25
|
+
'{{hoge("}}")}}')
|
26
|
+
assert_convert("<div class=\"plugin\">{{hoge(\'}}\')}}</div>\n",
|
27
|
+
"{{hoge('}}')}}")
|
28
|
+
assert_convert("<div class=\"plugin\">{{hoge(\'\n}}\n\')}}</div>\n",
|
29
|
+
"{{hoge('\n}}\n')}}")
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_plugin_with_meta_char
|
33
|
+
assert_convert("<div class=\"plugin\">{{hoge(\"a\\\"b\")}}</div>\n",
|
34
|
+
'{{hoge("a\\"b")}}')
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_plugin_with_custom_syntax
|
38
|
+
assert_convert("<p>{{<<\"End\"\nfoo's bar\nEnd\n}}</p>\n",
|
39
|
+
"{{<<\"End\"\nfoo's bar\nEnd\n}}")
|
40
|
+
|
41
|
+
options = {:plugin_syntax => method(:custom_valid_plugin_syntax?)}
|
42
|
+
assert_convert(%Q|<div class="plugin">{{<<"End"\nfoo's bar\nEnd\n}}</div>\n|,
|
43
|
+
%Q!{{<<"End"\nfoo's bar\nEnd\n}}!,
|
44
|
+
options)
|
45
|
+
assert_convert(%Q|<div class="plugin">{{<<"End"\nfoo\nEnd}}</div>\n|,
|
46
|
+
%Q!{{<<"End"\nfoo\nEnd}}!,
|
47
|
+
options)
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_blockquote
|
51
|
+
assert_convert("<blockquote><p>hoge</p>\n</blockquote>\n",
|
52
|
+
%Q|""hoge\n|)
|
53
|
+
assert_convert("<blockquote><p>hoge\nfuga</p>\n</blockquote>\n",
|
54
|
+
%Q|""hoge\n""fuga\n|)
|
55
|
+
assert_convert("<blockquote><p>hoge</p>\n<blockquote><p>fuga</p>\n</blockquote>\n</blockquote>\n",
|
56
|
+
%Q|""hoge\n"" ""fuga\n|)
|
57
|
+
assert_convert("<blockquote><h1>hoge</h1>\n</blockquote>\n",
|
58
|
+
%Q|"" ! hoge\n|)
|
59
|
+
assert_convert("<blockquote><p>foo\nbar</p>\n<p>foo</p>\n</blockquote>\n",
|
60
|
+
%Q|""foo\n""bar\n""\n""foo|)
|
61
|
+
assert_convert("<blockquote><p>foo\nbar</p>\n<h1>foo</h1>\n</blockquote>\n",
|
62
|
+
%Q|""foo\n""bar\n""!foo|)
|
63
|
+
assert_convert("<blockquote><p>foo\nbar</p>\n<pre>baz</pre>\n</blockquote>\n",
|
64
|
+
%Q|""foo\n"" bar\n"" baz|)
|
65
|
+
assert_convert("<blockquote><p>foo\nbar</p>\n<pre>baz</pre>\n</blockquote>\n",
|
66
|
+
%Q|""foo\n""\tbar\n""\t\tbaz|)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_header
|
70
|
+
assert_convert("<h1>hoge</h1>\n", "!hoge")
|
71
|
+
assert_convert("<h2>hoge</h2>\n", "!! hoge")
|
72
|
+
assert_convert("<h3>hoge</h3>\n", "!!!hoge")
|
73
|
+
assert_convert("<h4>hoge</h4>\n", "!!!! hoge")
|
74
|
+
assert_convert("<h5>hoge</h5>\n", "!!!!!hoge")
|
75
|
+
assert_convert("<h6>hoge</h6>\n", "!!!!!! hoge")
|
76
|
+
assert_convert("<h6>! hoge</h6>\n", "!!!!!!! hoge")
|
77
|
+
|
78
|
+
assert_convert("<h1>foo</h1>\n<h2>bar</h2>\n",
|
79
|
+
"!foo\n!!bar")
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_list
|
83
|
+
assert_convert("<ul>\n<li>foo</li>\n</ul>\n",
|
84
|
+
"* foo")
|
85
|
+
assert_convert("<ul>\n<li>foo</li>\n<li>bar</li>\n</ul>\n",
|
86
|
+
"* foo\n* bar")
|
87
|
+
assert_convert("<ul>\n<li>foo<ul>\n<li>bar</li>\n</ul></li>\n</ul>\n",
|
88
|
+
"* foo\n** bar")
|
89
|
+
assert_convert("<ul>\n<li>foo<ul>\n<li>foo</li>\n</ul></li>\n<li>bar</li>\n</ul>\n",
|
90
|
+
"* foo\n** foo\n* bar")
|
91
|
+
assert_convert("<ul>\n<li>foo<ol>\n<li>foo</li>\n</ol></li>\n<li>bar</li>\n</ul>\n",
|
92
|
+
"* foo\n## foo\n* bar")
|
93
|
+
assert_convert("<ul>\n<li>foo</li>\n</ul><ol>\n<li>bar</li>\n</ol>\n",
|
94
|
+
"* foo\n# bar")
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_list_skip
|
98
|
+
assert_convert("<ul>\n<li>foo<ul>\n<li><ul>\n<li>foo</li>\n</ul></li>\n</ul></li>\n<li>bar</li>\n</ul>\n",
|
99
|
+
"* foo\n*** foo\n* bar")
|
100
|
+
assert_convert("<ol>\n<li>foo<ol>\n<li><ol>\n<li>bar</li>\n<li>baz</li>\n</ol></li>\n</ol></li>\n</ol>\n",
|
101
|
+
"# foo\n### bar\n###baz")
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_hrules
|
105
|
+
assert_convert("<hr />\n", "----")
|
106
|
+
assert_convert("<p>----a</p>\n", "----a")
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_pre
|
110
|
+
assert_convert("<pre>foo</pre>\n",
|
111
|
+
" foo")
|
112
|
+
assert_convert("<pre>\\:</pre>\n",
|
113
|
+
' \:')
|
114
|
+
assert_convert("<pre>foo</pre>\n",
|
115
|
+
"\tfoo")
|
116
|
+
assert_convert("<pre>foo\nbar</pre>\n",
|
117
|
+
" foo\n bar")
|
118
|
+
assert_convert("<pre>foo\nbar</pre>\n",
|
119
|
+
" foo\n bar\n")
|
120
|
+
assert_convert("<pre><foo></pre>\n",
|
121
|
+
" <foo>")
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_multi_pre
|
125
|
+
assert_convert("<pre>foo</pre>\n",
|
126
|
+
"<<<\nfoo\n>>>")
|
127
|
+
assert_convert("<pre>foo\n bar</pre>\n",
|
128
|
+
"<<<\nfoo\n bar\n>>>")
|
129
|
+
assert_convert("<pre>foo</pre>\n<pre>bar</pre>\n",
|
130
|
+
"<<<\nfoo\n>>>\n<<<\nbar\n>>>")
|
131
|
+
assert_convert("<pre><foo></pre>\n",
|
132
|
+
"<<<\n<foo>\n>>>")
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_comment
|
136
|
+
assert_convert("", "// foo")
|
137
|
+
assert_convert("", "// foo\n")
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_paragraph
|
141
|
+
assert_convert("<p>foo</p>\n", "foo")
|
142
|
+
|
143
|
+
assert_convert("<p>foo</p>\n<p>bar</p>\n",
|
144
|
+
"foo\n\nbar")
|
145
|
+
assert_convert("<p>foo</p>\n<p>bar</p>\n",
|
146
|
+
"foo\r\n\r\nbar")
|
147
|
+
|
148
|
+
assert_convert("<p>foo </p>\n<p>b a r </p>\n",
|
149
|
+
"foo \n\nb a r ")
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_escape
|
153
|
+
assert_convert(%Q|<p>\\"\\"foo</p>\n|,
|
154
|
+
%q|\"\"foo|)
|
155
|
+
end
|
156
|
+
|
157
|
+
def test_link
|
158
|
+
assert_convert(%Q|<p><a href="http://hikiwiki.org/">http://hikiwiki.org/</a></p>\n|,
|
159
|
+
"http://hikiwiki.org/")
|
160
|
+
assert_convert(%Q|<p><a href="http://hikiwiki.org/">http://hikiwiki.org/</a></p>\n|,
|
161
|
+
"[[http://hikiwiki.org/]]")
|
162
|
+
assert_convert(%Q|<p><a href="http://hikiwiki.org/">Hiki</a></p>\n|,
|
163
|
+
"[[Hiki|http://hikiwiki.org/]]")
|
164
|
+
assert_convert(%Q|<p><a href="/hikiwiki.html">Hiki</a></p>\n|,
|
165
|
+
"[[Hiki|http:/hikiwiki.html]]")
|
166
|
+
assert_convert(%Q|<p><a href="hikiwiki.html">Hiki</a></p>\n|,
|
167
|
+
"[[Hiki|http:hikiwiki.html]]")
|
168
|
+
assert_convert(%Q|<p><img src="http://hikiwiki.org/img.png" alt="img.png" /></p>\n|,
|
169
|
+
"http://hikiwiki.org/img.png")
|
170
|
+
assert_convert(%Q|<p><a href="http://hikiwiki.org/ja/?c=edit;p=Test">| +
|
171
|
+
%Q|http://hikiwiki.org/ja/?c=edit;p=Test</a></p>\n|,
|
172
|
+
"http://hikiwiki.org/ja/?c=edit;p=Test")
|
173
|
+
assert_convert(%Q|<p><a href="http://hikiwiki.org/ja/?c=edit&p=Test">| +
|
174
|
+
%Q|http://hikiwiki.org/ja/?c=edit&p=Test</a></p>\n|,
|
175
|
+
"http://hikiwiki.org/ja/?c=edit&p=Test")
|
176
|
+
assert_convert(%Q|<p><img src="/img.png" alt="img.png" /></p>\n|,
|
177
|
+
"http:/img.png")
|
178
|
+
assert_convert(%Q|<p><img src="img.png" alt="img.png" /></p>\n|,
|
179
|
+
"http:img.png")
|
180
|
+
assert_convert(%Q|<p><a href="%CB%EE">Tuna</a></p>\n|,
|
181
|
+
"[[Tuna|%CB%EE]]")
|
182
|
+
assert_convert(%Q|<p><a href="""">""</a></p>\n|,
|
183
|
+
'[[""]]')
|
184
|
+
assert_convert(%Q|<p><a href="%22">%22</a></p>\n|,
|
185
|
+
"[[%22]]")
|
186
|
+
assert_convert(%Q|<p><a href="&">&</a></p>\n|,
|
187
|
+
"[[&]]")
|
188
|
+
assert_convert(%Q|<p><a href="aa">aa</a>bb<a href="cc">cc</a></p>\n|,
|
189
|
+
"[[aa]]bb[[cc]]")
|
190
|
+
end
|
191
|
+
|
192
|
+
def test_wiki_name
|
193
|
+
assert_convert("<p><a href=\"WikiName\">WikiName</a></p>\n",
|
194
|
+
"WikiName")
|
195
|
+
assert_convert("<p><a href=\"HogeRule1\">HogeRule1</a></p>\n",
|
196
|
+
"HogeRule1")
|
197
|
+
|
198
|
+
assert_convert("<p><a href=\"WikiName1WikiName2\">WikiName1WikiName2</a></p>\n",
|
199
|
+
"WikiName1WikiName2")
|
200
|
+
assert_convert("<p><a href=\"WikiName1\">WikiName1</a> " +
|
201
|
+
"<a href=\"WikiName2\">WikiName2</a></p>\n",
|
202
|
+
"WikiName1 WikiName2")
|
203
|
+
|
204
|
+
assert_convert("<p>NOTWIKINAME</p>\n",
|
205
|
+
"NOTWIKINAME")
|
206
|
+
assert_convert("<p>NOT_WIKI_NAME</p>\n",
|
207
|
+
"NOT_WIKI_NAME")
|
208
|
+
assert_convert("<p>WikiNAME</p>\n",
|
209
|
+
"WikiNAME")
|
210
|
+
assert_convert("<p>fooWikiNAME</p>\n",
|
211
|
+
"fooWikiNAME")
|
212
|
+
|
213
|
+
assert_convert("<p>RSSPage</p>\n",
|
214
|
+
"RSSPage")
|
215
|
+
assert_convert("<p><a href=\"RSSPageName\">RSSPageName</a></p>\n",
|
216
|
+
"RSSPageName")
|
217
|
+
end
|
218
|
+
|
219
|
+
def test_not_wiki_name
|
220
|
+
assert_convert("<p>WikiName</p>\n",
|
221
|
+
"^WikiName")
|
222
|
+
assert_convert("<p>^<a href=\"WikiName\">WikiName</a></p>\n",
|
223
|
+
"^WikiName",
|
224
|
+
:use_not_wiki_name => false)
|
225
|
+
assert_convert("<p>^WikiName</p>\n",
|
226
|
+
"^WikiName",
|
227
|
+
:use_wiki_name => false)
|
228
|
+
assert_convert("<p>^WikiName</p>\n",
|
229
|
+
"^WikiName",
|
230
|
+
:use_wiki_name => false,
|
231
|
+
:use_not_wiki_name => false)
|
232
|
+
end
|
233
|
+
|
234
|
+
def test_use_wiki_name_option
|
235
|
+
assert_convert("<p><a href=\"WikiName\">WikiName</a></p>\n",
|
236
|
+
"WikiName")
|
237
|
+
assert_convert("<p>WikiName</p>\n",
|
238
|
+
"WikiName",
|
239
|
+
:use_wiki_name => false)
|
240
|
+
end
|
241
|
+
|
242
|
+
def test_image_link
|
243
|
+
assert_convert(%Q|<p><img src="http://hikiwiki.org/img.png" alt="img.png" /></p>\n|,
|
244
|
+
"[[http://hikiwiki.org/img.png]]")
|
245
|
+
assert_convert(%Q|<p><a href="http://hikiwiki.org/img.png">http://hikiwiki.org/img.png</a></p>\n|,
|
246
|
+
"[[http://hikiwiki.org/img.png]]",
|
247
|
+
:allow_bracket_inline_image => false)
|
248
|
+
|
249
|
+
assert_convert(%Q|<p><img src="http://hikiwiki.org/img.png" alt="img" /></p>\n|,
|
250
|
+
"[[img|http://hikiwiki.org/img.png]]")
|
251
|
+
assert_convert(%Q|<p><a href="http://hikiwiki.org/img.png">img</a></p>\n|,
|
252
|
+
"[[img|http://hikiwiki.org/img.png]]",
|
253
|
+
:allow_bracket_inline_image => false)
|
254
|
+
end
|
255
|
+
|
256
|
+
def test_definition
|
257
|
+
assert_convert("<dl>\n<dt>a</dt>\n<dd>b</dd>\n</dl>\n",
|
258
|
+
":a:b")
|
259
|
+
assert_convert("<dl>\n<dt>a</dt>\n<dd>b\n</dd>\n<dd>c</dd>\n</dl>\n",
|
260
|
+
":a:b\n::c")
|
261
|
+
assert_convert("<dl>\n<dt>a\\</dt>\n<dd>b:c</dd>\n</dl>\n",
|
262
|
+
':a\:b:c')
|
263
|
+
assert_convert("<dl>\n<dt>a</dt>\n<dd>b\\:c</dd>\n</dl>\n",
|
264
|
+
':a:b\:c')
|
265
|
+
assert_convert("<dl>\n<dt>a</dt>\n<dd>b:c</dd>\n</dl>\n",
|
266
|
+
":a:b:c")
|
267
|
+
end
|
268
|
+
|
269
|
+
def test_definition_title_only
|
270
|
+
assert_convert("<dl>\n<dt>a</dt>\n</dl>\n",
|
271
|
+
":a:")
|
272
|
+
end
|
273
|
+
|
274
|
+
def test_definition_description_only
|
275
|
+
assert_convert("<dl>\n<dd>b</dd>\n</dl>\n",
|
276
|
+
"::b")
|
277
|
+
end
|
278
|
+
|
279
|
+
def test_definition_with_link
|
280
|
+
assert_convert(%Q|<dl>\n<dt><a href="http://hikiwiki.org/">Hiki</a></dt>\n<dd>Website</dd>\n</dl>\n|,
|
281
|
+
":[[Hiki|http://hikiwiki.org/]]:Website")
|
282
|
+
end
|
283
|
+
|
284
|
+
def test_definition_with_modifier
|
285
|
+
assert_convert(%Q|<dl>\n<dt><strong>foo</strong></dt>\n<dd>bar</dd>\n</dl>\n|,
|
286
|
+
":'''foo''':bar")
|
287
|
+
end
|
288
|
+
|
289
|
+
def test_table
|
290
|
+
assert_convert(%Q|<table border=\"1\">\n<tr><td>a</td><td>b</td></tr>\n</table>\n|,
|
291
|
+
"||a||b")
|
292
|
+
assert_convert(%Q|<table border=\"1\">\n<tr><td>a</td><td>b</td></tr>\n</table>\n|,
|
293
|
+
"||a||b||")
|
294
|
+
assert_convert(%Q|<table border=\"1\">\n<tr><td>a</td><td>b</td></tr>\n</table>\n|,
|
295
|
+
"||a||b||")
|
296
|
+
assert_convert(%Q|<table border=\"1\">\n<tr><td>a</td><td>b</td><td> </td></tr>\n</table>\n|,
|
297
|
+
"||a||b|| ")
|
298
|
+
assert_convert(%Q|<table border=\"1\">\n<tr><th>a</th><td>b</td></tr>\n</table>\n|,
|
299
|
+
"||!a||b||")
|
300
|
+
assert_convert(%Q|<table border=\"1\">\n<tr><td colspan=\"2\">1</td><td rowspan=\"2\">2\n</td></tr>\n<tr><td rowspan=\"2\">3</td><td>4\n</td></tr>\n<tr><td colspan=\"2\">5</td></tr>\n</table>\n|,
|
301
|
+
"||>1||^2\n||^3||4\n||>5")
|
302
|
+
assert_convert(%Q|<table border=\"1\">\n<tr><td>a</td><td>b</td><td>c</td></tr>\n<tr><td></td><td></td><td></td></tr>\n<tr><td>d</td><td>e</td><td>f</td></tr>\n</table>\n|,
|
303
|
+
"||a||b||c||\n||||||||\n||d||e||f||")
|
304
|
+
end
|
305
|
+
|
306
|
+
def test_table_with_modifier
|
307
|
+
assert_convert("<table border=\"1\">\n<tr><td>'''</td><td>'''</td><td>bar</td></tr>\n</table>\n",
|
308
|
+
"||'''||'''||bar")
|
309
|
+
assert_convert("<table border=\"1\">\n<tr><td>'''\\</td><td>'''</td><td>bar</td></tr>\n</table>\n",
|
310
|
+
"||'''\\||'''||bar")
|
311
|
+
end
|
312
|
+
|
313
|
+
def test_modifier
|
314
|
+
assert_convert("<p><strong>foo</strong></p>\n",
|
315
|
+
"'''foo'''")
|
316
|
+
assert_convert("<p><em>foo</em></p>\n",
|
317
|
+
"''foo''")
|
318
|
+
assert_convert("<p><del>foo</del></p>\n",
|
319
|
+
"==foo==")
|
320
|
+
assert_convert("<p><em>foo==bar</em>baz==</p>\n",
|
321
|
+
"''foo==bar''baz==")
|
322
|
+
assert_convert("<p><strong>foo</strong> and <strong>bar</strong></p>\n",
|
323
|
+
"'''foo''' and '''bar'''")
|
324
|
+
assert_convert("<p><em>foo</em> and <em>bar</em></p>\n",
|
325
|
+
"''foo'' and ''bar''")
|
326
|
+
end
|
327
|
+
|
328
|
+
def test_nested_modifier
|
329
|
+
assert_convert("<p><em><del>foo</del></em></p>\n",
|
330
|
+
"''==foo==''")
|
331
|
+
assert_convert("<p><del><em>foo</em></del></p>\n",
|
332
|
+
"==''foo''==")
|
333
|
+
end
|
334
|
+
|
335
|
+
def test_modifier_and_link
|
336
|
+
assert_convert("<p><a href=\"http://hikiwiki.org/\"><strong>Hiki</strong></a></p>\n",
|
337
|
+
"[['''Hiki'''|http://hikiwiki.org/]]")
|
338
|
+
end
|
339
|
+
|
340
|
+
def test_pre_and_plugin
|
341
|
+
assert_convert(%Q|<pre>{{hoge}}</pre>\n|,
|
342
|
+
" {{hoge}}")
|
343
|
+
assert_convert(%Q|<pre>{{hoge}}</pre>\n|,
|
344
|
+
"<<<\n{{hoge}}\n>>>")
|
345
|
+
assert_convert("<div class=\"plugin\">{{foo\n 1}}</div>\n",
|
346
|
+
"{{foo\n 1}}")
|
347
|
+
end
|
348
|
+
|
349
|
+
def test_plugin_in_modifier
|
350
|
+
assert_convert("<p><strong><span class=\"plugin\">{{foo}}</span></strong></p>\n",
|
351
|
+
"'''{{foo}}'''")
|
352
|
+
end
|
353
|
+
|
354
|
+
if Object.const_defined?(:Syntax)
|
355
|
+
|
356
|
+
def test_syntax_ruby
|
357
|
+
assert_convert("<pre><span class=\"keyword\">class </span><span class=\"class\">A</span>\n <span class=\"keyword\">def </span><span class=\"method\">foo</span><span class=\"punct\">(</span><span class=\"ident\">bar</span><span class=\"punct\">)</span>\n <span class=\"keyword\">end</span>\n<span class=\"keyword\">end</span></pre>\n",
|
358
|
+
"<<< ruby\nclass A\n def foo(bar)\n end\nend\n>>>")
|
359
|
+
assert_convert("<pre><span class=\"keyword\">class </span><span class=\"class\">A</span>\n <span class=\"keyword\">def </span><span class=\"method\">foo</span><span class=\"punct\">(</span><span class=\"ident\">bar</span><span class=\"punct\">)</span>\n <span class=\"keyword\">end</span>\n<span class=\"keyword\">end</span></pre>\n",
|
360
|
+
"<<< Ruby\nclass A\n def foo(bar)\n end\nend\n>>>")
|
361
|
+
assert_convert("<pre><span class=\"punct\">'</span><span class=\"string\">a<">b</span><span class=\"punct\">'</span></pre>\n",
|
362
|
+
"<<< ruby\n'a<\">b'\n>>>")
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
private
|
367
|
+
def assert_convert(expected, markup, options={}, message=nil)
|
368
|
+
assert_equal(expected, HikiDoc.to_xhtml(markup, options), message)
|
369
|
+
end
|
370
|
+
|
371
|
+
def custom_valid_plugin_syntax?(code)
|
372
|
+
eval("BEGIN {return true}\n#{code}", nil, "(plugin)", 0)
|
373
|
+
rescue SyntaxError
|
374
|
+
false
|
375
|
+
end
|
376
|
+
end
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hikidoc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kazuhiko
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2007-12-31 00:00:00 +09:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hoe
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.4.0
|
23
|
+
version:
|
24
|
+
description: "'HikiDoc' is a text-to-HTML conversion tool for web writers. HikiDoc allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid HTML (or XHTML)."
|
25
|
+
email:
|
26
|
+
- kazuhiko@fdiary.net
|
27
|
+
executables:
|
28
|
+
- hikidoc
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files: []
|
32
|
+
|
33
|
+
files:
|
34
|
+
- COPYING
|
35
|
+
- README
|
36
|
+
- README.ja
|
37
|
+
- Rakefile
|
38
|
+
- TextFormattingRules
|
39
|
+
- TextFormattingRules.ja
|
40
|
+
- bin/hikidoc
|
41
|
+
- lib/hikidoc.rb
|
42
|
+
- setup.rb
|
43
|
+
- test/run-test.rb
|
44
|
+
- test/test_hikidoc.rb
|
45
|
+
has_rdoc: true
|
46
|
+
homepage: http://rubyforge.org/projects/hikidoc/
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options:
|
49
|
+
- --main
|
50
|
+
- README.txt
|
51
|
+
require_paths:
|
52
|
+
- lib
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: "0"
|
58
|
+
version:
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
version:
|
65
|
+
requirements: []
|
66
|
+
|
67
|
+
rubyforge_project: hikidoc
|
68
|
+
rubygems_version: 1.0.1
|
69
|
+
signing_key:
|
70
|
+
specification_version: 2
|
71
|
+
summary: "'HikiDoc' is a text-to-HTML conversion tool for web writers."
|
72
|
+
test_files:
|
73
|
+
- test/test_hikidoc.rb
|