jekyll-absolute-links 0.1.3 → 0.1.4
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/lib/jekyll-absolute-links/crawler.rb +5 -0
- data/lib/jekyll-absolute-links/version.rb +1 -1
- data/spec/crawler_spec.rb +33 -18
- data/spec/fixtures/absolute-links/_collection/lorem-ipsum-dolor-sit-amet.md +12 -0
- data/spec/fixtures/absolute-links/_config.yml +4 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8330da05ea6e13c0c5aa8c882456208d21387424a200cd19b1143679c413b2aa
|
4
|
+
data.tar.gz: 88dd920dd88e003dc55a72ff2347e2ff8086b5df7c056304eb91f33c4baf40b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2231ffdc90914e84c9c25d556a11c7e5246e26509a24a653ba54f8e4b17c4a173de046cc8d660384f657c247a64154ead2438c4dcb8d8d0e5fa3a40e3f5ebb18
|
7
|
+
data.tar.gz: da907810c6f47f64d339344853e1bb393da1e1bdeca89b45434a80dbaee6fbf96904a3cd151d5a875284b8c03d03cdbf6c0dd95d2b8cdf75cb12e1986c318b6a
|
@@ -12,6 +12,11 @@ module JekyllAbsoluteLinks
|
|
12
12
|
transform(page.output, @regexp, page.site.config["url"])
|
13
13
|
end
|
14
14
|
|
15
|
+
Jekyll::Hooks.register :documents, :post_render do |document|
|
16
|
+
next if Jekyll::env == "development"
|
17
|
+
transform(document.output, @regexp, document.site.config["url"])
|
18
|
+
end
|
19
|
+
|
15
20
|
class << self
|
16
21
|
private
|
17
22
|
def transform(output, regexp, site_url)
|
data/spec/crawler_spec.rb
CHANGED
@@ -16,27 +16,32 @@ describe JekyllAbsoluteLinks::Crawler do
|
|
16
16
|
|
17
17
|
context "When development environment is active" do
|
18
18
|
describe "Crawler" do
|
19
|
-
it "performs no link transformation
|
19
|
+
it "performs no link transformation in posts" do
|
20
20
|
a = "<a href=\"/posts/curabitur-sed-condimentum-enim/\">"
|
21
21
|
expect(site.posts[0].output).to include(a)
|
22
22
|
end
|
23
23
|
|
24
|
-
it "performs no embedded link transformation
|
24
|
+
it "performs no embedded link transformation in posts" do
|
25
25
|
a = "<a href=\"https://www.facebook.com/sharer.php?u=/posts/lorem-ipsum-dolor-sit-amet/\">"
|
26
26
|
expect(site.posts[0].output).to include(a)
|
27
27
|
end
|
28
28
|
|
29
|
-
it "performs no link transformation
|
29
|
+
it "performs no link transformation in pages" do
|
30
30
|
a = "<a href=\"/posts/lorem-ipsum-dolor-sit-amet/\">"
|
31
31
|
expect(site.pages[1].output).to include(a)
|
32
32
|
end
|
33
33
|
|
34
|
-
it "performs no link transformation
|
34
|
+
it "performs no link transformation in documents" do
|
35
|
+
a = "<a href=\"/posts/lorem-ipsum-dolor-sit-amet/\">"
|
36
|
+
expect(site.collections['collection'][0].output).to include(a)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "performs no link transformation in sitemaps" do
|
35
40
|
loc = "<loc>/posts/lorem-ipsum-dolor-sit-amet/</loc>"
|
36
41
|
expect(site.pages[2].output).to include(loc)
|
37
42
|
end
|
38
43
|
|
39
|
-
it "performs no link transformation
|
44
|
+
it "performs no link transformation in feeds" do
|
40
45
|
atom_link = "<atom:link href=\"/feed.xml\" rel=\"self\" type=\"application/rss+xml\"/>"
|
41
46
|
expect(site.pages[0].output).to include(atom_link)
|
42
47
|
|
@@ -44,7 +49,7 @@ describe JekyllAbsoluteLinks::Crawler do
|
|
44
49
|
expect(site.pages[0].output).to include(link)
|
45
50
|
end
|
46
51
|
|
47
|
-
it "performs no link transformation
|
52
|
+
it "performs no embedded link transformation in feeds" do
|
48
53
|
a = <<-eos
|
49
54
|
<description><p>Curabitur sed condimentum enim. Integer ut velit vitae ante facilisis
|
50
55
|
consequat. Nullam egestas ipsum sit amet nibh ornare, non consequat massa
|
@@ -66,27 +71,32 @@ eos
|
|
66
71
|
end
|
67
72
|
|
68
73
|
describe "Crawler" do
|
69
|
-
it "transforms relative links to absolute links
|
74
|
+
it "transforms relative links to absolute links in posts" do
|
70
75
|
a = "<a href=\"http://example.com/posts/curabitur-sed-condimentum-enim/\">"
|
71
76
|
expect(site.posts[0].output).to include(a)
|
72
77
|
end
|
73
78
|
|
74
|
-
it "transforms embedded relative links to absolute links
|
79
|
+
it "transforms embedded relative links to absolute links in posts" do
|
75
80
|
a = "<a href=\"https://www.facebook.com/sharer.php?u=http://example.com/posts/lorem-ipsum-dolor-sit-amet/\">"
|
76
81
|
expect(site.posts[0].output).to include(a)
|
77
82
|
end
|
78
83
|
|
79
|
-
it "transforms relative links to absolute links
|
84
|
+
it "transforms relative links to absolute links in pages" do
|
80
85
|
a = "<a href=\"http://example.com/posts/lorem-ipsum-dolor-sit-amet/\">"
|
81
86
|
expect(site.pages[1].output).to include(a)
|
82
87
|
end
|
83
88
|
|
84
|
-
it "transforms relative links to absolute links
|
89
|
+
it "transforms relative links to absolute links in documents" do
|
90
|
+
a = "<a href=\"http://example.com/posts/lorem-ipsum-dolor-sit-amet/\">"
|
91
|
+
expect(site.collections['collection'][0].output).to include(a)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "transforms relative links to absolute links in sitemaps" do
|
85
95
|
loc = "<loc>http://example.com/posts/lorem-ipsum-dolor-sit-amet/</loc>"
|
86
96
|
expect(site.pages[2].output).to include(loc)
|
87
97
|
end
|
88
98
|
|
89
|
-
it "transforms relative links to absolute links
|
99
|
+
it "transforms relative links to absolute links in feeds" do
|
90
100
|
atom_link = "<atom:link href=\"http://example.com/feed.xml\" rel=\"self\" type=\"application/rss+xml\"/>"
|
91
101
|
expect(site.pages[0].output).to include(atom_link)
|
92
102
|
|
@@ -94,7 +104,7 @@ eos
|
|
94
104
|
expect(site.pages[0].output).to include(link)
|
95
105
|
end
|
96
106
|
|
97
|
-
it "transforms relative links to absolute links
|
107
|
+
it "transforms embedded relative links to absolute links in feeds" do
|
98
108
|
a = <<-eos
|
99
109
|
<description><p>Curabitur sed condimentum enim. Integer ut velit vitae ante facilisis
|
100
110
|
consequat. Nullam egestas ipsum sit amet nibh ornare, non consequat massa
|
@@ -136,27 +146,32 @@ eos
|
|
136
146
|
end
|
137
147
|
|
138
148
|
describe "Crawler" do
|
139
|
-
it "removes duplicate slashes from links
|
149
|
+
it "removes duplicate slashes from links in posts" do
|
140
150
|
a = "<a href=\"http://example.com/posts/curabitur-sed-condimentum-enim/\">"
|
141
151
|
expect(site.posts[0].output).to include(a)
|
142
152
|
end
|
143
153
|
|
144
|
-
it "removes duplicate slashes from embedded links
|
154
|
+
it "removes duplicate slashes from embedded links in posts" do
|
145
155
|
a = "<a href=\"https://www.facebook.com/sharer.php?u=http://example.com/posts/lorem-ipsum-dolor-sit-amet/\">"
|
146
156
|
expect(site.posts[0].output).to include(a)
|
147
157
|
end
|
148
158
|
|
149
|
-
it "removes duplicate slashes from links
|
159
|
+
it "removes duplicate slashes from links in pages" do
|
150
160
|
a = "<a href=\"http://example.com/posts/lorem-ipsum-dolor-sit-amet/\">"
|
151
161
|
expect(site.pages[1].output).to include(a)
|
152
162
|
end
|
153
163
|
|
154
|
-
it "removes duplicate slashes from links
|
164
|
+
it "removes duplicate slashes from links in documents" do
|
165
|
+
a = "<a href=\"http://example.com/posts/lorem-ipsum-dolor-sit-amet/\">"
|
166
|
+
expect(site.collections['collection'][0].output).to include(a)
|
167
|
+
end
|
168
|
+
|
169
|
+
it "removes duplicate slashes from links in sitemaps" do
|
155
170
|
loc = "<loc>http://example.com/posts/lorem-ipsum-dolor-sit-amet/</loc>"
|
156
171
|
expect(site.pages[2].output).to include(loc)
|
157
172
|
end
|
158
173
|
|
159
|
-
it "removes duplicate slashes from links
|
174
|
+
it "removes duplicate slashes from links in feeds" do
|
160
175
|
atom_link = "<atom:link href=\"http://example.com/feed.xml\" rel=\"self\" type=\"application/rss+xml\"/>"
|
161
176
|
expect(site.pages[0].output).to include(atom_link)
|
162
177
|
|
@@ -164,7 +179,7 @@ eos
|
|
164
179
|
expect(site.pages[0].output).to include(link)
|
165
180
|
end
|
166
181
|
|
167
|
-
it "removes duplicate slashes from
|
182
|
+
it "removes duplicate slashes from embedded links in feeds" do
|
168
183
|
a = <<-eos
|
169
184
|
<description><p>Curabitur sed condimentum enim. Integer ut velit vitae ante facilisis
|
170
185
|
consequat. Nullam egestas ipsum sit amet nibh ornare, non consequat massa
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
title: Lorem ipsum dolor sit amet
|
3
|
+
---
|
4
|
+
|
5
|
+
[Lorem ipsum][1] dolor sit amet, consectetuer adipiscing elit. Aenean commodo
|
6
|
+
ligula eget dolor. Aenean massa. **Cum sociis natoque penatibus et magnis dis
|
7
|
+
parturient montes, nascetur ridiculus mus**. Donec quam felis, ultricies nec,
|
8
|
+
pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. _Donec
|
9
|
+
pede justo, fringilla vel, aliquet nec, vulputate eget, arcu_. In enim justo,
|
10
|
+
rhoncus ut, imperdiet a, venenatis vitae, justo.
|
11
|
+
|
12
|
+
[1]: /posts/lorem-ipsum-dolor-sit-amet/
|
@@ -1,5 +1,4 @@
|
|
1
1
|
url: http://example.com
|
2
|
-
|
3
2
|
defaults:
|
4
3
|
- scope:
|
5
4
|
path: ""
|
@@ -7,9 +6,12 @@ defaults:
|
|
7
6
|
values:
|
8
7
|
layout: default
|
9
8
|
permalink: /posts/:title/
|
10
|
-
|
11
9
|
- scope:
|
12
10
|
path: ""
|
13
11
|
type: pages
|
14
12
|
values:
|
15
13
|
layout: default
|
14
|
+
collections:
|
15
|
+
collection:
|
16
|
+
output: true
|
17
|
+
permalink: /:collection/:name/
|
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.
|
4
|
+
version: 0.1.4
|
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: 2018-02-
|
11
|
+
date: 2018-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- script/console
|
91
91
|
- script/setup
|
92
92
|
- spec/crawler_spec.rb
|
93
|
+
- spec/fixtures/absolute-links/_collection/lorem-ipsum-dolor-sit-amet.md
|
93
94
|
- spec/fixtures/absolute-links/_config.yml
|
94
95
|
- spec/fixtures/absolute-links/_includes/sitemap-entry.xml
|
95
96
|
- spec/fixtures/absolute-links/_layouts/default.html
|
@@ -127,6 +128,7 @@ specification_version: 4
|
|
127
128
|
summary: Absolute link converter for Jekyll sites.
|
128
129
|
test_files:
|
129
130
|
- spec/crawler_spec.rb
|
131
|
+
- spec/fixtures/absolute-links/_collection/lorem-ipsum-dolor-sit-amet.md
|
130
132
|
- spec/fixtures/absolute-links/_config.yml
|
131
133
|
- spec/fixtures/absolute-links/_includes/sitemap-entry.xml
|
132
134
|
- spec/fixtures/absolute-links/_layouts/default.html
|