devcenter-parser 1.4.4 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/devcenter-parser.rb +1 -1
- data/lib/devcenter-parser/version.rb +1 -1
- data/test/devcenter-parser_test.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2feafea73af181b955b9cc60932afebf7f7dce5e
|
4
|
+
data.tar.gz: 031c16a36ca511a582936abfc1d85c71cc0d3f94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b207eabaae49710b78ae6fd99753245de12396af28f38158c8b5cda2b7cc819455edcd1f957d5de08172ad266e890549b9e020b0b4e0ab77cf2403b43432ff6
|
7
|
+
data.tar.gz: c4e88daa3d751a07fd30fb4603ab06e8f3a90902c202d6e6583a71fe9efaa4f287e2860c2ed5e747b3c3d6f7b59ec7515b40d9b3fc4c9e13394211bdf5516088
|
data/lib/devcenter-parser.rb
CHANGED
@@ -89,7 +89,7 @@ module DevcenterParser
|
|
89
89
|
def self.convert_to_article_links_all_relative_links_with_missing_initial_slashes(doc)
|
90
90
|
doc.css('a').each do |node|
|
91
91
|
unless node['href'].nil? || node['href'] =~ /\Ahttp|\A\/|\Amailto\:|\A#/
|
92
|
-
node['href'] = "/articles/#{node['href']}"
|
92
|
+
node['href'] = "/articles/#{node['href']}".gsub('/articles/articles/', '/articles/')
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
@@ -330,6 +330,18 @@ more callout</p>
|
|
330
330
|
end
|
331
331
|
end
|
332
332
|
|
333
|
+
it 'converts "articles/foo relative links with missing initial slashes to article links' do
|
334
|
+
md = '[link](articles/foo)'
|
335
|
+
html = '<p><a href="/articles/foo">link</a></p>'
|
336
|
+
assert_maruku_result md, html
|
337
|
+
assert_github_result md, html
|
338
|
+
|
339
|
+
md = '[link](articles/foo#bar)'
|
340
|
+
html = '<p><a href="/articles/foo#bar">link</a></p>'
|
341
|
+
assert_maruku_result md, html
|
342
|
+
assert_github_result md, html
|
343
|
+
end
|
344
|
+
|
333
345
|
it 'does not alter relative links with initial slashes nor absolute links nor anchor links to the same doc' do
|
334
346
|
['http://foo.com', 'https://foo.com', '/foo', '/foo/bar', '/foo#bar', '#foo', '/123', 'mailto:foo@foobar.com'].each do |href|
|
335
347
|
md = "[link](#{href})"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devcenter-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Heroku
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maruku
|