devcenter-parser 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/devcenter-parser.rb +2 -2
- data/test/devcenter-parser_test.rb +2 -2
- metadata +1 -1
data/lib/devcenter-parser.rb
CHANGED
@@ -6,7 +6,7 @@ require 'sanitize'
|
|
6
6
|
|
7
7
|
module DevcenterParser
|
8
8
|
|
9
|
-
VERSION = '1.2.
|
9
|
+
VERSION = '1.2.1'
|
10
10
|
|
11
11
|
AVAILABLE_FLAVOURS = [:github, :maruku]
|
12
12
|
|
@@ -116,7 +116,7 @@ module DevcenterParser
|
|
116
116
|
|
117
117
|
def self.convert_to_article_links_all_relative_links_with_missing_initial_slashes(doc)
|
118
118
|
doc.css('a').each do |node|
|
119
|
-
unless node['href'] =~ /\Ahttp|\A
|
119
|
+
unless node['href'] =~ /\Ahttp|\A\/|\Amailto\:|\A#/
|
120
120
|
node['href'] = "/articles/#{node['href']}"
|
121
121
|
end
|
122
122
|
end
|
@@ -193,8 +193,8 @@ And that's it.
|
|
193
193
|
end
|
194
194
|
end
|
195
195
|
|
196
|
-
it 'does not alter relative links with initial slashes nor absolute links' do
|
197
|
-
['http://foo.com', 'https://foo.com', '/foo', '/foo/bar', '/foo#bar', '/123', 'mailto:foo@foobar.com'].each do |href|
|
196
|
+
it 'does not alter relative links with initial slashes nor absolute links nor anchor links to the same doc' do
|
197
|
+
['http://foo.com', 'https://foo.com', '/foo', '/foo/bar', '/foo#bar', '#foo', '/123', 'mailto:foo@foobar.com'].each do |href|
|
198
198
|
md = "[link](#{href})"
|
199
199
|
html = "<p><a href=\"#{href}\">link</a></p>"
|
200
200
|
assert_maruku_result md, html
|