middleman-sitemap 0.0.4 → 0.0.5

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: 6ab52e406cb849678df451ea164e0e0342831ba7
4
- data.tar.gz: 49b19c5c83c1683efde279766cbce91a4af1b6d9
3
+ metadata.gz: 1adc2a991abac1fef9c966deb289f3ebb33fddf5
4
+ data.tar.gz: a18eb3d7841acc6ed7d9c3efd259050d268d8d65
5
5
  SHA512:
6
- metadata.gz: 99e85bc60ace7ab5593744e7e7ff446816e6e608944ac7a1e44ea30cfaa1720bf9b4403a9e51ede3762dfc4675870f02a2b95fd82719503e67eba5ec6b95d6da
7
- data.tar.gz: dce8d39a3df91276e5c05d786d7bf2ba6ffa843c1c93497fe5447453ac69eaac2e2ed8a9283b0fa3016a51de202aa6fc8a8e46d9fb195c570fc5cc51041d0086
6
+ metadata.gz: 5f5f18bb6b07b4c8cefdd626e951bcdc958a5ee8e42ec2774f05f86536f3f73eee4020f549a51c7846f0084e102059cb6de0f3f0fc013008d802e90012fd09e1
7
+ data.tar.gz: a8d6fa9008700e6779eca688c5db85f512a1d39cd06dcd42fcb0905685eac7a9c3ad998e93aeeb095a7cee19e640f02f2acba5f981f9996ab0770b5d01b6aa18
@@ -0,0 +1,6 @@
1
+ Feature: Encode HTML entities
2
+
3
+ Scenario: URLs in loc entities are HTML encoded
4
+ Given a successfully built app at "weird-urls-app"
5
+ When I cd to "build"
6
+ Then the file "sitemap.xml" should contain "http://www.example.com/this-&-that"
@@ -0,0 +1 @@
1
+ activate :sitemap
File without changes
@@ -0,0 +1,5 @@
1
+ ---
2
+ priority: 0.8
3
+ changefreq: monthly
4
+ ---
5
+ this & that
@@ -85,6 +85,17 @@ class Sitemap < ::Middleman::Extension
85
85
  end
86
86
  end
87
87
 
88
+ # Returns a URL with proper HTML entities
89
+ def urlencode(url)
90
+ purl = URI.parse(url)
91
+ path_match = purl.path.match(/\/([^.]+)/)
92
+ if path_match
93
+ escaped_path = app.escape_html(path_match[1])
94
+ purl.path = "/#{escaped_path}.html"
95
+ end
96
+ return purl.to_s
97
+ end
98
+
88
99
  end
89
100
 
90
101
  ::Middleman::Extensions.register(:sitemap, Sitemap)
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "middleman-sitemap"
6
- s.version = "0.0.4"
6
+ s.version = "0.0.5"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Larry Staton Jr."]
9
9
  s.email = ["larry@larrystaton.com"]
@@ -2,7 +2,7 @@
2
2
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
3
  <% @pages.each do |p| %>
4
4
  <url>
5
- <loc><%= @hostname %><%= p.url.gsub(/\/$/, '') %></loc>
5
+ <loc><%= urlencode(@hostname + p.url).gsub(/\/$/,'') %></loc>
6
6
  <lastmod><%= Date.today.to_time.iso8601 %></lastmod>
7
7
  <changefreq><%= p.data.changefreq || 'weekly' %></changefreq>
8
8
  <priority><%= p.data.priority || '0.5' %></priority>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-sitemap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Larry Staton Jr.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-22 00:00:00.000000000 Z
11
+ date: 2014-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core
@@ -37,6 +37,7 @@ files:
37
37
  - LICENSE
38
38
  - README.md
39
39
  - Rakefile
40
+ - features/encoding.feature
40
41
  - features/gzip.feature
41
42
  - features/multiple_sitemaps.feature
42
43
  - features/support/env.rb
@@ -51046,6 +51047,11 @@ files:
51046
51047
  - fixtures/large-site-app/source/page50999.html
51047
51048
  - fixtures/large-site-app/source/page51000.html
51048
51049
  - fixtures/large-site-app/source/stylesheets/test.css
51050
+ - fixtures/weird-urls-app/config.rb
51051
+ - fixtures/weird-urls-app/source/index.html
51052
+ - fixtures/weird-urls-app/source/javascripts/test.js
51053
+ - fixtures/weird-urls-app/source/stylesheets/test.css
51054
+ - fixtures/weird-urls-app/source/this-&-that.html
51049
51055
  - lib/middleman-sitemap.rb
51050
51056
  - lib/middleman_extension.rb
51051
51057
  - middleman-sitemap.gemspec
@@ -51075,6 +51081,7 @@ signing_key:
51075
51081
  specification_version: 4
51076
51082
  summary: Builds a sitemap.xml for your site
51077
51083
  test_files:
51084
+ - features/encoding.feature
51078
51085
  - features/gzip.feature
51079
51086
  - features/multiple_sitemaps.feature
51080
51087
  - features/support/env.rb