org-ruby 0.5.1 → 0.5.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.
- data/History.txt +81 -77
- data/README.rdoc +66 -66
- data/Rakefile +28 -28
- data/bin/org-ruby +40 -40
- data/lib/org-ruby.rb +50 -50
- data/lib/org-ruby/headline.rb +102 -120
- data/lib/org-ruby/html_output_buffer.rb +174 -156
- data/lib/org-ruby/line.rb +206 -260
- data/lib/org-ruby/output_buffer.rb +227 -191
- data/lib/org-ruby/parser.rb +320 -272
- data/lib/org-ruby/regexp_helper.rb +156 -156
- data/lib/org-ruby/textile_output_buffer.rb +67 -68
- data/spec/data/freeform-example.org +113 -113
- data/spec/data/freeform.org +111 -111
- data/spec/data/hyp-planning.org +335 -335
- data/spec/data/remember.org +53 -53
- data/spec/headline_spec.rb +55 -55
- data/spec/html_examples/advanced-code.html +36 -36
- data/spec/html_examples/advanced-code.org +53 -53
- data/spec/html_examples/advanced-lists.html +31 -31
- data/spec/html_examples/advanced-lists.org +31 -31
- data/spec/html_examples/block_code.html +28 -28
- data/spec/html_examples/block_code.org +35 -35
- data/spec/html_examples/blockquote.html +7 -7
- data/spec/html_examples/blockquote.org +13 -13
- data/spec/html_examples/code-comment.html +18 -18
- data/spec/html_examples/code-comment.org +22 -22
- data/spec/html_examples/custom-seq-todo.html +15 -15
- data/spec/html_examples/custom-seq-todo.org +24 -24
- data/spec/html_examples/custom-todo.html +15 -15
- data/spec/html_examples/custom-todo.org +24 -24
- data/spec/html_examples/custom-typ-todo.html +15 -15
- data/spec/html_examples/custom-typ-todo.org +24 -24
- data/spec/html_examples/entities.html +4 -4
- data/spec/html_examples/entities.org +11 -11
- data/spec/html_examples/escape-pre.html +6 -6
- data/spec/html_examples/escape-pre.org +6 -6
- data/spec/html_examples/export-exclude-only.html +13 -13
- data/spec/html_examples/export-exclude-only.org +81 -81
- data/spec/html_examples/export-keywords.html +4 -4
- data/spec/html_examples/export-keywords.org +18 -18
- data/spec/html_examples/export-tags.html +8 -8
- data/spec/html_examples/export-tags.org +82 -82
- data/spec/html_examples/export-title.html +2 -2
- data/spec/html_examples/export-title.org +4 -4
- data/spec/html_examples/html-literal.html +2 -2
- data/spec/html_examples/html-literal.org +6 -6
- data/spec/html_examples/inline-formatting.html +10 -10
- data/spec/html_examples/inline-formatting.org +17 -17
- data/spec/html_examples/link-features.html +8 -8
- data/spec/html_examples/link-features.org +19 -19
- data/spec/html_examples/lists.html +19 -19
- data/spec/html_examples/lists.org +36 -36
- data/spec/html_examples/metadata-comment.html +27 -27
- data/spec/html_examples/metadata-comment.org +30 -30
- data/spec/html_examples/only-list.html +5 -5
- data/spec/html_examples/only-list.org +3 -3
- data/spec/html_examples/only-table.html +6 -6
- data/spec/html_examples/only-table.org +5 -5
- data/spec/html_examples/skip-header.html +3 -3
- data/spec/html_examples/skip-header.org +28 -28
- data/spec/html_examples/skip-table.html +4 -4
- data/spec/html_examples/skip-table.org +19 -19
- data/spec/html_examples/tables.html +20 -20
- data/spec/html_examples/tables.org +26 -26
- data/spec/html_examples/text.html +2 -2
- data/spec/html_examples/text.org +16 -16
- data/spec/line_spec.rb +151 -151
- data/spec/output_buffer_spec.rb +19 -0
- data/spec/parser_spec.rb +152 -166
- data/spec/regexp_helper_spec.rb +57 -57
- data/spec/spec_helper.rb +21 -21
- data/spec/textile_examples/block_code.org +35 -35
- data/spec/textile_examples/block_code.textile +29 -29
- data/spec/textile_examples/blockquote.org +13 -13
- data/spec/textile_examples/blockquote.textile +11 -11
- data/spec/textile_examples/keywords.org +13 -13
- data/spec/textile_examples/keywords.textile +11 -11
- data/spec/textile_examples/links.org +11 -11
- data/spec/textile_examples/links.textile +10 -10
- data/spec/textile_examples/lists.org +36 -36
- data/spec/textile_examples/lists.textile +20 -20
- data/spec/textile_examples/single-space-plain-list.org +13 -13
- data/spec/textile_examples/single-space-plain-list.textile +10 -10
- data/spec/textile_examples/tables.org +26 -26
- data/spec/textile_examples/tables.textile +23 -23
- data/spec/textile_output_buffer_spec.rb +21 -21
- data/tasks/test_case.rake +49 -49
- metadata +3 -2
@@ -0,0 +1,19 @@
|
|
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
|
data/spec/parser_spec.rb
CHANGED
@@ -1,166 +1,152 @@
|
|
1
|
-
|
2
|
-
require File.join(File.dirname(__FILE__), %w[spec_helper])
|
3
|
-
|
4
|
-
describe Orgmode::Parser do
|
5
|
-
it "should open ORG files" do
|
6
|
-
parser = Orgmode::Parser.load(RememberFile)
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should fail on non-existant files" do
|
10
|
-
lambda { parser = Orgmode::Parser.load("does-not-exist.org") }.should raise_error
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should load all of the lines" do
|
14
|
-
parser = Orgmode::Parser.load(RememberFile)
|
15
|
-
parser.lines.length.should eql(53)
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should find all headlines" do
|
19
|
-
parser = Orgmode::Parser.load(RememberFile)
|
20
|
-
parser.should have(12).headlines
|
21
|
-
end
|
22
|
-
|
23
|
-
it "can find a headline by index" do
|
24
|
-
parser = Orgmode::Parser.load(RememberFile)
|
25
|
-
parser.headlines[1].line.should eql("** YAML header in Webby\n")
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should determine headline levels" do
|
29
|
-
parser = Orgmode::Parser.load(RememberFile)
|
30
|
-
parser.headlines[0].level.should eql(1)
|
31
|
-
parser.headlines[1].level.should eql(2)
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should put body lines in headlines" do
|
35
|
-
parser = Orgmode::Parser.load(RememberFile)
|
36
|
-
parser.headlines[0].should have(
|
37
|
-
parser.headlines[1].should have(
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should understand lines before the first headline" do
|
41
|
-
parser = Orgmode::Parser.load(FreeformFile)
|
42
|
-
parser.should have(19).header_lines
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should load in-buffer settings" do
|
46
|
-
parser = Orgmode::Parser.load(FreeformFile)
|
47
|
-
parser.should have(12).in_buffer_settings
|
48
|
-
parser.in_buffer_settings["TITLE"].should eql("Freeform")
|
49
|
-
parser.in_buffer_settings["EMAIL"].should eql("bdewey@gmail.com")
|
50
|
-
parser.in_buffer_settings["LANGUAGE"].should eql("en")
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should understand OPTIONS" do
|
54
|
-
parser = Orgmode::Parser.load(FreeformFile)
|
55
|
-
parser.should have(19).options
|
56
|
-
parser.options["TeX"].should eql("t")
|
57
|
-
parser.options["todo"].should eql("t")
|
58
|
-
parser.options["\\n"].should eql("nil")
|
59
|
-
parser.export_todo?.should be_true
|
60
|
-
parser.options.delete("todo")
|
61
|
-
parser.export_todo?.should be_false
|
62
|
-
end
|
63
|
-
|
64
|
-
it "
|
65
|
-
parser = Orgmode::Parser.
|
66
|
-
parser.
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
parser.
|
71
|
-
parser.
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
textile_name = File.expand_path(textile_name)
|
154
|
-
|
155
|
-
it "should convert #{basename}.org to HTML" do
|
156
|
-
expected = IO.read(textile_name)
|
157
|
-
expected.should be_kind_of(String)
|
158
|
-
parser = Orgmode::Parser.new(IO.read(file))
|
159
|
-
actual = parser.to_html
|
160
|
-
actual.should be_kind_of(String)
|
161
|
-
actual.should == expected
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
1
|
+
|
2
|
+
require File.join(File.dirname(__FILE__), %w[spec_helper])
|
3
|
+
|
4
|
+
describe Orgmode::Parser do
|
5
|
+
it "should open ORG files" do
|
6
|
+
parser = Orgmode::Parser.load(RememberFile)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should fail on non-existant files" do
|
10
|
+
lambda { parser = Orgmode::Parser.load("does-not-exist.org") }.should raise_error
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should load all of the lines" do
|
14
|
+
parser = Orgmode::Parser.load(RememberFile)
|
15
|
+
parser.lines.length.should eql(53)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should find all headlines" do
|
19
|
+
parser = Orgmode::Parser.load(RememberFile)
|
20
|
+
parser.should have(12).headlines
|
21
|
+
end
|
22
|
+
|
23
|
+
it "can find a headline by index" do
|
24
|
+
parser = Orgmode::Parser.load(RememberFile)
|
25
|
+
parser.headlines[1].line.should eql("** YAML header in Webby\n")
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should determine headline levels" do
|
29
|
+
parser = Orgmode::Parser.load(RememberFile)
|
30
|
+
parser.headlines[0].level.should eql(1)
|
31
|
+
parser.headlines[1].level.should eql(2)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should put body lines in headlines" do
|
35
|
+
parser = Orgmode::Parser.load(RememberFile)
|
36
|
+
parser.headlines[0].should have(1).body_lines
|
37
|
+
parser.headlines[1].should have(7).body_lines
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should understand lines before the first headline" do
|
41
|
+
parser = Orgmode::Parser.load(FreeformFile)
|
42
|
+
parser.should have(19).header_lines
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should load in-buffer settings" do
|
46
|
+
parser = Orgmode::Parser.load(FreeformFile)
|
47
|
+
parser.should have(12).in_buffer_settings
|
48
|
+
parser.in_buffer_settings["TITLE"].should eql("Freeform")
|
49
|
+
parser.in_buffer_settings["EMAIL"].should eql("bdewey@gmail.com")
|
50
|
+
parser.in_buffer_settings["LANGUAGE"].should eql("en")
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should understand OPTIONS" do
|
54
|
+
parser = Orgmode::Parser.load(FreeformFile)
|
55
|
+
parser.should have(19).options
|
56
|
+
parser.options["TeX"].should eql("t")
|
57
|
+
parser.options["todo"].should eql("t")
|
58
|
+
parser.options["\\n"].should eql("nil")
|
59
|
+
parser.export_todo?.should be_true
|
60
|
+
parser.options.delete("todo")
|
61
|
+
parser.export_todo?.should be_false
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should skip in-buffer settings inside EXAMPLE blocks" do
|
65
|
+
parser = Orgmode::Parser.load(FreeformExampleFile)
|
66
|
+
parser.should have(0).in_buffer_settings
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should return a textile string" do
|
70
|
+
parser = Orgmode::Parser.load(FreeformFile)
|
71
|
+
parser.to_textile.should be_kind_of(String)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should understand export table option" do
|
75
|
+
fname = File.join(File.dirname(__FILE__), %w[html_examples skip-table.org])
|
76
|
+
data = IO.read(fname)
|
77
|
+
p = Orgmode::Parser.new(data)
|
78
|
+
p.export_tables?.should be_false
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "Custom keyword parser" do
|
82
|
+
fname = File.join(File.dirname(__FILE__), %w[html_examples custom-todo.org])
|
83
|
+
p = Orgmode::Parser.load(fname)
|
84
|
+
valid_keywords = %w[TODO INPROGRESS WAITING DONE CANCELED]
|
85
|
+
invalid_keywords = %w[TODOX todo inprogress Waiting done cANCELED NEXT |]
|
86
|
+
valid_keywords.each do |kw|
|
87
|
+
it "should match custom keyword #{kw}" do
|
88
|
+
(kw =~ p.custom_keyword_regexp).should be_true
|
89
|
+
end
|
90
|
+
end
|
91
|
+
invalid_keywords.each do |kw|
|
92
|
+
it "should not match custom keyword #{kw}" do
|
93
|
+
(kw =~ p.custom_keyword_regexp).should be_nil
|
94
|
+
end
|
95
|
+
end
|
96
|
+
it "should not match blank as a custom keyword" do
|
97
|
+
("" =~ p.custom_keyword_regexp).should be_nil
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe "Custom include/exclude parser" do
|
102
|
+
fname = File.join(File.dirname(__FILE__), %w[html_examples export-tags.org])
|
103
|
+
p = Orgmode::Parser.load(fname)
|
104
|
+
it "should load tags" do
|
105
|
+
p.should have(2).export_exclude_tags
|
106
|
+
p.should have(1).export_select_tags
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
describe "Export to Textile test cases" do
|
111
|
+
data_directory = File.join(File.dirname(__FILE__), "textile_examples")
|
112
|
+
org_files = File.expand_path(File.join(data_directory, "*.org" ))
|
113
|
+
files = Dir.glob(org_files)
|
114
|
+
files.each do |file|
|
115
|
+
basename = File.basename(file, ".org")
|
116
|
+
textile_name = File.join(data_directory, basename + ".textile")
|
117
|
+
textile_name = File.expand_path(textile_name)
|
118
|
+
|
119
|
+
it "should convert #{basename}.org to Textile" do
|
120
|
+
expected = IO.read(textile_name)
|
121
|
+
expected.should be_kind_of(String)
|
122
|
+
parser = Orgmode::Parser.new(IO.read(file))
|
123
|
+
actual = parser.to_textile
|
124
|
+
actual.should be_kind_of(String)
|
125
|
+
actual.should == expected
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe "Export to HTML test cases" do
|
131
|
+
# Dynamic generation of examples from each *.org file in html_examples.
|
132
|
+
# Each of these files is convertable to HTML.
|
133
|
+
data_directory = File.join(File.dirname(__FILE__), "html_examples")
|
134
|
+
org_files = File.expand_path(File.join(data_directory, "*.org" ))
|
135
|
+
files = Dir.glob(org_files)
|
136
|
+
files.each do |file|
|
137
|
+
basename = File.basename(file, ".org")
|
138
|
+
textile_name = File.join(data_directory, basename + ".html")
|
139
|
+
textile_name = File.expand_path(textile_name)
|
140
|
+
|
141
|
+
it "should convert #{basename}.org to HTML" do
|
142
|
+
expected = IO.read(textile_name)
|
143
|
+
expected.should be_kind_of(String)
|
144
|
+
parser = Orgmode::Parser.new(IO.read(file))
|
145
|
+
actual = parser.to_html
|
146
|
+
actual.should be_kind_of(String)
|
147
|
+
actual.should == expected
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
data/spec/regexp_helper_spec.rb
CHANGED
@@ -1,57 +1,57 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), %w[spec_helper])
|
2
|
-
|
3
|
-
describe Orgmode::RegexpHelper do
|
4
|
-
it "should recognize simple markup" do
|
5
|
-
e = Orgmode::RegexpHelper.new
|
6
|
-
total = 0
|
7
|
-
e.match_all("/italic/") do |border, string|
|
8
|
-
border.should eql("/")
|
9
|
-
string.should eql("italic")
|
10
|
-
total += 1
|
11
|
-
end
|
12
|
-
total.should eql(1)
|
13
|
-
|
14
|
-
total = 0
|
15
|
-
borders = %w[* / ~]
|
16
|
-
strings = %w[bold italic verbatim]
|
17
|
-
e.match_all("This string contains *bold*, /italic/, and ~verbatim~ text.")\
|
18
|
-
do |border, str|
|
19
|
-
border.should eql(borders[total])
|
20
|
-
str.should eql(strings[total])
|
21
|
-
total += 1
|
22
|
-
end
|
23
|
-
total.should eql(3)
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should not get confused by links" do
|
27
|
-
e = Orgmode::RegexpHelper.new
|
28
|
-
total = 0
|
29
|
-
# Make sure the slashes in these links aren't treated as italics
|
30
|
-
e.match_all("[[http://www.bing.com/twitter]]") do |border, str|
|
31
|
-
total += 1
|
32
|
-
end
|
33
|
-
total.should eql(0)
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should correctly perform substitutions" do
|
37
|
-
e = Orgmode::RegexpHelper.new
|
38
|
-
map = {
|
39
|
-
"*" => "strong",
|
40
|
-
"/" => "i",
|
41
|
-
"~" => "pre"
|
42
|
-
}
|
43
|
-
n = e.rewrite_emphasis("This string contains *bold*, /italic/, and ~verbatim~ text.") do |border, str|
|
44
|
-
"<#{map[border]}>#{str}</#{map[border]}>"
|
45
|
-
end
|
46
|
-
n.should eql("This string contains <strong>bold</strong>, <i>italic</i>, and <pre>verbatim</pre> text.")
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should allow link rewriting" do
|
50
|
-
e = Orgmode::RegexpHelper.new
|
51
|
-
str = e.rewrite_links("[[http://www.bing.com]]") do |link,text|
|
52
|
-
text ||= link
|
53
|
-
"\"#{text}\":#{link}"
|
54
|
-
end
|
55
|
-
str.should eql("\"http://www.bing.com\":http://www.bing.com")
|
56
|
-
end
|
57
|
-
end # describe Orgmode::RegexpHelper
|
1
|
+
require File.join(File.dirname(__FILE__), %w[spec_helper])
|
2
|
+
|
3
|
+
describe Orgmode::RegexpHelper do
|
4
|
+
it "should recognize simple markup" do
|
5
|
+
e = Orgmode::RegexpHelper.new
|
6
|
+
total = 0
|
7
|
+
e.match_all("/italic/") do |border, string|
|
8
|
+
border.should eql("/")
|
9
|
+
string.should eql("italic")
|
10
|
+
total += 1
|
11
|
+
end
|
12
|
+
total.should eql(1)
|
13
|
+
|
14
|
+
total = 0
|
15
|
+
borders = %w[* / ~]
|
16
|
+
strings = %w[bold italic verbatim]
|
17
|
+
e.match_all("This string contains *bold*, /italic/, and ~verbatim~ text.")\
|
18
|
+
do |border, str|
|
19
|
+
border.should eql(borders[total])
|
20
|
+
str.should eql(strings[total])
|
21
|
+
total += 1
|
22
|
+
end
|
23
|
+
total.should eql(3)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should not get confused by links" do
|
27
|
+
e = Orgmode::RegexpHelper.new
|
28
|
+
total = 0
|
29
|
+
# Make sure the slashes in these links aren't treated as italics
|
30
|
+
e.match_all("[[http://www.bing.com/twitter]]") do |border, str|
|
31
|
+
total += 1
|
32
|
+
end
|
33
|
+
total.should eql(0)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should correctly perform substitutions" do
|
37
|
+
e = Orgmode::RegexpHelper.new
|
38
|
+
map = {
|
39
|
+
"*" => "strong",
|
40
|
+
"/" => "i",
|
41
|
+
"~" => "pre"
|
42
|
+
}
|
43
|
+
n = e.rewrite_emphasis("This string contains *bold*, /italic/, and ~verbatim~ text.") do |border, str|
|
44
|
+
"<#{map[border]}>#{str}</#{map[border]}>"
|
45
|
+
end
|
46
|
+
n.should eql("This string contains <strong>bold</strong>, <i>italic</i>, and <pre>verbatim</pre> text.")
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should allow link rewriting" do
|
50
|
+
e = Orgmode::RegexpHelper.new
|
51
|
+
str = e.rewrite_links("[[http://www.bing.com]]") do |link,text|
|
52
|
+
text ||= link
|
53
|
+
"\"#{text}\":#{link}"
|
54
|
+
end
|
55
|
+
str.should eql("\"http://www.bing.com\":http://www.bing.com")
|
56
|
+
end
|
57
|
+
end # describe Orgmode::RegexpHelper
|