hikidoc 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,7 +37,7 @@ rescue LoadError
37
37
  end
38
38
 
39
39
  class HikiDoc
40
- VERSION = "0.0.1" # FIXME
40
+ VERSION = "0.0.2" # FIXME
41
41
 
42
42
  class Error < StandardError
43
43
  end
@@ -330,9 +330,9 @@ class HikiDoc
330
330
 
331
331
  def compile_indented_pre(f)
332
332
  lines = f.span(INDENTED_PRE_RE)\
333
- .map {|line| rstrip(line.sub(INDENTED_PRE_RE, "")) }\
334
- .map {|line| @output.text(line) }
335
- @output.preformatted restore_plugin_block(lines.join("\n"))
333
+ .map {|line| rstrip(line.sub(INDENTED_PRE_RE, "")) }
334
+ text = restore_plugin_block(lines.join("\n"))
335
+ @output.preformatted(@output.text(text))
336
336
  end
337
337
 
338
338
  BLOCK_PRE_OPEN_RE = /\A<<<\s*(\w+)?/
@@ -468,7 +468,7 @@ class HikiDoc
468
468
  end
469
469
 
470
470
  def fix_uri(uri)
471
- if %r|://| !~ uri and /\Amailto:/ !~ uri
471
+ if /\A(?:https?|ftp|file):(?!\/\/)/ =~ uri
472
472
  uri.sub(/\A\w+:/, "")
473
473
  else
474
474
  uri
@@ -506,7 +506,7 @@ class HikiDoc
506
506
  when chunk = m[1]
507
507
  mod, s = split_mod(chunk)
508
508
  mid = MODTAG[mod]
509
- buf << @output.__send__(mid, compile_modifier(s))
509
+ buf << @output.__send__(mid, compile_inline(s))
510
510
  else
511
511
  raise UnexpectedError, "must not happen"
512
512
  end
File without changes
@@ -47,6 +47,32 @@ class HikiDocTestCase < Test::Unit::TestCase
47
47
  options)
48
48
  end
49
49
 
50
+ def test_multi_line_plugin
51
+ assert_convert(<<-END_OF_EXPECTED, <<-END_OF_INPUT)
52
+ <div class="plugin">{{&lt;&lt;TEST2
53
+ test2
54
+ TEST2}}</div>
55
+ END_OF_EXPECTED
56
+ {{<<TEST2
57
+ test2
58
+ TEST2}}
59
+ END_OF_INPUT
60
+
61
+ assert_convert(<<-END_OF_EXPECTED, <<-END_OF_INPUT)
62
+ <div class="plugin">{{&lt;&lt;TEST
63
+ &lt;&lt;&lt;
64
+ here is not pre but plugin.
65
+ &gt;&gt;&gt;
66
+ TEST}}</div>
67
+ END_OF_EXPECTED
68
+ {{<<TEST
69
+ <<<
70
+ here is not pre but plugin.
71
+ >>>
72
+ TEST}}
73
+ END_OF_INPUT
74
+ end
75
+
50
76
  def test_blockquote
51
77
  assert_convert("<blockquote><p>hoge</p>\n</blockquote>\n",
52
78
  %Q|""hoge\n|)
@@ -119,6 +145,10 @@ class HikiDocTestCase < Test::Unit::TestCase
119
145
  " foo\n bar\n")
120
146
  assert_convert("<pre>&lt;foo&gt;</pre>\n",
121
147
  " <foo>")
148
+ assert_convert("<pre>{{_:a/a}}</pre>\n",
149
+ " {{_:a/a}}")
150
+ assert_convert("<pre>[[_:a/a]]</pre>\n",
151
+ " [[_:a/a]]")
122
152
  end
123
153
 
124
154
  def test_multi_pre
@@ -132,6 +162,12 @@ class HikiDocTestCase < Test::Unit::TestCase
132
162
  "<<<\n<foo>\n>>>")
133
163
  end
134
164
 
165
+ def test_multi_pre_with_plugin
166
+ assert_convert("<pre>{{{}}}</pre>\n" +
167
+ "<div class=\"plugin\">{{'test'}}</div>\n",
168
+ "<<<\n{{{}}}\n>>>\n{{'test'}}")
169
+ end
170
+
135
171
  def test_comment
136
172
  assert_convert("", "// foo")
137
173
  assert_convert("", "// foo\n")
@@ -189,6 +225,13 @@ class HikiDocTestCase < Test::Unit::TestCase
189
225
  "[[aa]]bb[[cc]]")
190
226
  end
191
227
 
228
+ def test_inter_wiki_name
229
+ assert_convert("<p><a href=\"scheme:keyword\">scheme:keyword</a></p>\n",
230
+ "[[scheme:keyword]]")
231
+ assert_convert("<p><a href=\"scheme:keyword\">label</a></p>\n",
232
+ "[[label|scheme:keyword]]")
233
+ end
234
+
192
235
  def test_wiki_name
