jekyll-sitemap 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97d257da0dc97c587c0e9c08b979835bb933f12f
4
- data.tar.gz: 0a9f1d08dd96afd69e372f2230e812e81f34c1a9
3
+ metadata.gz: 4f288537895b8ef8244472fe563468be566d1553
4
+ data.tar.gz: 13d121259146c8ee408b5d1357000f1991b4cd55
5
5
  SHA512:
6
- metadata.gz: 6d3a4d6e03e2536ef04b33794def33fee2eb870f7025855f2f2f74a3561788a97396d37a612a9d53622d7bb02a4d9f97c1fac2b4d908e74c64b83fba5df3f477
7
- data.tar.gz: 529d0c282a5d0f5f1edb9c0f66ef356735b2e3e926b9e01266683944c2ca23358a92b93f734b60acd03d55eb4af5982598424e3228e41053dcd6a2909e4d03fc
6
+ metadata.gz: 08b221f3b82a57229d71eeb1bbaaa73a8437de679a89170d794ba836d57766e2b5ff49b4219d61b7e3817923c702d01f607421ef098843e95de15714fd72ff66
7
+ data.tar.gz: 66012f77eb83fa20d36c34198a3b1b75fc34fd8ee13e1ab12ad4c2c84dbda160f8fceaf3e8af5b457578be742cfa4e26bc069df55194dcc2e0dad28fec87ab6d
@@ -1,23 +1,34 @@
1
- language: ruby
2
- before_script: bundle update
3
- script: "script/cibuild"
4
1
  sudo: false
5
- cache: bundler
6
-
2
+ language: ruby
3
+ rvm:
4
+ - 2.0
5
+ - 2.1
6
+ - 2.2
7
7
  matrix:
8
8
  include:
9
9
  - # GitHub Pages
10
10
  rvm: 2.1.1
11
- env: GH_PAGES=true
12
- - # Ruby 1.9
13
- rvm: 1.9
14
- env: JEKYLL_VERSION=2.0
15
-
16
- rvm:
17
- - 2.2
18
- - 2.1
19
- - 2.0
11
+ env: JEKYLL_VERSION=2.4.0
12
+ - rvm: 1.9.3
13
+ env: JEKYLL_VERSION=2.5
20
14
  env:
21
- - ""
22
- - JEKYLL_VERSION=3.0.0.beta8
23
- - JEKYLL_VERSION=2.0
15
+ matrix:
16
+ - JEKYLL_VERSION=2.5
17
+ - JEKYLL_VERSION=3.0
18
+ branches:
19
+ only:
20
+ - master
21
+ install:
22
+ - travis_retry script/bootstrap
23
+ script: script/cibuild
24
+ notifications:
25
+ irc:
26
+ on_success: change
27
+ on_failure: change
28
+ channels:
29
+ - irc.freenode.org#jekyll
30
+ template:
31
+ - '%{repository}#%{build_number} %{message} %{build_url}'
32
+ email:
33
+ on_success: never
34
+ on_failure: change
data/Gemfile CHANGED
@@ -1,8 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
  gemspec
3
3
 
4
- if ENV["GH_PAGES"]
5
- gem "github-pages"
6
- elsif ENV["JEKYLL_VERSION"]
4
+ if ENV["JEKYLL_VERSION"]
7
5
  gem "jekyll", "~> #{ENV["JEKYLL_VERSION"]}"
8
6
  end
