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: 68ae1f6ad9f04cc3f99ec1d3ca767b7568c1c9b4
4
- data.tar.gz: 56022368b8e991fe1442f9b55a2bdd70fbafca57
3
+ metadata.gz: 644663b8c4ce0860a650f8293f1795d30694ef57
4
+ data.tar.gz: 39a86341f8fdbceff9fa5deaea830615c911f34e
5
5
  SHA512:
6
- metadata.gz: 059ea292f70bbac59ad7793289eebabab3aedf032df1364790b9f51a38ccbe43a0d71ffb4bb06502c6565110a4243d71c856a90af676e463fff3a1f6bc66e8db
7
- data.tar.gz: 8338182a3c61dfa12805e9fe07864974aadc67f2dc0a8e103ee5b0e249b548165ce3729eb08d543d53429ab84f3d39a6d0c07c02fc04a64896e76311eeeb7132
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
- @markup = Liquid::Variable.new(@markup).render(context)
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 == @markup }
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
- @markup = Liquid::Variable.new(@markup).render(context)
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 == @markup }
36
+ tag, _ = site.tags.detect { |key, value| key == input }
36
37
  return "" if !tag
37
38
  tag_slug =
38
39
  I18n.transliterate(
@@ -1,3 +1,3 @@
1
1
  module JekyllIndexPages
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -60,16 +60,24 @@ describe JekyllIndexPages::CategoryURL do
60
60
  end
61
61
  end
62
62
 
63
- context "When a valid category name is provided as a variable" do
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 %}{% if forloop.last %}{% category_url category[0] %}{% endif %}{% endfor %}
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 a valid category page URL" do
72
- expect(template.render!(payload, info)).to start_with("/ciencia-ficcion/")
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 a valid category page URL" do
89
- expect(template.render!(payload, info)).to start_with("/custom/ciencia-ficcion/")
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 a valid tag name is provided as a variable" do
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 %}{% if forloop.last %}{% tag_url tag[0] %}{% endif %}{% endfor %}
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 a valid tag page URL" do
72
- expect(template.render!(payload, info)).to start_with("/ciencia-ficcion/")
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 a valid tag page URL" do
89
- expect(template.render!(payload, info)).to start_with("/custom/ciencia-ficcion/")
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-index-pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Miguel Venegas Mendoza