org-ruby 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/History.txt +32 -24
  2. data/README.txt +66 -66
  3. data/Rakefile +26 -22
  4. data/bin/org-ruby +40 -40
  5. data/lib/org-ruby.rb +50 -48
  6. data/lib/org-ruby/headline.rb +75 -75
  7. data/lib/org-ruby/html_output_buffer.rb +81 -80
  8. data/lib/org-ruby/line.rb +173 -172
  9. data/lib/org-ruby/output_buffer.rb +154 -154
  10. data/lib/org-ruby/parser.rb +76 -72
  11. data/lib/org-ruby/regexp_helper.rb +156 -156
  12. data/lib/org-ruby/textile_output_buffer.rb +67 -67
  13. data/spec/data/freeform.org +111 -111
  14. data/spec/data/hyp-planning.org +335 -335
  15. data/spec/data/remember.org +53 -53
  16. data/spec/headline_spec.rb +55 -55
  17. data/spec/html_examples/block_code.html +30 -29
  18. data/spec/html_examples/block_code.org +35 -35
  19. data/spec/html_examples/blockquote.html +7 -7
  20. data/spec/html_examples/blockquote.org +13 -13
  21. data/spec/html_examples/escape-pre.html +7 -0
  22. data/spec/html_examples/escape-pre.org +6 -0
  23. data/spec/html_examples/inline-formatting.html +10 -10
  24. data/spec/html_examples/inline-formatting.org +17 -17
  25. data/spec/html_examples/lists.html +19 -19
  26. data/spec/html_examples/lists.org +36 -36
  27. data/spec/html_examples/only-list.html +5 -0
  28. data/spec/html_examples/only-list.org +3 -0
  29. data/spec/html_examples/only-table.html +6 -0
  30. data/spec/html_examples/only-table.org +5 -0
  31. data/spec/html_examples/tables.html +20 -20
  32. data/spec/html_examples/tables.org +26 -26
  33. data/spec/html_examples/text.html +2 -2
  34. data/spec/html_examples/text.org +16 -16
  35. data/spec/line_spec.rb +89 -89
  36. data/spec/parser_spec.rb +86 -86
  37. data/spec/regexp_helper_spec.rb +57 -57
  38. data/spec/spec_helper.rb +20 -20
  39. data/spec/textile_examples/block_code.org +35 -35
  40. data/spec/textile_examples/block_code.textile +29 -29
  41. data/spec/textile_examples/blockquote.org +13 -13
  42. data/spec/textile_examples/blockquote.textile +11 -11
  43. data/spec/textile_examples/keywords.org +13 -13
  44. data/spec/textile_examples/keywords.textile +11 -11
  45. data/spec/textile_examples/links.org +11 -11
  46. data/spec/textile_examples/links.textile +10 -10
  47. data/spec/textile_examples/lists.org +36 -36
  48. data/spec/textile_examples/lists.textile +20 -20
  49. data/spec/textile_examples/single-space-plain-list.org +13 -13
  50. data/spec/textile_examples/single-space-plain-list.textile +10 -10
  51. data/spec/textile_examples/tables.org +26 -26
  52. data/spec/textile_examples/tables.textile +23 -23
  53. data/spec/textile_output_buffer_spec.rb +21 -21
  54. data/tasks/test_case.rake +49 -0
  55. metadata +21 -5
  56. data/.bnsignore +0 -18
