jekyll-absolute-links 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 120384c27696936033c7afefdaf63507ccb7e733
4
- data.tar.gz: 3b6cf1884dbf4e031b0f93a63dbce44262adf708
2
+ SHA256:
3
+ metadata.gz: 6b6d5e7ca995bfc6491f99fd2db53f80b25b4f3e788589b55cc7fa7cbdd2fb8c
4
+ data.tar.gz: bdebcac2f7a47c866f1d605e0d6ed6da401bac13f542aa957c94d3deb0d7bf9d
5
5
  SHA512:
6
- metadata.gz: 29b5f06b449710bede22515f3ac58e4f54832de9e542c264521cca9735d8f61c8700a780f35d801ce7d2aed094cbba4d5bf51ca61a609367d224fd5ceb05f93f
7
- data.tar.gz: 3d6dc065ebe22f3f5b373d16bd29c7dc10917bbac446e34c1363d93b16e803fb48ea986ce280b67949fb6e54bb85ab420c6f9445d7ee465177c79d4b2385058a
6
+ metadata.gz: 4121dcd639268f588539d66f94364ad82fb57764aeee12b9090ba46c7931c215627e7077f6591a8f7b43c85974d9d6b890c7ace619c5caf7560a9f7297a24e67
7
+ data.tar.gz: b81b61c1569527140000481ef88b6d5cc0fd5b3cae4bb3dd58b7207bc2d993d900952c2a0bcad47cfdebecbe4271ad8d9e8e669c6cb044dccfebae4f2ea01610
@@ -1,6 +1,6 @@
1
1
  module JekyllAbsoluteLinks
2
2
  class Crawler
