dtext_rb 1.0.0 → 1.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.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/dtext_rb.gemspec +2 -2
- data/ext/dtext/dtext.c +2482 -2565
- data/ext/dtext/dtext.rl +229 -213
- data/ext/dtext/extconf.rb +2 -0
- data/lib/dtext.rb +10 -0
- data/test/dtext_test.rb +17 -13
- metadata +1 -1
data/ext/dtext/extconf.rb
CHANGED
data/lib/dtext.rb
CHANGED
data/test/dtext_test.rb
CHANGED
@@ -99,7 +99,7 @@ class DTextTest < Minitest::Test
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def test_urls
|
102
|
-
assert_parse('<p>a <a href="http://test.com">http://test.com</a> b</p>',
|
102
|
+
assert_parse('<p>a <a href="http://test.com">http://test.com</a> b</p>', 'a http://test.com b')
|
103
103
|
end
|
104
104
|
|
105
105
|
def test_urls_with_newline
|
@@ -107,41 +107,41 @@ class DTextTest < Minitest::Test
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def test_urls_with_paths
|
110
|
-
assert_parse('<p>a <a href="http://test.com/~bob/image.jpg">http://test.com/~bob/image.jpg</a> b</p>',
|
110
|
+
assert_parse('<p>a <a href="http://test.com/~bob/image.jpg">http://test.com/~bob/image.jpg</a> b</p>', 'a http://test.com/~bob/image.jpg b')
|
111
111
|
end
|
112
112
|
|
113
113
|
def test_urls_with_fragment
|
114
|
-
assert_parse('<p>a <a href="http://test.com/home.html#toc">http://test.com/home.html#toc</a> b</p>',
|
114
|
+
assert_parse('<p>a <a href="http://test.com/home.html#toc">http://test.com/home.html#toc</a> b</p>', 'a http://test.com/home.html#toc b')
|
115
115
|
end
|
116
116
|
|
117
117
|
def test_auto_urls
|
118
|
-
assert_parse('<p>a <a href="http://test.com">http://test.com</a>. b</p>',
|
118
|
+
assert_parse('<p>a <a href="http://test.com">http://test.com</a>. b</p>', 'a http://test.com. b')
|
119
119
|
end
|
120
120
|
|
121
121
|
def test_auto_urls_in_parentheses
|
122
|
-
assert_parse('<p>a (<a href="http://test.com">http://test.com</a>) b</p>',
|
122
|
+
assert_parse('<p>a (<a href="http://test.com">http://test.com</a>) b</p>', 'a (http://test.com) b')
|
123
123
|
end
|
124
124
|
|
125
125
|
def test_old_style_links
|
126
|
-
assert_parse('<p><a href="http://test.com">test</a></p>',
|
126
|
+
assert_parse('<p><a href="http://test.com">test</a></p>', '"test":http://test.com')
|
127
127
|
end
|
128
128
|
|
129
129
|
def test_old_style_links_with_special_entities
|
130
|
-
assert_parse('<p>"1" <a href="http://three.com">2 & 3</a></p>',
|
130
|
+
assert_parse('<p>"1" <a href="http://three.com">2 & 3</a></p>', '"1" "2 & 3":http://three.com')
|
131
131
|
end
|
132
132
|
|
133
133
|
def test_new_style_links
|
134
|
-
assert_parse('<p><a href="http://test.com">test</a></p>',
|
134
|
+
assert_parse('<p><a href="http://test.com">test</a></p>', '"test":[http://test.com]')
|
135
135
|
end
|
136
136
|
|
137
137
|
def test_new_style_links_with_parentheses
|
138
|
-
assert_parse('<p><a href="http://test.com/(parentheses)">test</a></p>',
|
139
|
-
assert_parse('<p>(<a href="http://test.com/(parentheses)">test</a>)</p>',
|
140
|
-
assert_parse('<p>[<a href="http://test.com/(parentheses)">test</a>]</p>',
|
138
|
+
assert_parse('<p><a href="http://test.com/(parentheses)">test</a></p>', '"test":[http://test.com/(parentheses)]')
|
139
|
+
assert_parse('<p>(<a href="http://test.com/(parentheses)">test</a>)</p>', '("test":[http://test.com/(parentheses)])')
|
140
|
+
assert_parse('<p>[<a href="http://test.com/(parentheses)">test</a>]</p>', '["test":[http://test.com/(parentheses)]]')
|
141
141
|
end
|
142
142
|
|
143
143
|
def test_lists_1
|
144
|
-
assert_parse('<ul><li>a</li></ul>',
|
144
|
+
assert_parse('<ul><li>a</li></ul>', '* a')
|
145
145
|
end
|
146
146
|
|
147
147
|
def test_lists_2
|
@@ -206,6 +206,10 @@ class DTextTest < Minitest::Test
|
|
206
206
|
end
|
207
207
|
|
208
208
|
def test_inline_mode
|
209
|
-
assert_equal("hello", DTextRagel.
|
209
|
+
assert_equal("hello", DTextRagel.parse_inline("hello").strip)
|
210
|
+
end
|
211
|
+
|
212
|
+
def test_strip
|
213
|
+
assert_equal("hellozworld", DTextRagel.parse_strip("h[b]e[/b]llo[quote]z[/quote]wo[expand]rld[/expand]"))
|
210
214
|
end
|
211
215
|
end
|