flannel 0.2.11 → 0.2.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 2
4
- :patch: 11
4
+ :patch: 12
5
5
  :build:
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{flannel}
8
- s.version = "0.2.11"
8
+ s.version = "0.2.12"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jamal Hansen"]
12
- s.date = %q{2010-02-24}
12
+ s.date = %q{2010-02-25}
13
13
  s.default_executable = %q{quilt-it}
14
14
  s.email = %q{jamal.hansen@gmail.com}
15
15
  s.executables = ["quilt-it"]
@@ -2,28 +2,40 @@ module Flannel
2
2
  class BaseBlock
3
3
  attr_reader :type, :id, :text, :parent_id, :attributes
4
4
 
5
- def initialize args
6
- header = args.shift
5
+ def initialize block
6
+ form = block[0]
7
+
8
+ if form == :block
9
+ create_from_list block[1]
10
+ else
11
+ @text = block[1]
12
+ @type = :paragraph
13
+ end
14
+
15
+ strip_text
16
+ end
17
+
18
+ def create_from_list list
19
+ header = list.shift
7
20
  @type = header.shift[1]
8
21
  @id = header.shift[1]
9
22
  @attributes = {}
10
23
 
11
- next_arg = header.shift
12
- while next_arg
13
- case next_arg[0]
24
+ next_item = header.shift
25
+ while next_item
26
+ case next_item[0]
14
27
  when :parent_id then
15
- @parent_id = next_arg[1]
28
+ @parent_id = next_item[1]
16
29
  when :attribute_list then
17
- next_arg.shift
18
- next_arg.each do |attribute|
30
+ next_item.shift
31
+ next_item.each do |attribute|
19
32
  @attributes[attribute[0]] = attribute[1]
20
33
  end
21
34
  end
22
- next_arg = header.shift
35
+ next_item = header.shift
23
36
  end
24
37
 
25
- @text = args.shift
26
- strip_text
38
+ @text = list.shift
27
39
  end
28
40
 
29
41
  def to_h
@@ -1,6 +1,6 @@
1
1
  grammar Block
2
2
  rule document