3
- @regexp = %r{<code[\S\s]*?/code>|(?<="|'|&quot;|>|\()(?<url>/[^<>()" ]*)(?="|'|&quot;|</|\))}
3
+ @regexp = %r{<code[\S\s]*?/code>|(?<="|'|>|=|&quot;|&apos;|&gt;|&equals;)(?<url>/[\w/.-]*)(?!>|&gt;)}
4
4
 
5
5
  Jekyll::Hooks.register :posts, :post_render do |post|
6
6
  next if Jekyll::env == "development"
@@ -1,3 +1,3 @@
1
1
  module JekyllAbsoluteLinks
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -21,6 +21,11 @@ describe JekyllAbsoluteLinks::Crawler do
21
21
  expect(site.posts[0].output).to include(a)
22
22
  end
23
23
 
24
+ it "performs no embedded link transformation on posts" do
25
+ a = "<a href=\"https://www.facebook.com/sharer.php?u=/posts/lorem-ipsum-dolor-sit-amet/\">"
26
+ expect(site.posts[0].output).to include(a)
27
+ end
28
+
24
29
  it "performs no link transformation on pages" do
25
30
  a = "<a href=\"/posts/lorem-ipsum-dolor-sit-amet/\">"
26
31
  expect(site.pages[1].output).to include(a)
@@ -39,7 +44,7 @@ describe JekyllAbsoluteLinks::Crawler do
39
44
  expect(site.pages[0].output).to include(link)
40
45
  end
41
46
 
42
- it "performs no encoded link transformation on feeds" do
47
+ it "performs no link transformation on feeds" do
43
48
  a = <<-eos
44
49
  <description>&lt;p&gt;Curabitur sed condimentum enim. Integer ut velit vitae ante facilisis
45
50
  consequat. Nullam egestas ipsum sit amet nibh ornare, non consequat massa
@@ -61,33 +66,27 @@ eos
61
66
  end
62
67
 
63
68
  describe "Crawler" do
64
- it "transforms relative urls to absolute urls on posts" do
69
+ it "transforms relative links to absolute links on posts" do
65
70
  a = "<a href=\"http://example.com/posts/curabitur-sed-condimentum-enim/\">"
66
71
  expect(site.posts[0].output).to include(a)
67
72
  end
68
73
 
69
- it "performs no link transformation inside code snippets" do
70
- code = "<code class=\"highlighter-rouge\">/</code>"
71
- expect(site.posts[0].output).to include(code)
72
-
73
- code = "<code><span class=\"nt\">&lt;a</span> <span class=\"na\">href=</span><span class=\"s\">\"/\"</span><span class=\"nt\">&gt;</span>Hello<span class=\"nt\">&lt;/a&gt;</span>\n</code>"
74
- expect(site.posts[0].output).to include(code)
75
-
76
- code = "<code>&lt;a href=\"/\"&gt;Hello&lt;/a&gt;\n</code>"
77
- expect(site.posts[0].output).to include(code)
74
+ it "transforms embedded relative links to absolute links on posts" do
75
+ a = "<a href=\"https://www.facebook.com/sharer.php?u=http://example.com/posts/lorem-ipsum-dolor-sit-amet/\">"
76
+ expect(site.posts[0].output).to include(a)
78
77
  end
79
78
 
80
- it "transforms relative urls to absolute urls on pages" do
79
+ it "transforms relative links to absolute links on pages" do
81
80
  a = "<a href=\"http://example.com/posts/lorem-ipsum-dolor-sit-amet/\">"
82
81
  expect(site.pages[1].output).to include(a)
83
82
  end
84
83
 
85
- it "transforms relative urls to absolute urls on sitemaps" do
84
+ it "transforms relative links to absolute links on sitemaps" do
86
85
  loc = "<loc>http://example.com/posts/lorem-ipsum-dolor-sit-amet/</loc>"
87
86
  expect(site.pages[2].output).to include(loc)
88
87
  end
89
88
 
90
- it "transforms relative urls to absolute urls on feeds" do
89
+ it "transforms relative links to absolute links on feeds" do
91
90
  atom_link = "<atom:link href=\"http://example.com/feed.xml\" rel=\"self\" type=\"application/rss+xml\"/>"
92
91
  expect(site.pages[0].output).to include(atom_link)
93
92
 
@@ -95,7 +94,7 @@ eos
95
94
  expect(site.pages[0].output).to include(link)
96
95
  end
97
96
 
98
- it "transforms relative encoded urls to absolute urls on feeds" do
97
+ it "transforms relative links to absolute links on feeds" do
99
98
  a = <<-eos
100
99
  <description>&lt;p&gt;Curabitur sed condimentum enim. Integer ut velit vitae ante facilisis
101
100
  consequat. Nullam egestas ipsum sit amet nibh ornare, non consequat massa
@@ -107,6 +106,26 @@ cursus tincidunt sapien. &lt;a href=&quot;http://example.com/posts/lorem-ipsum-d
107
106
  eos
108
107
  expect(site.pages[0].output).to include(a)
109
108
  end
109
+
110
+ it "performs no link transformation for absolute links" do
111
+ a = "<a href=\"https://jekyllrb.com\">"
112
+ expect(site.posts[0].output).to include(a)
113
+ end
114
+
115
+ it "performs no link transformation inside inline code snippets" do
116
+ code = "<code class=\"highlighter-rouge\">/</code>"
117
+ expect(site.posts[0].output).to include(code)
118
+ end
119
+
120
+ it "performs no link transformation inside multiline code snippets" do
121
+ code = "<code>&lt;a href=\"/\"&gt;Hello&lt;/a&gt;\n</code>"
122
+ expect(site.posts[0].output).to include(code)
123
+ end
124
+
125
+ it "performs no link transformation inside highlighted code snippets" do
126
+ code = "<code><span class=\"nt\">&lt;a</span> <span class=\"na\">href=</span><span class=\"s\">\"/\"</span><span class=\"nt\">&gt;</span>Hello<span class=\"nt\">&lt;/a&gt;</span>\n</code>"
127
+ expect(site.posts[0].output).to include(code)
128
+ end
110
129
  end
111
130
 
112
131
  context "And site domain has a trailing slash" do
@@ -117,22 +136,27 @@ eos
117
136
  end
118
137
 
119
138
  describe "Crawler" do
120
- it "Removes duplicate slashes from urls on posts" do
139
+ it "removes duplicate slashes from links on posts" do
121
140
  a = "<a href=\"http://example.com/posts/curabitur-sed-condimentum-enim/\">"
122
141
  expect(site.posts[0].output).to include(a)
123
142
  end
124
143
 
125
- it "Removes duplicate slashes from urls on pages" do
144
+ it "removes duplicate slashes from embedded links on posts" do
145
+ a = "<a href=\"https://www.facebook.com/sharer.php?u=http://example.com/posts/lorem-ipsum-dolor-sit-amet/\">"
146
+ expect(site.posts[0].output).to include(a)
147
+ end
148
+
149
+ it "removes duplicate slashes from links on pages" do
126
150
  a = "<a href=\"http://example.com/posts/lorem-ipsum-dolor-sit-amet/\">"
127
151
  expect(site.pages[1].output).to include(a)
128
152
  end
129
153
 
130
- it "Removes duplicate slashes from urls on sitemaps" do
154
+ it "removes duplicate slashes from links on sitemaps" do
131
155
  loc = "<loc>http://example.com/posts/lorem-ipsum-dolor-sit-amet/</loc>"
132
156
  expect(site.pages[2].output).to include(loc)
133
157
  end
134
158
 
135
- it "Removes duplicate slashes from urls on feeds" do
159
+ it "removes duplicate slashes from links on feeds" do
136
160
  atom_link = "<atom:link href=\"http://example.com/feed.xml\" rel=\"self\" type=\"application/rss+xml\"/>"
137
161
  expect(site.pages[0].output).to include(atom_link)
138
162
 
@@ -140,7 +164,7 @@ eos
140
164
  expect(site.pages[0].output).to include(link)
141
165
  end
142
166
 
143
- it "Removes duplicate slashes from encoded urls on feeds" do
167
+ it "removes duplicate slashes from encoded links on feeds" do
144
168
  a = <<-eos
145
169
  <description>&lt;p&gt;Curabitur sed condimentum enim. Integer ut velit vitae ante facilisis
146
170
  consequat. Nullam egestas ipsum sit amet nibh ornare, non consequat massa
@@ -6,7 +6,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vitae imperdiet
6
6
  magna. Maecenas suscipit quis nisi vel cursus. In hac habitasse platea
7
7
  dictumst. Sed a mi eu magna semper porta. Donec mollis, leo sit amet elementum
8
8
  egestas, est nibh euismod mauris, quis molestie libero ex in erat. [Curabitur
9
- sed condimentum enim][link].
9
+ sed condimentum enim][1].
10
10
 
11
11
  ```html
12
12
  <a href="/">Hello</a>
@@ -21,4 +21,11 @@ egestas, est nibh euismod mauris, quis molestie libero ex in erat.
21
21
  <a href="/">Hello</a>
22
22
  ```
23
23
 
24
- [link]: /posts/curabitur-sed-condimentum-enim/
24
+ <a href="https://www.facebook.com/sharer.php?u={{ page.url }}">
25
+ Share on Facebook
26
+ </a>
27
+
28
+ Powered by [Jekyll][2]
29
+
30
+ [1]: /posts/curabitur-sed-condimentum-enim/
31
+ [2]: https://jekyllrb.com
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-absolute-links
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Miguel Venegas Mendoza
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-22 00:00:00.000000000 Z
11
+ date: 2018-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  version: '0'
122
122
  requirements: []
123
123
  rubyforge_project:
124
- rubygems_version: 2.6.10
124
+ rubygems_version: 2.7.6
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: Absolute link converter for Jekyll sites.