jekyll-index-pages 0.4.1 → 0.4.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 644663b8c4ce0860a650f8293f1795d30694ef57
|
4
|
+
data.tar.gz: 39a86341f8fdbceff9fa5deaea830615c911f34e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71b7d568df6cb8aac4637e79cf14dc12015f022393e232d7e7e5760abd7f7423bcbca6b508d20c52cb062c5827130b4788759f617cf695aad05e252d3c5d9f7e
|
7
|
+
data.tar.gz: 04778169628e282f12696b1523cc0cd2ad6bda00b18b73e5aee3d2e9b11e469bd858ee8655e95b43414b53d5e061f62ac5aafc134682244530bf5e7786b57638
|
@@ -9,10 +9,11 @@ module JekyllIndexPages
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def render(context)
|
12
|
+
input = ""
|
12
13
|
if @markup.match(STRING_SYNTAX)
|
13
|
-
@markup.gsub
|
14
|
+
input = @markup.gsub("\"", "")
|
14
15
|
elsif @markup.match(VARIABLE_SYNTAX)
|
15
|
-
|
16
|
+
input = Liquid::Variable.new(@markup).render(context)
|
16
17
|
else
|
17
18
|
raise ArgumentError, <<-eos
|
18
19
|
Invalid syntax for category_url tag:
|
@@ -32,7 +33,7 @@ eos
|
|
32
33
|
|
33
34
|
site = context.registers[:site]
|
34
35
|
|
35
|
-
category, _ = site.categories.detect { |key, value| key ==
|
36
|
+
category, _ = site.categories.detect { |key, value| key == input }
|
36
37
|
return "" if !category
|
37
38
|
category_slug =
|
38
39
|
I18n.transliterate(
|
@@ -9,10 +9,11 @@ module JekyllIndexPages
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def render(context)
|
12
|
+
input = ""
|
12
13
|
if @markup.match(STRING_SYNTAX)
|
13
|
-
@markup.gsub
|
14
|
+
input = @markup.gsub("\"", "")
|
14
15
|
elsif @markup.match(VARIABLE_SYNTAX)
|
15
|
-
|
16
|
+
input = Liquid::Variable.new(@markup).render(context)
|
16
17
|
else
|
17
18
|
raise ArgumentError, <<-eos
|
18
19
|
Invalid syntax for tag_url tag:
|
@@ -32,7 +33,7 @@ eos
|
|
32
33
|
|
33
34
|
site = context.registers[:site]
|
34
35
|
|
35
|
-
tag, _ = site.tags.detect { |key, value| key ==
|
36
|
+
tag, _ = site.tags.detect { |key, value| key == input }
|
36
37
|
return "" if !tag
|
37
38
|
tag_slug =
|
38
39
|
I18n.transliterate(
|
data/spec/category-url_spec.rb
CHANGED
@@ -60,16 +60,24 @@ describe JekyllIndexPages::CategoryURL do
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
context "When
|
63
|
+
context "When valid category names are provided as a variable" do
|
64
64
|
let(:template) do
|
65
65
|
Liquid::Template.parse <<-eos
|
66
|
-
{% for category in site.categories %}
|
66
|
+
{% for category in site.categories %}
|
67
|
+
{% category_url category[0] %}
|
68
|
+
{% endfor %}
|
67
69
|
eos
|
68
70
|
end
|
69
71
|
|
70
72
|
describe "CategoryURL.render" do
|
71
|
-
it "returns
|
72
|
-
expect(template.render!(payload, info)).to
|
73
|
+
it "returns valid category page URLs" do
|
74
|
+
expect(template.render!(payload, info)).to eq <<-eos
|
75
|
+
|
76
|
+
/science-fiction/
|
77
|
+
|
78
|
+
/ciencia-ficcion/
|
79
|
+
|
80
|
+
eos
|
73
81
|
end
|
74
82
|
end
|
75
83
|
|
@@ -85,8 +93,14 @@ eos
|
|
85
93
|
end
|
86
94
|
|
87
95
|
describe "CategoryURL.render" do
|
88
|
-
it "returns
|
89
|
-
expect(template.render!(payload, info)).to
|
96
|
+
it "returns valid category page URLs" do
|
97
|
+
expect(template.render!(payload, info)).to eq <<-eos
|
98
|
+
|
99
|
+
/custom/science-fiction/
|
100
|
+
|
101
|
+
/custom/ciencia-ficcion/
|
102
|
+
|
103
|
+
eos
|
90
104
|
end
|
91
105
|
end
|
92
106
|
end
|
data/spec/tag-url_spec.rb
CHANGED
@@ -60,16 +60,26 @@ describe JekyllIndexPages::TagURL do
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
context "When
|
63
|
+
context "When valid tag names are provided as a variable" do
|
64
64
|
let(:template) do
|
65
65
|
Liquid::Template.parse <<-eos
|
66
|
-
{% for tag in site.tags %}
|
66
|
+
{% for tag in site.tags %}
|
67
|
+
{% tag_url tag[0] %}
|
68
|
+
{% endfor %}
|
67
69
|
eos
|
68
70
|
end
|
69
71
|
|
70
72
|
describe "TagURL.render" do
|
71
|
-
it "returns
|
72
|
-
expect(template.render!(payload, info)).to
|
73
|
+
it "returns valid tag page URLs" do
|
74
|
+
expect(template.render!(payload, info)).to eq <<-eos
|
75
|
+
|
76
|
+
/star-trek/
|
77
|
+
|
78
|
+
/viaje-a-las-estrellas/
|
79
|
+
|
80
|
+
/ciencia-ficcion/
|
81
|
+
|
82
|
+
eos
|
73
83
|
end
|
74
84
|
end
|
75
85
|
|
@@ -85,8 +95,16 @@ eos
|
|
85
95
|
end
|
86
96
|
|
87
97
|
describe "TagURL.render" do
|
88
|
-
it "returns
|
89
|
-
expect(template.render!(payload, info)).to
|
98
|
+
it "returns valid tag page URLs" do
|
99
|
+
expect(template.render!(payload, info)).to eq <<-eos
|
100
|
+
|
101
|
+
/custom/star-trek/
|
102
|
+
|
103
|
+
/custom/viaje-a-las-estrellas/
|
104
|
+
|
105
|
+
/custom/ciencia-ficcion/
|
106
|
+
|
107
|
+
eos
|
90
108
|
end
|
91
109
|
end
|
92
110
|
end
|