193
236
  assert_convert("<p><a href=\"WikiName\">WikiName</a></p>\n",
194
237
  "WikiName")
@@ -277,13 +320,33 @@ class HikiDocTestCase < Test::Unit::TestCase
277
320
  end
278
321
 
279
322
  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|,
323
+ assert_convert("<dl>\n<dt><a href=\"http://hikiwiki.org/\">Hiki</a></dt>\n" +
324
+ "<dd>Website</dd>\n</dl>\n",
281
325
  ":[[Hiki|http://hikiwiki.org/]]:Website")
326
+ assert_convert("<dl>\n<dt>a</dt>\n" +
327
+ "<dd><a href=\"http://hikiwiki.org/\">Hiki</a></dd>\n" +
328
+ "</dl>\n",
329
+ ":a:[[Hiki|http://hikiwiki.org/]]")
282
330
  end
283
331
 
284
332
  def test_definition_with_modifier
285
- assert_convert(%Q|<dl>\n<dt><strong>foo</strong></dt>\n<dd>bar</dd>\n</dl>\n|,
333
+ assert_convert("<dl>\n<dt><strong>foo</strong></dt>\n" +
334
+ "<dd>bar</dd>\n</dl>\n",
286
335
  ":'''foo''':bar")
336
+ assert_convert("<dl>\n<dt>foo</dt>\n" +
337
+ "<dd><strong>bar</strong></dd>\n</dl>\n",
338
+ ":foo:'''bar'''")
339
+ end
340
+
341
+ def test_definition_with_modifier_link
342
+ assert_convert("<dl>\n<dt>" +
343
+ "<strong><a href=\"http://hikiwiki.org/\">Hiki</a></strong>" +
344
+ "</dt>\n<dd>Website</dd>\n</dl>\n",
345
+ ":'''[[Hiki|http://hikiwiki.org/]]''':Website")
346
+ assert_convert("<dl>\n<dt>Website</dt>\n<dd>" +
347
+ "<strong><a href=\"http://hikiwiki.org/\">Hiki</a></strong>" +
348
+ "</dd>\n</dl>\n",
349
+ ":Website:'''[[Hiki|http://hikiwiki.org/]]'''")
287
350
  end
288
351
 
289
352
  def test_table
@@ -335,6 +398,8 @@ class HikiDocTestCase < Test::Unit::TestCase
335
398
  def test_modifier_and_link
336
399
  assert_convert("<p><a href=\"http://hikiwiki.org/\"><strong>Hiki</strong></a></p>\n",
337
400
  "[['''Hiki'''|http://hikiwiki.org/]]")
401
+ assert_convert("<p><strong><a href=\"http://hikiwiki.org/\">Hiki</a></strong></p>\n",
402
+ "'''[[Hiki|http://hikiwiki.org/]]'''")
338
403
  end
339
404
 
340
405
  def test_pre_and_plugin
@@ -363,6 +428,13 @@ class HikiDocTestCase < Test::Unit::TestCase
363
428
  end
364
429
  end
365
430
 
431
+ def test_plugin_in_pre_with_header
432
+ assert_convert("<h1>Title</h1>\n<pre>{{_/a:a}}</pre>\n",
433
+ "! Title\n {{_/a:a}}")
434
+ assert_convert("<h1>Title</h1>\n<pre>{{_/a:a}}\n{{_/a:a}}</pre>\n",
435
+ "! Title\n {{_/a:a}}\n {{_/a:a}}")
436
+ end
437
+
366
438
  private
367
439
  def assert_convert(expected, markup, options={}, message=nil)
368
440
  assert_equal(expected, HikiDoc.to_xhtml(markup, options), message)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hikidoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuhiko
@@ -9,17 +9,18 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2007-12-31 00:00:00 +09:00
12
+ date: 2008-08-12 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hoe
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
20
21
  - - ">="
21
22
  - !ruby/object:Gem::Version
22
- version: 1.4.0
23
+ version: 1.2.1
23
24
  version:
24
25
  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
26
  email:
@@ -38,6 +39,8 @@ files:
38
39
  - TextFormattingRules
39
40
  - TextFormattingRules.ja
40
41
  - bin/hikidoc
42
+ - coverage/index.html
43
+ - coverage/lib-hikidoc_rb.html
41
44
  - lib/hikidoc.rb
42
45
  - setup.rb
43
46
  - test/run-test.rb
@@ -65,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
68
  requirements: []
66
69
 
67
70
  rubyforge_project: hikidoc
68
- rubygems_version: 1.0.1
71
+ rubygems_version: 1.2.0
69
72
  signing_key:
70
73
  specification_version: 2
71
74
  summary: "'HikiDoc' is a text-to-HTML conversion tool for web writers."