@@ -1,19 +1,19 @@
1
- <h1>Lists</h1>
2
- <p>I want to make sure I have great support for lists.</p>
3
- <ul>
4
- <li>This is an unordered list</li>
5
- <li>This continues the unordered list</li>
6
- </ul>
7
- <p>And this is a paragraph <b>after</b> the list.</p>
8
- <h2>Wrapping within the list</h2>
9
- <ul>
10
- <li>This is a single-line list item in the org file.</li>
11
- <li>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</li>
12
- <li>And this is the next item. The previous item needs to be on one line to keep <code>textile</code> happy.</li>
13
- <li>Ditto the previous line, actually.</li>
14
- </ul>
15
- <h2>Edge cases</h2>
16
- <ul>
17
- <li>This is a single-line list.</li>
18
- </ul>
19
- <p>And this is a <b>separate paragraph.</b> Note the indentation in the org file.</p>
1
+ <h1>Lists</h1>
2
+ <p>I want to make sure I have great support for lists.</p>
3
+ <ul>
4
+ <li>This is an unordered list</li>
5
+ <li>This continues the unordered list</li>
6
+ </ul>
7
+ <p>And this is a paragraph <b>after</b> the list.</p>
8
+ <h2>Wrapping within the list</h2>
9
+ <ul>
10
+ <li>This is a single-line list item in the org file.</li>
11
+ <li>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</li>
12
+ <li>And this is the next item. The previous item needs to be on one line to keep <code>textile</code> happy.</li>
13
+ <li>Ditto the previous line, actually.</li>
14
+ </ul>
15
+ <h2>Edge cases</h2>
16
+ <ul>
17
+ <li>This is a single-line list.</li>
18
+ </ul>
19
+ <p>And this is a <b>separate paragraph.</b> Note the indentation in the org file.</p>
@@ -1,36 +1,36 @@
1
- * Lists
2
-
3
- I want to make sure I have great support for lists.
4
-
5
- - This is an unordered list
6
- - This continues the unordered list
7
-
8
- And this is a paragraph *after* the list.
9
-
10
- ** Wrapping within the list
11
-
12
- - This is a single-line list item in the org file.
13
- - Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
14
- nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
15
- erat, sed diam voluptua. At vero eos et accusam et justo duo
16
- dolores et ea rebum. Stet clita kasd gubergren, no sea takimata
17
- sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit
18
- amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
19
- invidunt ut labore et dolore magna aliquyam erat, sed diam
20
- voluptua. At vero eos et accusam et justo duo dolores et ea
21
- rebum. Stet clita kasd gubergren, no sea takimata sanctus est
22
- Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,
23
- consetetur sadipscing elitr, sed diam nonumy eirmod tempor
24
- invidunt ut labore et dolore magna aliquyam erat, sed diam
25
- voluptua. At vero eos et accusam et justo duo dolores et ea
26
- rebum. Stet clita kasd gubergren, no sea takimata sanctus est
27
- Lorem ipsum dolor sit amet.
28
- - And this is the next item. The previous item needs to be on one
29
- line to keep =textile= happy.
30
- - Ditto the previous line, actually.
31
-
32
- ** Edge cases
33
-
34
- - This is a single-line list.
35
- And this is a *separate paragraph.* Note the indentation in the org
36
- file.
1
+ * Lists
2
+
3
+ I want to make sure I have great support for lists.
4
+
5
+ - This is an unordered list
6
+ - This continues the unordered list
7
+
8
+ And this is a paragraph *after* the list.
9
+
10
+ ** Wrapping within the list
11
+
12
+ - This is a single-line list item in the org file.
13
+ - Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
14
+ nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
15
+ erat, sed diam voluptua. At vero eos et accusam et justo duo
16
+ dolores et ea rebum. Stet clita kasd gubergren, no sea takimata
17
+ sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit
18
+ amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
19
+ invidunt ut labore et dolore magna aliquyam erat, sed diam
20
+ voluptua. At vero eos et accusam et justo duo dolores et ea
21
+ rebum. Stet clita kasd gubergren, no sea takimata sanctus est
22
+ Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,
23
+ consetetur sadipscing elitr, sed diam nonumy eirmod tempor
24
+ invidunt ut labore et dolore magna aliquyam erat, sed diam
25
+ voluptua. At vero eos et accusam et justo duo dolores et ea
26
+ rebum. Stet clita kasd gubergren, no sea takimata sanctus est
27
+ Lorem ipsum dolor sit amet.
28
+ - And this is the next item. The previous item needs to be on one
29
+ line to keep =textile= happy.
30
+ - Ditto the previous line, actually.
31
+
32
+ ** Edge cases
33
+
34
+ - This is a single-line list.
35
+ And this is a *separate paragraph.* Note the indentation in the org
36
+ file.
@@ -0,0 +1,5 @@
1
+ <ul>
2
+ <li>This file has only a list</li>
3
+ <li>Note it will end with nothing other than a list item.</li>
4
+ <li>the world wants to know: Will org-ruby write the closing ul tag?</li>
5
+ </ul>
@@ -0,0 +1,3 @@
1
+ - This file has only a list
2
+ - Note it will end with nothing other than a list item.
3
+ - the world wants to know: Will org-ruby write the closing ul tag?
@@ -0,0 +1,6 @@
1
+ <table>
2
+ <tr><td>One</td><td>Two</td><td>Three</td><td>Four</td></tr>
3
+ <tr><td>Five</td><td>Six</td><td>Seven</td><td>Eight</td></tr>
4
+ <tr><td>Nine</td><td>Ten</td><td>Eleven</td><td>Twelve</td></tr>
5
+ <tr><td><b>format</b></td><td><i>text</i></td><td><code>in</code></td><td><span style="text-decoration:underline;">cells</span></td></tr>
6
+ </table>
@@ -0,0 +1,5 @@
1
+ | One | Two | Three | Four |
2
+ |----------+--------+--------+---------|
3
+ | Five | Six | Seven | Eight |
4
+ | Nine | Ten | Eleven | Twelve |
5
+ | *format* | /text/ | ~in~ | _cells_ |
@@ -1,20 +1,20 @@
1
- <p>TABLES</p>
2
- <p>Different types of ORG tables.</p>
3
- <h1>Simple table, no header.</h1>
4
- <table>
5
- <tr><td>Cell one</td><td>Cell two</td></tr>
6
- <tr><td>Cell three</td><td>Cell four</td></tr>
7
- </table>
8
- <h1>Indented table</h1>
9
- <table>
10
- <tr><td>Cell one</td></tr>
11
- <tr><td>Cell two</td></tr>
12
- </table>
13
- <p>And here's some paragraph content. The line breaks will need to get removed here, but not for the tables.</p>
14
- <h1>Table with header</h1>
15
- <table>
16
- <tr><td>One</td><td>Two</td><td>Three</td></tr>
17
- <tr><td>Four</td><td>Five</td><td>Six</td></tr>
18
- <tr><td>Seven</td><td>Eight</td><td>Nine</td></tr>
19
- </table>
20
- <p>The separator row should not get printed out.</p>
1
+ <p>TABLES</p>
2
+ <p>Different types of ORG tables.</p>
3
+ <h1>Simple table, no header.</h1>
4
+ <table>
5
+ <tr><td>Cell one</td><td>Cell two</td></tr>
6
+ <tr><td>Cell three</td><td>Cell four</td></tr>
7
+ </table>
8
+ <h1>Indented table</h1>
9
+ <table>
10
+ <tr><td>Cell one</td></tr>
11
+ <tr><td>Cell two</td></tr>
12
+ </table>
13
+ <p>And here&#8217;s some paragraph content. The line breaks will need to get removed here, but not for the tables.</p>
14
+ <h1>Table with header</h1>
15
+ <table>
16
+ <tr><td>One</td><td>Two</td><td>Three</td></tr>
17
+ <tr><td>Four</td><td>Five</td><td>Six</td></tr>
18
+ <tr><td>Seven</td><td>Eight</td><td>Nine</td></tr>
19
+ </table>
20
+ <p>The separator row should not get printed out.</p>
@@ -1,26 +1,26 @@
1
- TABLES
2
-
3
- Different types of ORG tables.
4
-
5
- * Simple table, no header.
6
-
7
- | Cell one | Cell two |
8
- | Cell three | Cell four |
9
-
10
-
11
- * Indented table
12
-
13
- | Cell one |
14
- | Cell two |
15
-
16
- And here's some paragraph content. The line breaks will need to get
17
- removed here, but not for the tables.
18
-
19
- * Table with header
20
-
21
- | One | Two | Three |
22
- |-------+-------+-------|
23
- | Four | Five | Six |
24
- | Seven | Eight | Nine |
25
-
26
- The separator row should not get printed out.
1
+ TABLES
2
+
3
+ Different types of ORG tables.
4
+
5
+ * Simple table, no header.
6
+
7
+ | Cell one | Cell two |
8
+ | Cell three | Cell four |
9
+
10
+
11
+ * Indented table
12
+
13
+ | Cell one |
14
+ | Cell two |
15
+
16
+ And here's some paragraph content. The line breaks will need to get
17
+ removed here, but not for the tables.
18
+
19
+ * Table with header
20
+
21
+ | One | Two | Three |
22
+ |-------+-------+-------|
23
+ | Four | Five | Six |
24
+ | Seven | Eight | Nine |
25
+
26
+ The separator row should not get printed out.
@@ -1,2 +1,2 @@
1
- <p>The simplest case: translating plain text.</p>
2
- <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
1
+ <p>The simplest case: translating plain text.</p>
2
+ <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
@@ -1,16 +1,16 @@
1
- The simplest case: translating plain text.
2
-
3
- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
4
- nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
5
- sed diam voluptua. At vero eos et accusam et justo duo dolores et ea
6
- rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem
7
- ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur
8
- sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
9
- dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam
10
- et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
11
- takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit
12
- amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
13
- invidunt ut labore et dolore magna aliquyam erat, sed diam
14
- voluptua. At vero eos et accusam et justo duo dolores et ea
15
- rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem
16
- ipsum dolor sit amet.
1
+ The simplest case: translating plain text.
2
+
3
+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
4
+ nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
5
+ sed diam voluptua. At vero eos et accusam et justo duo dolores et ea
6
+ rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem
7
+ ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur
8
+ sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
9
+ dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam
10
+ et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
11
+ takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit
12
+ amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
13
+ invidunt ut labore et dolore magna aliquyam erat, sed diam
14
+ voluptua. At vero eos et accusam et justo duo dolores et ea
15
+ rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem
16
+ ipsum dolor sit amet.
@@ -1,89 +1,89 @@
1
- require File.join(File.dirname(__FILE__), %w[spec_helper])
2
-
3
- describe Orgmode::Line do
4
-
5
- it "should tell comments" do
6
- comments = ["# hello", "#hello", " #hello", "\t#hello\n"]
7
- comments.each do |c|
8
- line = Orgmode::Line.new c
9
- line.comment?.should be_true
10
- end
11
-
12
- not_comments = ["", "\n", "hello\n", " foo ### bar\n"]
13
- not_comments.each do |c|
14
- line = Orgmode::Line.new c
15
- line.comment?.should_not be_true
16
- end
17
- end
18
-
19
- it "should tell blank lines" do
20
- blank = ["", " ", "\t", "\n", " \t\t\n\n"]
21
- blank.each do |b|
22
- line = Orgmode::Line.new b
23
- line.blank?.should be_true
24
- end
25
- end
26
-
27
- it "should recognize plain lists" do
28
- list_formats = ["-",
29
- "+",
30
- " -",
31
- " +",
32
- " 1.",
33
- " 2)"]
34
- list_formats.each do |list|
35
- line = Orgmode::Line.new list
36
- line.plain_list?.should be_true
37
- end
38
- end
39
-
40
- it "should recognize table rows" do
41
- Orgmode::Line.new("| One | Two | Three |").table_row?.should be_true
42
- Orgmode::Line.new(" |-------+-------+-------|\n").table_separator?.should be_true
43
- Orgmode::Line.new("| Four | Five | Six |").table_row?.should be_true
44
- Orgmode::Line.new("| Seven | Eight | Nine |").table_row?.should be_true
45
- end
46
-
47
- it "should recognize indentation" do
48
- Orgmode::Line.new("").indent.should eql(0)
49
- Orgmode::Line.new(" a").indent.should eql(1)
50
- Orgmode::Line.new(" ").indent.should eql(0)
51
- Orgmode::Line.new(" \n").indent.should eql(0)
52
- Orgmode::Line.new(" a").indent.should eql(3)
53
- end
54
-
55
- it "should return paragraph type" do
56
- Orgmode::Line.new("").paragraph_type.should eql(:blank)
57
- Orgmode::Line.new("1. foo").paragraph_type.should eql(:ordered_list)
58
- Orgmode::Line.new("- [ ] checkbox").paragraph_type.should eql(:unordered_list)
59
- Orgmode::Line.new("hello!").paragraph_type.should eql(:paragraph)
60
- end
61
-
62
- it "should recognize BEGIN and END comments" do
63
- begin_examples = {
64
- "#+BEGIN_SRC emacs-lisp -n -r\n" => "SRC",
65
- "#+BEGIN_EXAMPLE" => "EXAMPLE",
66
- "\t#+BEGIN_QUOTE " => "QUOTE"
67
- }
68
-
69
- end_examples = {
70
- "#+END_SRC" => "SRC",
71
- "#+END_EXAMPLE" => "EXAMPLE",
72
- "\t#+END_QUOTE " => "QUOTE"
73
- }
74
-
75
- begin_examples.each_key do |str|
76
- line = Orgmode::Line.new str
77
- line.comment?.should be_true
78
- line.begin_block?.should be_true
79
- line.block_type.should eql(begin_examples[str])
80
- end
81
-
82
- end_examples.each_key do |str|
83
- line = Orgmode::Line.new str
84
- line.comment?.should be_true
85
- line.end_block?.should be_true
86
- line.block_type.should eql(end_examples[str])
87
- end
88
- end
89
- end
1
+ require File.join(File.dirname(__FILE__), %w[spec_helper])
2
+
3
+ describe Orgmode::Line do
4
+
5
+ it "should tell comments" do
6
+ comments = ["# hello", "#hello", " #hello", "\t#hello\n"]
7
+ comments.each do |c|
8
+ line = Orgmode::Line.new c
9
+ line.comment?.should be_true
10
+ end
11
+
12
+ not_comments = ["", "\n", "hello\n", " foo ### bar\n"]
13
+ not_comments.each do |c|
14
+ line = Orgmode::Line.new c
15
+ line.comment?.should_not be_true
16
+ end
17
+ end
18
+
19
+ it "should tell blank lines" do
20
+ blank = ["", " ", "\t", "\n", " \t\t\n\n"]
21
+ blank.each do |b|
22
+ line = Orgmode::Line.new b
23
+ line.blank?.should be_true
24
+ end
25
+ end
26
+
27
+ it "should recognize plain lists" do
28
+ list_formats = ["-",
29
+ "+",
30
+ " -",
31
+ " +",
32
+ " 1.",
33
+ " 2)"]
34
+ list_formats.each do |list|
35
+ line = Orgmode::Line.new list
36
+ line.plain_list?.should be_true
37
+ end
38
+ end
39
+
40
+ it "should recognize table rows" do
41
+ Orgmode::Line.new("| One | Two | Three |").table_row?.should be_true
42
+ Orgmode::Line.new(" |-------+-------+-------|\n").table_separator?.should be_true
43
+ Orgmode::Line.new("| Four | Five | Six |").table_row?.should be_true
44
+ Orgmode::Line.new("| Seven | Eight | Nine |").table_row?.should be_true
45
+ end
46
+
47
+ it "should recognize indentation" do
48
+ Orgmode::Line.new("").indent.should eql(0)
49
+ Orgmode::Line.new(" a").indent.should eql(1)
50
+ Orgmode::Line.new(" ").indent.should eql(0)
51
+ Orgmode::Line.new(" \n").indent.should eql(0)
52
+ Orgmode::Line.new(" a").indent.should eql(3)
53
+ end
54
+
55
+ it "should return paragraph type" do
56
+ Orgmode::Line.new("").paragraph_type.should eql(:blank)
57
+ Orgmode::Line.new("1. foo").paragraph_type.should eql(:ordered_list)
58
+ Orgmode::Line.new("- [ ] checkbox").paragraph_type.should eql(:unordered_list)
59
+ Orgmode::Line.new("hello!").paragraph_type.should eql(:paragraph)
60
+ end
61
+
62
+ it "should recognize BEGIN and END comments" do
63
+ begin_examples = {
64
+ "#+BEGIN_SRC emacs-lisp -n -r\n" => "SRC",
65
+ "#+BEGIN_EXAMPLE" => "EXAMPLE",
66
+ "\t#+BEGIN_QUOTE " => "QUOTE"
67
+ }
68
+
69
+ end_examples = {
70
+ "#+END_SRC" => "SRC",
71
+ "#+END_EXAMPLE" => "EXAMPLE",
72
+ "\t#+END_QUOTE " => "QUOTE"
73
+ }
74
+
75
+ begin_examples.each_key do |str|
76
+ line = Orgmode::Line.new str
77
+ line.comment?.should be_true
78
+ line.begin_block?.should be_true
79
+ line.block_type.should eql(begin_examples[str])
80
+ end
81
+
82
+ end_examples.each_key do |str|
83
+ line = Orgmode::Line.new str
84
+ line.comment?.should be_true
85
+ line.end_block?.should be_true
86
+ line.block_type.should eql(end_examples[str])
87
+ end
88
+ end
89
+ end