3
- block* {
3
+ ( block / not_flannel)* {
4
4
  def content
5
5
  elements.map{ |element| element.content}
6
6
  end
@@ -10,13 +10,13 @@ grammar Block
10
10
  rule block
11
11
  block_header block_text? {
12
12
  def content
13
- elements.map{ |element| element.respond_to?(:content) ? element.content : nil}.compact
13
+ [ :block, elements.map{ |element| element.respond_to?(:content) ? element.content : nil}.compact ]
14
14
  end
15
15
  }
16
16
  end
17
17
 
18
18
  rule block_header
19
- block_start block_type block_id? parent_id? attribute_list? [\n]* {
19
+ block_start block_type block_id? parent_id? attribute_list? [\s]* ":" [\n]? {
20
20
  def content
21
21
  elements.map{ |element| element.respond_to?(:content) ? element.content : nil}.compact
22
22
  end
@@ -40,7 +40,7 @@ grammar Block
40
40
  end
41
41
 
42
42
  rule block_type
43
- ( paragraph / feed / preformatted / list / header / blockquote ) {
43
+ ( feed / preformatted / list / header / blockquote / paragraph ) {
44
44
  def content
45
45
  [:block_type, text_value.to_sym ]
46
46
  end
@@ -48,7 +48,7 @@ grammar Block
48
48
  end
49
49
 
50
50
  rule paragraph
51
- "paragraph" { def content; text_value; end }
51
+ "paragraph" { def text_value; "paragraph"; end }
52
52
  end
53
53
 
54
54
  rule header
@@ -144,11 +144,11 @@ grammar Block
144
144
  }
145
145
  end
146
146
 
147
- #rule beginning_of_line
148
- # {
149
- # def content
150
- # nil
151
- # end
152
- # }
153
- #end
147
+ rule not_flannel
148
+ (!(block_header) .)+ {
149
+ def content
150
+ [:plain_text, text_value.strip ]
151
+ end
152
+ }
153
+ end
154
154
  end
@@ -1,13 +1,12 @@
1
1
  module Flannel
2
2
  class BlockCutter
3
3
  def cut markup
4
- #pieces = split_preformatted_blocks(markup)
5
- #pieces = pieces.map { |part| split_into_blocks(part) }
6
- #pieces.flatten!
7
- #convert_to_text_blocks pieces
8
-
9
4
  parser = BlockParser.new
10
- blocks = parser.parse(markup).content.map { |block| Flannel::BaseBlock.new(block) }
5
+ blocks = parser.parse(markup).content.map { |block| form_blocks block }
6
+ end
7
+
8
+ def form_blocks block
9
+ Flannel::BaseBlock.new(block)
11
10
  end
12
11
 
13
12
  def split_into_blocks markup
@@ -3,27 +3,27 @@ require 'test_helper'
3
3
  class HtmlGenerationTest < Test::Unit::TestCase
4
4
  context "basic behavior" do
5
5
  should "wrap in pre tags when preformatted" do
6
- block = Flannel::BaseBlock.new [[[:block_type, :preformatted], [:block_id, "some-id"], [:attribute_list]], "foo"]
6
+ block = new_block [[[:block_type, :preformatted], [:block_id, "some-id"], [:attribute_list]], "foo"]
7
7
  assert_equal "<pre id='some-id'>foo</pre>", block.to_h
8
8
  end
9
9
 
10
10
  should "wrap in ul tags when unordered_list" do
11
- block = Flannel::BaseBlock.new [[[:block_type, :list], [:block_id, "some-id"], [:attribute_list]], "foo"]
11
+ block = new_block [[[:block_type, :list], [:block_id, "some-id"], [:attribute_list]], "foo"]
12
12
  assert_equal "<ul id='some-id'><li>foo</li></ul>", block.to_h
13
13
  end
14
14
 
15
15
  should "convert [|] pattern to an external link" do
16
- block = Flannel::BaseBlock.new [[[:block_type, :paragraph], [:block_id, "some-id"], [:attribute_list]], "yadda [yadda|http://example.com] yadda"]
16
+ block = new_block [[[:block_type, :paragraph], [:block_id, "some-id"], [:attribute_list]], "yadda [yadda|http://example.com] yadda"]
17
17
  assert_equal %q{<p id='some-id'>yadda <a href="http://example.com" target="_blank">yadda</a> yadda</p>}, block.to_h
18
18
  end
19
19
 
20
20
  should "add http:// to external links" do
21
- block = Flannel::BaseBlock.new [[[:block_type, :paragraph], [:block_id, "some-id"], [:attribute_list]], "yadda [yadda|example.com] yadda"]
21
+ block = new_block [[[:block_type, :paragraph], [:block_id, "some-id"], [:attribute_list]], "yadda [yadda|example.com] yadda"]
22
22
  assert_equal %q{<p id='some-id'>yadda <a href="http://example.com" target="_blank">yadda</a> yadda</p>}, block.to_h
23
23
  end
24
24
 
25
25
  should "add create title if provided to external links" do
26
- block = Flannel::BaseBlock.new [[[:block_type, :paragraph], [:block_id, "some-id"], [:attribute_list]], "yadda [yadda|example.com|My title] yadda"]
26
+ block = new_block [[[:block_type, :paragraph], [:block_id, "some-id"], [:attribute_list]], "yadda [yadda|example.com|My title] yadda"]
27
27
  assert_equal %q{<p id='some-id'>yadda <a href="http://example.com" title="My title" target="_blank">yadda</a> yadda</p>}, block.to_h
28
28
  end
29
29
  end
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  class BaseBlockTest < Test::Unit::TestCase
4
4
  def test_initializes_with_header_array_and_text
5
- block = Flannel::BaseBlock.new [[[:block_type, :paragraph], [:block_id, "some-id"], [:attribute_list]], "some text"]
5
+ block = new_block [[[:block_type, :paragraph], [:block_id, "some-id"], [:attribute_list]], "some text"]
6
6
 
7
7
  assert_equal :paragraph, block.type
8
8
  assert_equal "some-id", block.id
@@ -10,7 +10,7 @@ class BaseBlockTest < Test::Unit::TestCase
10
10
  end
11
11
 
12
12
  def test_initializes_with_parent_id
13
- block = Flannel::BaseBlock.new [[[:block_type, :paragraph], [:block_id, "some-id"], [:parent_id, "parent-id"]], "some text"]
13
+ block = new_block [[[:block_type, :paragraph], [:block_id, "some-id"], [:parent_id, "parent-id"]], "some text"]
14
14
 
15
15
  assert_equal :paragraph, block.type
16
16
  assert_equal "some-id", block.id
@@ -19,7 +19,7 @@ class BaseBlockTest < Test::Unit::TestCase
19
19
  end
20
20
 
21
21
  def test_initializes_with_attribute_list
22
- block = Flannel::BaseBlock.new [[[:block_type, :paragraph], [:block_id, "some-id"], [:attribute_list, [:class, "cool"]]], "some text"]
22
+ block = new_block [[[:block_type, :paragraph], [:block_id, "some-id"], [:attribute_list, [:class, "cool"]]], "some text"]
23
23
 
24
24
  assert_equal :paragraph, block.type
25
25
  assert_equal "some-id", block.id
@@ -28,7 +28,7 @@ class BaseBlockTest < Test::Unit::TestCase
28
28
  end
29
29
 
30
30
  def test_initializes_with_attribute_list_and_parent_id
31
- block = Flannel::BaseBlock.new [[[:block_type, :paragraph], [:block_id, "some-id"], [:parent_id, "parent-id"], [:attribute_list, [:class, "cool"]]], "some text"]
31
+ block = new_block [[[:block_type, :paragraph], [:block_id, "some-id"], [:parent_id, "parent-id"], [:attribute_list, [:class, "cool"]]], "some text"]
32
32
 
33
33
  assert_equal :paragraph, block.type
34
34
  assert_equal "some-id", block.id
@@ -38,7 +38,7 @@ class BaseBlockTest < Test::Unit::TestCase
38
38
  end
39
39
 
40
40
  def test_initializes_with_header_array_and_no_text
41
- block = Flannel::BaseBlock.new [[[:block_type, :paragraph], [:block_id, "some-id"]]]
41
+ block = new_block [[[:block_type, :paragraph], [:block_id, "some-id"]]]
42
42
 
43
43
  assert_equal :paragraph, block.type
44
44
  assert_equal "some-id", block.id
@@ -46,7 +46,7 @@ class BaseBlockTest < Test::Unit::TestCase
46
46
  end
47
47
 
48
48
  def test_initialized_from_parser_output
49
- text = ":preformatted my-code great-code class=ruby whiz=bang\ndef foo arg\n\t puts arg\n end"
49
+ text = ":preformatted my-code great-code class=ruby whiz=bang:\ndef foo arg\n\t puts arg\n end"
50
50
  doc = BlockParser.new.parse(text)
51
51
  block = Flannel::BaseBlock.new doc.content[0]
52
52
 
@@ -7,7 +7,7 @@ class BlockCutterTest < Test::Unit::TestCase
7
7
  end
8
8
 
9
9
  should "split a flannel document into blocks based on block_headers" do
10
- markup = ":paragraph bar\n some text\n:paragraph baz\n some more text"
10
+ markup = ":paragraph bar: some text\n:paragraph baz: some more text"
11
11
 
12
12
  blocks = @block_cutter.cut markup
13
13
  assert_equal 2, blocks.length
@@ -20,7 +20,7 @@ class BlockCutterTest < Test::Unit::TestCase
20
20
  end
21
21
 
22
22
  should "accept a block without an id" do
23
- markup = ":paragraph\n some text"
23
+ markup = ":paragraph: some text"
24
24
 
25
25
  blocks = @block_cutter.cut markup
26
26
  assert_equal 1, blocks.length
@@ -30,7 +30,7 @@ class BlockCutterTest < Test::Unit::TestCase
30
30
  end
31
31
 
32
32
  should "not split preformatted text based on blank lines" do
33
- markup = ":preformatted my_preformatted\n foo\n\nbar\n"
33
+ markup = ":preformatted my_preformatted:\n foo\n\nbar\n"
34
34
 
35
35
  blocks = @block_cutter.cut markup
36
36
  assert_equal 1, blocks.length
@@ -41,7 +41,7 @@ class BlockCutterTest < Test::Unit::TestCase
41
41
 
42
42
 
43
43
  should "separate preformatted blocks" do
44
- markup = ":preformatted one\nfoo\n:preformatted two\nbar\n"
44
+ markup = ":preformatted one:foo\n:preformatted two:\nbar\n"
45
45
 
46
46
  blocks = @block_cutter.cut markup
47
47
  assert_equal 2, blocks.length
@@ -50,21 +50,21 @@ class BlockCutterTest < Test::Unit::TestCase
50
50
  end
51
51
 
52
52
  should "strip preformatted markers when found" do
53
- markup = ":preformatted foo\nfoo\n\nbar\n"
53
+ markup = ":preformatted foo:foo\n\nbar\n"
54
54
 
55
55
  blocks = @block_cutter.cut markup
56
56
  assert_equal "foo\n\nbar\n", blocks[0].text
57
57
  end
58
58
 
59
59
  should "set square style to feed based on full tag " do
60
- markup = ":feed wonki\nhttp://www.example.com/rss"
60
+ markup = ":feed: wonki\nhttp://www.example.com/rss"
61
61
 
62
62
  blocks = @block_cutter.cut markup
63
63
  assert_equal :feed, blocks[0].type
64
64
  end
65
65
 
66
66
  should "parse a paragraph with a simple wiki link" do
67
- markup = ":paragraph\n-ravioli>"
67
+ markup = ":paragraph:\n-ravioli>"
68
68
 
69
69
  blocks = @block_cutter.cut markup
70
70
  assert_equal :paragraph, blocks[0].type
@@ -73,7 +73,7 @@ class BlockCutterTest < Test::Unit::TestCase
73
73
  end
74
74
 
75
75
  should "parse a simple paragraph" do
76
- markup = ":paragraph\nbar bar\n"
76
+ markup = ":paragraph:bar bar\n"
77
77
 
78
78
  blocks = @block_cutter.cut markup
79
79
  assert_equal :paragraph, blocks[0].type
@@ -6,67 +6,67 @@ class BlockParserStylesTest < Test::Unit::TestCase
6
6
  end
7
7
 
8
8
  def test_paragraph
9
- doc = @parser.parse(":paragraph\ntext")
9
+ doc = @parser.parse(":paragraph:\ntext")
10
10
 
11
11
  assert_doc doc, :paragraph, nil, "text"
12
12
  end
13
-
13
+
14
14
  def test_list
15
- doc = @parser.parse(":list\ntext")
15
+ doc = @parser.parse(":list:\ntext")
16
16
 
17
17
  assert_doc doc, :list, nil, "text"
18
18
  end
19
19
 
20
20
  def test_feed
21
- doc = @parser.parse(":feed\ntext")
21
+ doc = @parser.parse(":feed:\ntext")
22
22
 
23
23
  assert_doc doc, :feed, nil, "text"
24
24
  end
25
25
 
26
26
  def test_blockquote
27
- doc = @parser.parse(":blockquote\ntext")
27
+ doc = @parser.parse(":blockquote:\ntext")
28
28
 
29
29
  assert_doc doc, :blockquote, nil, "text"
30
30
  end
31
31
 
32
32
  def test_preformatted
33
- doc = @parser.parse(":preformatted\ntext")
33
+ doc = @parser.parse(":preformatted:\ntext")
34
34
 
35
35
  assert_doc doc, :preformatted, nil, "text"
36
36
  end
37
37
 
38
38
  def test_header_one
39
- doc = @parser.parse(":header_one\ntext")
39
+ doc = @parser.parse(":header_one:\ntext")
40
40
 
41
41
  assert_doc doc, :header_one, nil, "text"
42
42
  end
43
43
 
44
44
  def test_header_two
45
- doc = @parser.parse(":header_two\ntext")
45
+ doc = @parser.parse(":header_two:\ntext")
46
46
 
47
47
  assert_doc doc, :header_two, nil, "text"
48
48
  end
49
49
 
50
50
  def test_header_three
51
- doc = @parser.parse(":header_three\ntext")
51
+ doc = @parser.parse(":header_three:\ntext")
52
52
 
53
53
  assert_doc doc, :header_three, nil, "text"
54
54
  end
55
55
 
56
56
  def test_header_four
57
- doc = @parser.parse(":header_four\ntext")
57
+ doc = @parser.parse(":header_four:\ntext")
58
58
 
59
59
  assert_doc doc, :header_four, nil, "text"
60
60
  end
61
61
 
62
62
  def test_header_five
63
- doc = @parser.parse(":header_five\ntext")
63
+ doc = @parser.parse(":header_five:\ntext")
64
64
 
65
65
  assert_doc doc, :header_five, nil, "text"
66
66
  end
67
67
 
68
68
  def test_header_six
69
- doc = @parser.parse(":header_six\ntext")
69
+ doc = @parser.parse(":header_six:\ntext")
70
70
 
71
71
  assert_doc doc, :header_six, nil, "text"
72
72
  end
@@ -10,44 +10,66 @@ class BlockParserTest < Test::Unit::TestCase
10
10
  assert_equal 0, @parser.parse("").content.length, "Parser was expected to return no elements for an empty string"
11
11
  end
12
12
 
13
+ def test_parser_returns_text_it_does_not_recognize
14
+ assert_equal [[:plain_text, "yadda foo bar === :cheese"]], @parser.parse("yadda foo bar === :cheese").content, "Parser was expected to return non flannel text"
15
+ end
16
+
17
+ def test_parser_returns_text_it_does_not_recognize_and_flannel
18
+ expected = [[:plain_text, "yadda foo bar === cheese"], [:block, [[[:block_type, :paragraph], [:attribute_list]], " foo"]]]
19
+
20
+ assert_equal expected, @parser.parse("yadda foo bar === cheese\n:paragraph: foo").content, "Parser was expected to return non flannel text"
21
+ end
22
+
13
23
  def test_parser_returns_simple_block
14
- doc = @parser.parse(":paragraph wonki\ntext")
24
+ doc = @parser.parse(":paragraph wonki:text")
25
+
26
+ assert_doc doc, :paragraph, "wonki", "text"
27
+ end
28
+
29
+ def test_colon_will_end_header
30
+ doc = @parser.parse(":paragraph wonki:text")
31
+
32
+ assert_doc doc, :paragraph, "wonki", "text"
33
+ end
34
+
35
+ def test_will_allow_whitespace_before_colon
36
+ doc = @parser.parse(":paragraph wonki :text")
15
37
 
16
38
  assert_doc doc, :paragraph, "wonki", "text"
17
39
  end
18
40
 
19
41
  def test_parser_returns_simple_block_without_id
20
- doc = @parser.parse(":paragraph\ntext")
42
+ doc = @parser.parse(":paragraph:\ntext")
21
43
 
22
44
  assert_doc doc, :paragraph, nil, "text"
23
45
  end
24
46
 
25
47
  def test_parser_returns_block_with_dashed_block_id
26
- doc = @parser.parse(":paragraph wonki-donki\ntext")
48
+ doc = @parser.parse(":paragraph wonki-donki:\ntext")
27
49
 
28
50
  assert_doc doc, :paragraph, "wonki-donki", "text"
29
51
  end
30
52
 
31
53
  def test_parser_returns_block_with_parent_id
32
- doc = @parser.parse(":paragraph wonki-donki parent_id\ntext")
54
+ doc = @parser.parse(":paragraph wonki-donki parent_id:\ntext")
33
55
 
34
56
  assert_doc doc, :paragraph, "wonki-donki", "text", "parent_id"
35
57
  end
36
58
 
37
59
  def test_parser_returns_block_with_parent_id_and_attributes
38
- doc = @parser.parse(":paragraph wonki-donki parent_id class=foo title=monkey\ntext")
60
+ doc = @parser.parse(":paragraph wonki-donki parent_id class=foo title=monkey:\ntext")
39
61
 
40
62
  assert_doc doc, :paragraph, "wonki-donki", "text", "parent_id", { :class => "foo", :title => "monkey" }
41
63
  end
42
64
 
43
65
  def test_parser_returns_two_simple_blocks
44
- doc = @parser.parse(":paragraph foo\nbar\n:paragraph baz\nbonzo")
66
+ doc = @parser.parse(":paragraph foo:bar\n:paragraph baz:bonzo")
45
67
 
46
68
  assert_not_nil doc
47
69
 
48
70
  blocks = doc.content
49
71
 
50
- assert_block blocks[0], :paragraph, "foo", "bar\n"
51
- assert_block blocks[1], :paragraph, "baz", "bonzo"
72
+ assert_block blocks[0][1], :paragraph, "foo", "bar\n"
73
+ assert_block blocks[1][1], :paragraph, "baz", "bonzo"
52
74
  end
53
75
  end
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  class FlannelTest < Test::Unit::TestCase
4
4
  should "wrap functionality up in a neat package" do
5
- markup = ":header_two foo Foo\n\n:list list Bar"
5
+ markup = ":header_two foo: Foo\n\n:list list: Bar"
6
6
  assert_equal "<h2 id='foo'>Foo</h2>\n\n<ul id='list'><li>Bar</li></ul>", Flannel.quilt(markup)
7
7
  end
8
8
 
@@ -11,7 +11,7 @@ class FlannelTest < Test::Unit::TestCase
11
11
  end
12
12
 
13
13
  should "parse paragraphs correctly" do
14
- input = ":paragraph p_one\nThis is paragraph one.\n\n:paragraph p_two\nThis is paragraph two.\n\n:paragraph p_three\nThis is paragraph three. Watchout for the end of file.\n"
14
+ input = ":paragraph p_one:\nThis is paragraph one.\n\n:paragraph p_two:\nThis is paragraph two.\n\n:paragraph p_three:\nThis is paragraph three. Watchout for the end of file.\n"
15
15
  output = "<p id='p_one'>This is paragraph one.</p>\n\n<p id='p_two'>This is paragraph two.</p>\n\n<p id='p_three'>This is paragraph three. Watchout for the end of file.</p>"
16
16
  assert_equal output, Flannel.quilt(input)
17
17
  end
@@ -19,31 +19,31 @@ class FlannelTest < Test::Unit::TestCase
19
19
  context "basic behavior" do
20
20
 
21
21
  should "parse a block without an id" do
22
- markup = ":paragraph\n this is my paragraph"
22
+ markup = ":paragraph:\n this is my paragraph"
23
23
  assert_equal "<p>this is my paragraph</p>", Flannel.quilt(markup)
24
24
  end
25
25
 
26
26
  should "strip and convert underscores to pre tags" do
27
- markup = ":preformatted foo\nfoo\n\n bar\n"
27
+ markup = ":preformatted foo:\nfoo\n\n bar\n"
28
28
  assert_equal "<pre id='foo'>foo\n\n bar\n</pre>", Flannel.quilt(markup)
29
29
  end
30
30
 
31
31
  should "escape preformatted text" do
32
- markup = ":preformatted math\n4 - 2 > 2 - 2\n"
32
+ markup = ":preformatted math:\n4 - 2 > 2 - 2\n"
33
33
  assert_equal "<pre id='math'>4 - 2 &gt; 2 - 2\n</pre>", Flannel.quilt(markup)
34
34
  end
35
35
  end
36
36
 
37
37
  context "When block starts with header, it" do
38
38
  should "convert one to a header one" do
39
- markup = ":header_one h\n Some header"
39
+ markup = ":header_one h:\n Some header"
40
40
  result = "<h1 id='h'>Some header</h1>"
41
41
 
42
42
  assert_equal result, Flannel.quilt(markup)
43
43
  end
44
44
 
45
45
  should "convert two equals to a header two" do
46
- markup = ":header_two h\n Some header"
46
+ markup = ":header_two h:\n Some header"
47
47
  result = "<h2 id='h'>Some header</h2>"
48
48
 
49
49
  assert_equal result, Flannel.quilt(markup)
@@ -53,7 +53,7 @@ class FlannelTest < Test::Unit::TestCase
53
53
  context "When block is a list, it" do
54
54
  should "be wrapped in ul tags" do
55
55
 
56
- markup = ":list list\n Yadda\nYadda\nYadda"
56
+ markup = ":list list:\n Yadda\nYadda\nYadda"
57
57
  result = "<ul id='list'><li>Yadda</li>\n<li>Yadda</li>\n<li>Yadda</li></ul>"
58
58
 
59
59
  assert_equal result, Flannel.quilt(markup)
@@ -62,7 +62,7 @@ class FlannelTest < Test::Unit::TestCase
62
62
 
63
63
  context "bug fixes" do
64
64
  should "parse a simple paragraph" do
65
- markup = ":paragraph\nbar bar\n"
65
+ markup = ":paragraph:\nbar bar\n"
66
66
  result = "<p>bar bar</p>"
67
67
 
68
68
  assert_equal result, Flannel.quilt(markup)
@@ -12,6 +12,10 @@ class Test::Unit::TestCase
12
12
  assert false, message
13
13
  end
14
14
 
15
+ def new_block list
16
+ Flannel::BaseBlock.new [ :block, list ]
17
+ end
18
+
15
19
  def clear_dir dirname
16
20
  Dir.foreach(dirname) do |f|
17
21
  path = File.join(dirname, f)
@@ -27,8 +31,12 @@ class Test::Unit::TestCase
27
31
 
28
32
  def assert_doc doc, expected_type, expected_id, expected_text, expected_parent_id=nil, expected_attributes=nil
29
33
  assert_not_nil doc
30
- block = doc.content[0]
31
-
34
+
35
+ item = doc.content[0]
36
+ assert_equal :block, item[0]
37
+
38
+ block = item[1]
39
+
32
40
  assert_block block, expected_type, expected_id, expected_text, expected_parent_id, expected_attributes
33
41
  end
34
42
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 11
9
- version: 0.2.11
8
+ - 12
9
+ version: 0.2.12
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jamal Hansen
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-02-24 00:00:00 -06:00
17
+ date: 2010-02-25 00:00:00 -06:00
18
18
  default_executable: quilt-it
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency