wallyqs-org-ruby 0.6.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +41 -11
- data/README.rdoc +55 -50
- data/bin/org-ruby +11 -5
- data/lib/org-ruby.rb +20 -27
- data/lib/org-ruby/headline.rb +0 -10
- data/lib/org-ruby/html_output_buffer.rb +224 -143
- data/lib/org-ruby/html_symbol_replace.rb +359 -340
- data/lib/org-ruby/line.rb +91 -30
- data/lib/org-ruby/output_buffer.rb +147 -139
- data/lib/org-ruby/parser.rb +45 -111
- data/lib/org-ruby/regexp_helper.rb +52 -57
- data/lib/org-ruby/textile_output_buffer.rb +90 -37
- data/lib/org-ruby/textile_symbol_replace.rb +360 -341
- metadata +39 -200
- data/.bnsignore +0 -18
- data/.gitignore +0 -2
- data/Gemfile +0 -7
- data/Gemfile.lock +0 -36
- data/Rakefile +0 -33
- data/TAGS +0 -167
- data/announcement.txt +0 -24
- data/org-ruby.gemspec +0 -40
- data/spec/data/freeform-example.org +0 -113
- data/spec/data/freeform.org +0 -111
- data/spec/data/hyp-planning.org +0 -335
- data/spec/data/remember.org +0 -53
- data/spec/headline_spec.rb +0 -65
- data/spec/html_examples/advanced-code.html +0 -81
- data/spec/html_examples/advanced-code.org +0 -106
- data/spec/html_examples/advanced-lists.html +0 -31
- data/spec/html_examples/advanced-lists.org +0 -31
- data/spec/html_examples/block_code.html +0 -28
- data/spec/html_examples/block_code.org +0 -35
- data/spec/html_examples/blockcomment.html +0 -3
- data/spec/html_examples/blockcomment.org +0 -15
- data/spec/html_examples/blockquote.html +0 -7
- data/spec/html_examples/blockquote.org +0 -13
- data/spec/html_examples/center.html +0 -6
- data/spec/html_examples/center.org +0 -7
- data/spec/html_examples/code-comment.html +0 -18
- data/spec/html_examples/code-comment.org +0 -22
- data/spec/html_examples/code-syntax.html +0 -98
- data/spec/html_examples/code-syntax.org +0 -99
- data/spec/html_examples/comment-trees.html +0 -4
- data/spec/html_examples/comment-trees.org +0 -13
- data/spec/html_examples/custom-seq-todo.html +0 -15
- data/spec/html_examples/custom-seq-todo.org +0 -24
- data/spec/html_examples/custom-todo.html +0 -15
- data/spec/html_examples/custom-todo.org +0 -24
- data/spec/html_examples/custom-typ-todo.html +0 -15
- data/spec/html_examples/custom-typ-todo.org +0 -24
- data/spec/html_examples/deflist.html +0 -6
- data/spec/html_examples/deflist.org +0 -6
- data/spec/html_examples/entities.html +0 -4
- data/spec/html_examples/entities.org +0 -11
- data/spec/html_examples/escape-pre.html +0 -6
- data/spec/html_examples/escape-pre.org +0 -6
- data/spec/html_examples/export-exclude-only.html +0 -13
- data/spec/html_examples/export-exclude-only.org +0 -81
- data/spec/html_examples/export-keywords.html +0 -4
- data/spec/html_examples/export-keywords.org +0 -18
- data/spec/html_examples/export-tags.html +0 -8
- data/spec/html_examples/export-tags.org +0 -82
- data/spec/html_examples/export-title.html +0 -2
- data/spec/html_examples/export-title.org +0 -4
- data/spec/html_examples/footnotes.html +0 -10
- data/spec/html_examples/footnotes.org +0 -7
- data/spec/html_examples/html-literal.html +0 -2
- data/spec/html_examples/html-literal.org +0 -6
- data/spec/html_examples/inline-formatting.html +0 -20
- data/spec/html_examples/inline-formatting.org +0 -33
- data/spec/html_examples/inline-images.html +0 -10
- data/spec/html_examples/inline-images.org +0 -15
- data/spec/html_examples/link-features.html +0 -8
- data/spec/html_examples/link-features.org +0 -19
- data/spec/html_examples/lists.html +0 -23
- data/spec/html_examples/lists.org +0 -47
- data/spec/html_examples/metadata-comment.html +0 -27
- data/spec/html_examples/metadata-comment.org +0 -30
- data/spec/html_examples/only-list.html +0 -5
- data/spec/html_examples/only-list.org +0 -3
- data/spec/html_examples/only-table.html +0 -6
- data/spec/html_examples/only-table.org +0 -5
- data/spec/html_examples/skip-header.html +0 -3
- data/spec/html_examples/skip-header.org +0 -28
- data/spec/html_examples/skip-table.html +0 -4
- data/spec/html_examples/skip-table.org +0 -19
- data/spec/html_examples/subsupscript-nil.html +0 -3
- data/spec/html_examples/subsupscript-nil.org +0 -6
- data/spec/html_examples/subsupscript.html +0 -3
- data/spec/html_examples/subsupscript.org +0 -5
- data/spec/html_examples/tables.html +0 -35
- data/spec/html_examples/tables.org +0 -50
- data/spec/html_examples/text.html +0 -2
- data/spec/html_examples/text.org +0 -16
- data/spec/line_spec.rb +0 -155
- data/spec/output_buffer_spec.rb +0 -19
- data/spec/parser_spec.rb +0 -152
- data/spec/regexp_helper_spec.rb +0 -57
- data/spec/spec_helper.rb +0 -20
- data/spec/textile_examples/block_code.org +0 -35
- data/spec/textile_examples/block_code.textile +0 -29
- data/spec/textile_examples/blockquote.org +0 -13
- data/spec/textile_examples/blockquote.textile +0 -11
- data/spec/textile_examples/center.org +0 -7
- data/spec/textile_examples/center.textile +0 -6
- data/spec/textile_examples/footnotes.org +0 -7
- data/spec/textile_examples/footnotes.textile +0 -8
- data/spec/textile_examples/keywords.org +0 -13
- data/spec/textile_examples/keywords.textile +0 -11
- data/spec/textile_examples/links.org +0 -11
- data/spec/textile_examples/links.textile +0 -10
- data/spec/textile_examples/lists.org +0 -36
- data/spec/textile_examples/lists.textile +0 -20
- data/spec/textile_examples/single-space-plain-list.org +0 -13
- data/spec/textile_examples/single-space-plain-list.textile +0 -10
- data/spec/textile_examples/tables.org +0 -50
- data/spec/textile_examples/tables.textile +0 -40
- data/spec/textile_output_buffer_spec.rb +0 -21
- data/tasks/test_case.rake +0 -49
- data/test/test_orgmode_parser.rb +0 -0
- data/util/gen-special-replace.el +0 -37
@@ -1,27 +0,0 @@
|
|
1
|
-
<h1 class="title">Metadata, etc.</h1>
|
2
|
-
<p>I normally filter out things that look like metadata. Can’t do it any more. I need to see all of the following:</p>
|
3
|
-
<pre class="example">
|
4
|
-
* DONE Handle inline formatting
|
5
|
-
CLOSED: [2009-12-26 Sat 21:41]
|
6
|
-
:PROPERTIES:
|
7
|
-
:ARCHIVE_TIME: 2009-12-26 Sat 22:16
|
8
|
-
:ARCHIVE_FILE: ~/brians-brain/content/projects/orgmode_parser.org
|
9
|
-
:ARCHIVE_OLPATH: <%= @page.title %>/Future Development
|
10
|
-
:ARCHIVE_CATEGORY: orgmode_parser
|
11
|
-
:ARCHIVE_TODO: DONE
|
12
|
-
:END:
|
13
|
-
|
14
|
-
I still need to handle:
|
15
|
-
|
16
|
-
- [ ] =Inline code=
|
17
|
-
|
18
|
-
How does the =emacs= HTML parser handle *inline* formatting? Ah,
|
19
|
-
it looks like it defines everything in =org-emphasis-alist= (line
|
20
|
-
2855 of =org.el=).
|
21
|
-
|
22
|
-
And then look at =org-emphasis-regexp-components=, line 2828 of
|
23
|
-
=org.el=. It looks like they just use a crazy regexp for inline
|
24
|
-
formatting. Which is good, because it means I can copy!
|
25
|
-
|
26
|
-
|
27
|
-
</pre>
|
@@ -1,30 +0,0 @@
|
|
1
|
-
* Metadata, etc.
|
2
|
-
|
3
|
-
I normally filter out things that look like metadata. Can't do it any
|
4
|
-
more. I need to see all of the following:
|
5
|
-
|
6
|
-
#+BEGIN_EXAMPLE
|
7
|
-
* DONE Handle inline formatting
|
8
|
-
CLOSED: [2009-12-26 Sat 21:41]
|
9
|
-
:PROPERTIES:
|
10
|
-
:ARCHIVE_TIME: 2009-12-26 Sat 22:16
|
11
|
-
:ARCHIVE_FILE: ~/brians-brain/content/projects/orgmode_parser.org
|
12
|
-
:ARCHIVE_OLPATH: <%= @page.title %>/Future Development
|
13
|
-
:ARCHIVE_CATEGORY: orgmode_parser
|
14
|
-
:ARCHIVE_TODO: DONE
|
15
|
-
:END:
|
16
|
-
|
17
|
-
I still need to handle:
|
18
|
-
|
19
|
-
- [ ] =Inline code=
|
20
|
-
|
21
|
-
How does the =emacs= HTML parser handle *inline* formatting? Ah,
|
22
|
-
it looks like it defines everything in =org-emphasis-alist= (line
|
23
|
-
2855 of =org.el=).
|
24
|
-
|
25
|
-
And then look at =org-emphasis-regexp-components=, line 2828 of
|
26
|
-
=org.el=. It looks like they just use a crazy regexp for inline
|
27
|
-
formatting. Which is good, because it means I can copy!
|
28
|
-
|
29
|
-
|
30
|
-
#+END_EXAMPLE
|
@@ -1,6 +0,0 @@
|
|
1
|
-
<table>
|
2
|
-
<tr><th>One</th><th>Two</th><th>Three</th><th>Four</th></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>
|
@@ -1,28 +0,0 @@
|
|
1
|
-
#+TITLE: skip-header.org
|
2
|
-
#+AUTHOR:
|
3
|
-
#+EMAIL: brian@BRIAN-DESK
|
4
|
-
#+DATE: 2009-12-29 Tue
|
5
|
-
#+DESCRIPTION:
|
6
|
-
#+KEYWORDS:
|
7
|
-
#+LANGUAGE: en
|
8
|
-
#+OPTIONS: H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
|
9
|
-
#+OPTIONS: TeX:t LaTeX:nil skip:t d:nil todo:t pri:nil tags:not-in-toc
|
10
|
-
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
|
11
|
-
#+EXPORT_SELECT_TAGS: export
|
12
|
-
#+EXPORT_EXCLUDE_TAGS: noexport
|
13
|
-
#+LINK_UP:
|
14
|
-
#+LINK_HOME:
|
15
|
-
This is header text.
|
16
|
-
It exists in the org-file, but shouldn't show up in the HTML output.
|
17
|
-
|
18
|
-
- Same with this list
|
19
|
-
- Nope, shouldn't be in the output.
|
20
|
-
|
21
|
-
#+BEGIN_EXAMPLE
|
22
|
-
Even this code snippet shouldn't be there.
|
23
|
-
Like a ninja. You can't see me.
|
24
|
-
#+END_EXAMPLE
|
25
|
-
|
26
|
-
* First heading
|
27
|
-
|
28
|
-
This should be the first text in the output.
|
@@ -1,19 +0,0 @@
|
|
1
|
-
#+TITLE: skip-table.org
|
2
|
-
#+OPTIONS: |:nil
|
3
|
-
|
4
|
-
Checking that tables are skipped when directed.
|
5
|
-
|
6
|
-
| One | Two | Three |
|
7
|
-
|-------+-------+-------|
|
8
|
-
| Four | Five | Six |
|
9
|
-
| Seven | Eight | Nine |
|
10
|
-
|
11
|
-
|
12
|
-
For grins, here's another table without a header. Just keep the bases
|
13
|
-
covered.
|
14
|
-
|
15
|
-
| One | Two | Three |
|
16
|
-
| Four | Five | Six |
|
17
|
-
| Seven | Eight | Nine |
|
18
|
-
|
19
|
-
Again, in the HTML output, you should see *no tables*.
|
@@ -1,35 +0,0 @@
|
|
1
|
-
<p class="title">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><th>One</th><th>Two</th><th>Three</th></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>
|
21
|
-
<h1>Table with complete box</h1>
|
22
|
-
<table>
|
23
|
-
<tr><th>One</th><th>Two</th><th>Three</th></tr>
|
24
|
-
<tr><td>Four</td><td>Five</td><td>Six</td></tr>
|
25
|
-
<tr><td>Seven</td><td>Eight</td><td>Nine</td></tr>
|
26
|
-
</table>
|
27
|
-
<p>Only the first row should be a header row.</p>
|
28
|
-
<h1>Table with extra lines</h1>
|
29
|
-
<table>
|
30
|
-
<tr><th>One</th><th>Two</th><th>Three</th></tr>
|
31
|
-
<tr><td>Four</td><td>Five</td><td>Six</td></tr>
|
32
|
-
<tr><td>Seven</td><td>Eight</td><td>Nine</td></tr>
|
33
|
-
<tr><td>Ten</td><td>Eleven</td><td>Twelve</td></tr>
|
34
|
-
</table>
|
35
|
-
<p>Only the first row should be a header row.</p>
|
@@ -1,50 +0,0 @@
|
|
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.
|
27
|
-
|
28
|
-
* Table with complete box
|
29
|
-
|
30
|
-
|-------+-------+-------|
|
31
|
-
| One | Two | Three |
|
32
|
-
|-------+-------+-------|
|
33
|
-
| Four | Five | Six |
|
34
|
-
| Seven | Eight | Nine |
|
35
|
-
|-------+-------+-------|
|
36
|
-
|
37
|
-
Only the first row should be a header row.
|
38
|
-
|
39
|
-
* Table with extra lines
|
40
|
-
|
41
|
-
|-------+--------+--------|
|
42
|
-
| One | Two | Three |
|
43
|
-
|-------+--------+--------|
|
44
|
-
| Four | Five | Six |
|
45
|
-
| Seven | Eight | Nine |
|
46
|
-
|-------+--------+--------|
|
47
|
-
| Ten | Eleven | Twelve |
|
48
|
-
|-------+--------+--------|
|
49
|
-
|
50
|
-
Only the first row should be a header row.
|
@@ -1,2 +0,0 @@
|
|
1
|
-
<p class="title">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>
|
data/spec/html_examples/text.org
DELETED
@@ -1,16 +0,0 @@
|
|
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.
|
data/spec/line_spec.rb
DELETED
@@ -1,155 +0,0 @@
|
|
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" ]
|
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
|
-
[": inline", " : inline", "\t\t:\tinline"].each do |inline_example|
|
28
|
-
it "should recognize this inline example: #{inline_example}" do
|
29
|
-
Orgmode::Line.new(inline_example).inline_example?.should be_true
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
list_formats = ["- ",
|
34
|
-
"+ ",
|
35
|
-
" - ",
|
36
|
-
" + ",
|
37
|
-
" 1. ",
|
38
|
-
" 2) "]
|
39
|
-
list_formats.each do |list|
|
40
|
-
it "should recognize this list format: '#{list}'" do
|
41
|
-
line = Orgmode::Line.new list
|
42
|
-
line.plain_list?.should be_true
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
["-foo", "+foo", "1.foo", "2.foo"].each do |invalid_list|
|
47
|
-
it "should not recognize this invalid list: '#{invalid_list}'" do
|
48
|
-
line = Orgmode::Line.new invalid_list
|
49
|
-
line.plain_list?.should_not be_true
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should recognize table rows" do
|
54
|
-
Orgmode::Line.new("| One | Two | Three |").table_row?.should be_true
|
55
|
-
Orgmode::Line.new(" |-------+-------+-------|\n").table_separator?.should be_true
|
56
|
-
Orgmode::Line.new("| Four | Five | Six |").table_row?.should be_true
|
57
|
-
Orgmode::Line.new("| Seven | Eight | Nine |").table_row?.should be_true
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should recognize indentation" do
|
61
|
-
Orgmode::Line.new("").indent.should eql(0)
|
62
|
-
Orgmode::Line.new(" a").indent.should eql(1)
|
63
|
-
Orgmode::Line.new(" ").indent.should eql(0)
|
64
|
-
Orgmode::Line.new(" \n").indent.should eql(0)
|
65
|
-
Orgmode::Line.new(" a").indent.should eql(3)
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should return paragraph type" do
|
69
|
-
Orgmode::Line.new("").paragraph_type.should eql(:blank)
|
70
|
-
Orgmode::Line.new("1. foo").paragraph_type.should eql(:ordered_list)
|
71
|
-
Orgmode::Line.new("- [ ] checkbox").paragraph_type.should eql(:unordered_list)
|
72
|
-
Orgmode::Line.new("hello!").paragraph_type.should eql(:paragraph)
|
73
|
-
end
|
74
|
-
|
75
|
-
it "should recognize BEGIN and END comments" do
|
76
|
-
begin_examples = {
|
77
|
-
"#+BEGIN_SRC emacs-lisp -n -r\n" => "SRC",
|
78
|
-
"#+BEGIN_EXAMPLE" => "EXAMPLE",
|
79
|
-
"\t#+BEGIN_QUOTE " => "QUOTE"
|
80
|
-
}
|
81
|
-
|
82
|
-
end_examples = {
|
83
|
-
"#+END_SRC" => "SRC",
|
84
|
-
"#+END_EXAMPLE" => "EXAMPLE",
|
85
|
-
"\t#+END_QUOTE " => "QUOTE"
|
86
|
-
}
|
87
|
-
|
88
|
-
begin_examples.each_key do |str|
|
89
|
-
line = Orgmode::Line.new str
|
90
|
-
line.begin_block?.should be_true
|
91
|
-
line.block_type.should eql(begin_examples[str])
|
92
|
-
end
|
93
|
-
|
94
|
-
end_examples.each_key do |str|
|
95
|
-
line = Orgmode::Line.new str
|
96
|
-
line.end_block?.should be_true
|
97
|
-
line.block_type.should eql(end_examples[str])
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
it "should accept assigned types" do
|
102
|
-
cases = {
|
103
|
-
"# this looks like a comment" => :comment,
|
104
|
-
" 1. This looks like an ordered list" => :ordered_list,
|
105
|
-
" - this looks like an # unordered list" => :unordered_list,
|
106
|
-
" | one | two | table! | \n" => :table_row,
|
107
|
-
"\n" => :blank,
|
108
|
-
" |-----+-----+--------| \n" => :table_separator
|
109
|
-
}
|
110
|
-
|
111
|
-
cases.each_pair do |key, value|
|
112
|
-
l = Orgmode::Line.new key
|
113
|
-
l.paragraph_type.should eql(value)
|
114
|
-
l.assigned_paragraph_type = :paragraph
|
115
|
-
l.paragraph_type.should eql(:paragraph)
|
116
|
-
l.assigned_paragraph_type = nil
|
117
|
-
l.paragraph_type.should eql(value)
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
it "should parse in-buffer settings" do
|
122
|
-
cases = {
|
123
|
-
"#+ARCHIVE: %s_done" => { :key => "ARCHIVE", :value => "%s_done" },
|
124
|
-
"#+CATEGORY: foo" => { :key => "CATEGORY", :value => "foo"},
|
125
|
-
"#+BEGIN_EXAMPLE:" => { :key => "BEGIN_EXAMPLE", :value => "" },
|
126
|
-
"#+A:" => { :key => "A", :value => "" } # Boundary: Smallest keyword is one letter
|
127
|
-
}
|
128
|
-
cases.each_pair do |key, value|
|
129
|
-
l = Orgmode::Line.new key
|
130
|
-
l.in_buffer_setting?.should be_true
|
131
|
-
called = nil
|
132
|
-
l.in_buffer_setting? do |k, v|
|
133
|
-
k.should eql(value[:key])
|
134
|
-
v.should eql(value[:value])
|
135
|
-
called = true
|
136
|
-
end
|
137
|
-
called.should be_true
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
it "should reject ill-formed settings" do
|
142
|
-
cases = [
|
143
|
-
"##+ARCHIVE: blah",
|
144
|
-
"#CATEGORY: foo",
|
145
|
-
"",
|
146
|
-
"\n",
|
147
|
-
" #+BEGIN_EXAMPLE:\n"
|
148
|
-
]
|
149
|
-
|
150
|
-
cases.each do |c|
|
151
|
-
l = Orgmode::Line.new c
|
152
|
-
l.in_buffer_setting?.should be_nil
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
data/spec/output_buffer_spec.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), %w[spec_helper])
|
2
|
-
|
3
|
-
describe Orgmode::OutputBuffer do
|
4
|
-
|
5
|
-
it "computes outline level numbering" do
|
6
|
-
output_buffer = Orgmode::OutputBuffer.new ""
|
7
|
-
output_buffer.get_next_headline_number(1).should eql("1")
|
8
|
-
output_buffer.get_next_headline_number(1).should eql("2")
|
9
|
-
output_buffer.get_next_headline_number(1).should eql("3")
|
10
|
-
output_buffer.get_next_headline_number(1).should eql("4")
|
11
|
-
output_buffer.get_next_headline_number(2).should eql("4.1")
|
12
|
-
output_buffer.get_next_headline_number(2).should eql("4.2")
|
13
|
-
output_buffer.get_next_headline_number(1).should eql("5")
|
14
|
-
output_buffer.get_next_headline_number(2).should eql("5.1")
|
15
|
-
output_buffer.get_next_headline_number(2).should eql("5.2")
|
16
|
-
output_buffer.get_next_headline_number(4).should eql("5.2.0.1")
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|