@@ -1,3 +1,11 @@
1
+ ## 0.10.0 / 2016-01-05
2
+
3
+ * URI encode sitemap URLs (#85)
4
+ * Do not include 'posts' collection twice (#92)
5
+ * Fix GitHub Pages tests to test just the Jekyll version (#87)
6
+ * Allow HTML files to end with `.xhtml` or `.htm` (#93)
7
+ * Simplify whitespace regex for stripping whitespace (#96)
8
+
1
9
  ## 0.9.0 / 2015-09-21
2
10
 
3
11
  * Test against Jekyll 2, 3, and the GitHub Pages version. (#83)
@@ -3,7 +3,7 @@
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "jekyll-sitemap"
5
5
  spec.summary = "Automatically generate a sitemap.xml for your Jekyll site."
6
- spec.version = "0.9.0"
6
+ spec.version = "0.10.0"
7
7
  spec.authors = ["GitHub, Inc."]
8
8
  spec.email = "support@github.com"
9
9
  spec.homepage = "https://github.com/jekyll/jekyll-sitemap"
@@ -23,9 +23,15 @@ module Jekyll
23
23
  end
24
24
  end
25
25
 
26
+ HTML_EXTENSIONS = %W(
27
+ .html
28
+ .xhtml
29
+ .htm
30
+ )
31
+
26
32
  # Array of all non-jekyll site files with an HTML extension
27
33
  def html_files
28
- @site.static_files.select { |file| File.extname(file.relative_path) == ".html" }
34
+ @site.static_files.select { |file| HTML_EXTENSIONS.include? file.extname }
29
35
  end
30
36
 
31
37
  # Path to sitemap.xml template file
@@ -52,8 +58,8 @@ module Jekyll
52
58
  site_map = PageWithoutAFile.new(@site, File.dirname(__FILE__), "", "sitemap.xml")
53
59
  site_map.content = File.read(source_path)
54
60
  site_map.data["layout"] = nil
55
- site_map.render(Hash.new, @site.site_payload)
56
- site_map.output.gsub(/\s*\n+/, "\n")
61
+ site_map.render({}, @site.site_payload)
62
+ site_map.output.gsub(/\s{2,}/, "\n")
57
63
  end
58
64
 
59
65
  # Checks if a sitemap already exists in the site source
@@ -3,7 +3,7 @@
3
3
  {% capture site_url %}{% if site.url %}{{ site.url | append: site.baseurl }}{% else %}{{ site.github.url }}{% endif %}{% endcapture %}
4
4
  {% for post in site.posts %}{% unless post.sitemap == false %}
5
5
  <url>
6
- <loc>{{ post.url | prepend: site_url }}</loc>
6
+ <loc>{{ post.url | prepend: site_url | uri_escape }}</loc>
7
7
  {% if post.last_modified_at %}
8
8
  <lastmod>{{ post.last_modified_at | date_to_xmlschema }}</lastmod>
9
9
  {% else %}
@@ -13,16 +13,16 @@
13
13
  {% endunless %}{% endfor %}
14
14
  {% for page in site.html_pages %}{% unless page.sitemap == false %}
15
15
  <url>
16
- <loc>{{ page.url | replace:'/index.html','/' | prepend: site_url }}</loc>
16
+ <loc>{{ page.url | replace:'/index.html','/' | prepend: site_url | uri_escape }}</loc>
17
17
  {% if page.last_modified_at %}
18
18
  <lastmod>{{ page.last_modified_at | date_to_xmlschema }}</lastmod>
19
19
  {% endif %}
20
20
  </url>
21
21
  {% endunless %}{% endfor %}
22
- {% for collection in site.collections %}{% unless collection.last.output == false or collection.output == false %}
22
+ {% for collection in site.collections %}{% unless collection.last.output == false or collection.output == false or collection.label == 'posts' %}
23
23
  {% for doc in collection.last.docs %}{% unless doc.sitemap == false %}
24
24
  <url>
25
- <loc>{{ doc.url | replace:'/index.html','/' | prepend: site_url }}</loc>
25
+ <loc>{{ doc.url | replace:'/index.html','/' | prepend: site_url | uri_escape }}</loc>
26
26
  {% if doc.last_modified_at %}
27
27
  <lastmod>{{ doc.last_modified_at | date_to_xmlschema }}</lastmod>
28
28
  {% endif %}
@@ -30,7 +30,7 @@
30
30
  {% endunless %}{% endfor %}
31
31
  {% for doc in collection.docs %}{% unless doc.sitemap == false %}
32
32
  <url>
33
- <loc>{{ doc.url | replace:'/index.html','/' | prepend: site_url }}</loc>
33
+ <loc>{{ doc.url | replace:'/index.html','/' | prepend: site_url | uri_escape }}</loc>
34
34
  {% if doc.last_modified_at %}
35
35
  <lastmod>{{ doc.last_modified_at | date_to_xmlschema }}</lastmod>
36
36
  {% endif %}
@@ -39,7 +39,7 @@
39
39
  {% endunless %}{% endfor %}
40
40
  {% for file in site.html_files %}
41
41
  <url>
42
- <loc>{{ file.path | prepend: site_url }}</loc>
42
+ <loc>{{ file.path | prepend: site_url | uri_escape }}</loc>
43
43
  <lastmod>{{ file.modified_time | date_to_xmlschema }}</lastmod>
44
44
  </url>
45
45
  {% endfor %}
@@ -1,3 +1,3 @@
1
- #! /bin/bash
1
+ #!/bin/sh
2
2
 
3
3
  bundle install
@@ -1,4 +1,4 @@
1
- #! /bin/bash
1
+ #!/bin/sh
2
2
  set -e
3
3
 
4
4
  bundle exec rspec
@@ -0,0 +1,5 @@
1
+ ---
2
+ permalink: this url has an ümlaut
3
+ ---
4
+
5
+ # URL contains characters that need to be URI encoded
@@ -0,0 +1 @@
1
+ This file has an .htm extension, and should be included in the sitemap
@@ -0,0 +1 @@
1
+ This file has an .xhtml extension, and should be included in the sitemap
@@ -1,3 +1,5 @@
1
+ # encoding: UTF-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe(Jekyll::JekyllSitemap) do
@@ -65,6 +67,10 @@ describe(Jekyll::JekyllSitemap) do
65
67
  it "doesn't remove filename for non-directory custom permalinks" do
66
68
  expect(contents).to match /<loc>http:\/\/example\.org\/permalink\/unique_name\.html<\/loc>/
67
69
  end
70
+
71
+ it "performs URI encoding of site paths" do
72
+ expect(contents).to match /<loc>http:\/\/example\.org\/this%20url%20has%20an%20%C3%BCmlaut<\/loc>/
73
+ end
68
74
  end
69
75
 
70
76
  it "generates the correct date for each of the posts" do
@@ -82,6 +88,11 @@ describe(Jekyll::JekyllSitemap) do
82
88
  expect(contents).not_to match /<loc>http:\/\/example\.org\/feeds\/atom\.xml<\/loc>/
83
89
  end
84
90
 
91
+ it "does include assets or any static files with .xhtml and .htm extensions" do
92
+ expect(contents).to match /\/some-subfolder\/xhtml\.xhtml/
93
+ expect(contents).to match /\/some-subfolder\/htm\.htm/
94
+ end
95
+
85
96
  it "does not include posts that have set 'sitemap: false'" do
86
97
  expect(contents).not_to match /\/exclude-this-post\.html<\/loc>/
87
98
  end
@@ -94,6 +105,10 @@ describe(Jekyll::JekyllSitemap) do
94
105
  expect(contents).to match /\/this-is-a-subfile\.html<\/loc>\s+<lastmod>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(-|\+)\d{2}:\d{2}<\/lastmod>/
95
106
  end
96
107
 
108
+ it "includes the correct number of items" do
109
+ expect(contents.scan(/(?=<url>)/).count).to eql 15
110
+ end
111
+
97
112
  context "with a baseurl" do
98
113
  let(:config) do
99
114
  Jekyll.configuration(Jekyll::Utils.deep_merge_hashes(overrides, {"baseurl" => "/bass"}))
@@ -118,4 +133,20 @@ describe(Jekyll::JekyllSitemap) do
118
133
  expect(contents).to match /<loc>http:\/\/example\.org\/bass\/2013\/12\/12\/dec-the-second\.html<\/loc>/
119
134
  end
120
135
  end
136
+
137
+ context "with site url that needs URI encoding" do
138
+ let(:config) do
139
+ Jekyll.configuration(Jekyll::Utils.deep_merge_hashes(overrides, {"url" => "http://has ümlaut.org"}))
140
+ end
141
+
142
+ it "performs URI encoding of site url" do
143
+ expect(contents).to match /<loc>http:\/\/has%20%C3%BCmlaut\.org\/<\/loc>/
144
+ expect(contents).to match /<loc>http:\/\/has%20%C3%BCmlaut\.org\/some-subfolder\/this-is-a-subpage\.html<\/loc>/
145
+ expect(contents).to match /<loc>http:\/\/has%20%C3%BCmlaut\.org\/2014\/03\/04\/march-the-fourth\.html<\/loc>/
146
+ end
147
+
148
+ it "does not double-escape site url" do
149
+ expect(contents).to_not match /%25/
150
+ end
151
+ end
121
152
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-sitemap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-22 00:00:00.000000000 Z
11
+ date: 2016-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -106,6 +106,7 @@ files:
106
106
  - spec/fixtures/_my_collection/custom_permalink.md
107
107
  - spec/fixtures/_my_collection/custom_permalink_2.md
108
108
  - spec/fixtures/_my_collection/test.html
109
+ - spec/fixtures/_my_collection/this-has-non-standard-chars.md
109
110
  - spec/fixtures/_other_things/test2.html
110
111
  - spec/fixtures/_posts/2013-12-12-dec-the-second.md
111
112
  - spec/fixtures/_posts/2014-03-02-march-the-second.md
@@ -117,9 +118,11 @@ files:
117
118
  - spec/fixtures/index.html
118
119
  - spec/fixtures/jekyll-last-modified-at/page.html
119
120
  - spec/fixtures/some-subfolder/exclude-this-page.html
121
+ - spec/fixtures/some-subfolder/htm.htm
120
122
  - spec/fixtures/some-subfolder/test_index.html
121
123
  - spec/fixtures/some-subfolder/this-is-a-subfile.html
122
124
  - spec/fixtures/some-subfolder/this-is-a-subpage.html
125
+ - spec/fixtures/some-subfolder/xhtml.xhtml
123
126
  - spec/jekyll-sitemap_spec.rb
124
127
  - spec/spec_helper.rb
125
128
  - spec/test_jekyll-last-modified-at.rb
@@ -143,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
146
  version: '0'
144
147
  requirements: []
145
148
  rubyforge_project:
146
- rubygems_version: 2.2.3
149
+ rubygems_version: 2.5.1
147
150
  signing_key:
148
151
  specification_version: 4
149
152
  summary: Automatically generate a sitemap.xml for your Jekyll site.
@@ -153,6 +156,7 @@ test_files:
153
156
  - spec/fixtures/_my_collection/custom_permalink.md
154
157
  - spec/fixtures/_my_collection/custom_permalink_2.md
155
158
  - spec/fixtures/_my_collection/test.html
159
+ - spec/fixtures/_my_collection/this-has-non-standard-chars.md
156
160
  - spec/fixtures/_other_things/test2.html
157
161
  - spec/fixtures/_posts/2013-12-12-dec-the-second.md
158
162
  - spec/fixtures/_posts/2014-03-02-march-the-second.md
@@ -164,9 +168,11 @@ test_files:
164
168
  - spec/fixtures/index.html
165
169
  - spec/fixtures/jekyll-last-modified-at/page.html
166
170
  - spec/fixtures/some-subfolder/exclude-this-page.html
171
+ - spec/fixtures/some-subfolder/htm.htm
167
172
  - spec/fixtures/some-subfolder/test_index.html
168
173
  - spec/fixtures/some-subfolder/this-is-a-subfile.html
169
174
  - spec/fixtures/some-subfolder/this-is-a-subpage.html
175
+ - spec/fixtures/some-subfolder/xhtml.xhtml
170
176
  - spec/jekyll-sitemap_spec.rb
171
177
  - spec/spec_helper.rb
172
178
  - spec/test_jekyll-last-modified-at.rb