jekyll-redirect-from 0.9.0 → 0.9.1

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: 7943ee5168973d4f3fb0dfce3ab6cf477b56957a
4
- data.tar.gz: 45499228a22ab06aab61f89f2dc8f33c880987b6
3
+ metadata.gz: 1d02e44aaf2c3a2c7fb503ad76226e05910dd092
4
+ data.tar.gz: 0520c094f2ada7609791410bc9dbe0c80cdff345
5
5
  SHA512:
6
- metadata.gz: f2adce00c4d8a716ab5304c76fe146571537afea2e4950fb99bf6c67b7adb514997b52f540198c9fe7bb9aab6935d7e44906ef23f8250a7d99af838d49f84927
7
- data.tar.gz: b2c337d536492b2a6b5935aadf9b95ef1893f872fe260d68bdffbf7d0b14d6a31e45d2a896c879f8f4ad7466e697d2a1e48c39f2ade0de1077a1c558aea54f2d
6
+ metadata.gz: fa17956617938d9c608ee4f61fabcd86142c7ac8307cbc5ad6498eb6c433395e7ca42467f6bd7b6657e7dc63f815a5595c6c2345202009fd4b4b22aa6f79ba70
7
+ data.tar.gz: 01117527d4cdea7a53f59cec4addc7e046d23f5e9895e33043f7f26777e3ff3075e0f4b18e1a615f2e06b42d01849d5493b3e18a9a420151c2f1716e36806765
data/History.markdown CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.9.1 / 2015-12-11
2
+
3
+ * Enforce double-quote strings to pass htmlhint (#83)
4
+ * Stringify all values coming from `site.github` (#89)
5
+
1
6
  ## 0.9.0 / 2015-10-28
2
7
 
3
8
  * Support Jekyll 3 stable (#76)
data/README.md CHANGED
@@ -38,10 +38,20 @@ gems:
38
38
  - jekyll-redirect-from
39
39
  ```
40
40
 
41
+ If you're using Jekyll in `safe` mode to mimic GitHub Pages, make sure to
42
+ add jekyll-redirect-from to your whitelist:
43
+
44
+ ```yaml
45
+ whitelist:
46
+ - jekyll-redirect-from
47
+ ```
48
+
49
+ Then run `jekyll <cmd> --safe` like normal.
50
+
41
51
  ## Usage
42
52
 
43
53
  The object of this gem is to allow an author to specify multiple URLs for a
44
- page, such that the alternative URLs redirect to the new Jekyll URL. This is
54
+ page, such that the alternative URLs redirect to the new Jekyll URL.
45
55
 
46
56
  To use it, simply add the array to the YAML front-matter of your page or post:
47
57
 
@@ -19,13 +19,13 @@ module JekyllRedirectFrom
19
19
  def generate_redirect_content(item_url)
20
20
  self.output = self.content = <<-EOF
21
21
  <!DOCTYPE html>
22
- <meta charset=utf-8>
22
+ <meta charset="utf-8">
23
23
  <title>Redirecting...</title>
24
- <link rel=canonical href="#{item_url}">
25
- <meta http-equiv=refresh content="0; url=#{item_url}">
24
+ <link rel="canonical" href="#{item_url}">
25
+ <meta http-equiv="refresh" content="0; url=#{item_url}">
26
26
  <h1>Redirecting...</h1>
27
27
  <a href="#{item_url}">Click here if you are not redirected.</a>
28
- <script>location='#{item_url}'</script>
28
+ <script>location="#{item_url}"</script>
29
29
  EOF
30
30
  end
31
31
  end
@@ -74,7 +74,9 @@ module JekyllRedirectFrom
74
74
 
75
75
  def config_github_url(site)
76
76
  github_config = site.config['github']
77
- github_config['url'] if github_config.is_a?(Hash)
77
+ if github_config.is_a?(Hash) && github_config['url']
78
+ github_config['url'].to_s
79
+ end
78
80
  end
79
81
 
80
82
  def config_baseurl(site)
@@ -1,3 +1,3 @@
1
1
  module JekyllRedirectFrom
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
@@ -8,19 +8,19 @@ describe JekyllRedirectFrom::RedirectPage do
8
8
 
9
9
  context "#generate_redirect_content" do
10
10
  it "sets the #content to the generated refresh page" do
11
- expect(page_content).to eq("<!DOCTYPE html>\n<meta charset=utf-8>\n<title>Redirecting...</title>\n<link rel=canonical href=\"#{item_url}\">\n<meta http-equiv=refresh content=\"0; url=#{item_url}\">\n<h1>Redirecting...</h1>\n<a href=\"#{item_url}\">Click here if you are not redirected.</a>\n<script>location='#{item_url}'</script>\n")
11
+ expect(page_content).to eq("<!DOCTYPE html>\n<meta charset=\"utf-8\">\n<title>Redirecting...</title>\n<link rel=\"canonical\" href=\"#{item_url}\">\n<meta http-equiv=\"refresh\" content=\"0; url=#{item_url}\">\n<h1>Redirecting...</h1>\n<a href=\"#{item_url}\">Click here if you are not redirected.</a>\n<script>location=\"#{item_url}\"</script>\n")
12
12
  end
13
13
 
14
14
  it "contains the meta refresh tag" do
15
- expect(page_content).to include("<meta http-equiv=refresh content=\"0; url=#{item_url}\">")
15
+ expect(page_content).to include("<meta http-equiv=\"refresh\" content=\"0; url=#{item_url}\">")
16
16
  end
17
17
 
18
18
  it "contains JavaScript redirect" do
19
- expect(page_content).to include("location='http://jekyllrb.com/2014/01/03/moving-to-jekyll.md'")
19
+ expect(page_content).to include("location=\"http://jekyllrb.com/2014/01/03/moving-to-jekyll.md\"")
20
20
  end
21
21
 
22
22
  it "contains canonical link in header" do
23
- expect(page_content).to include("<link rel=canonical href=\"http://jekyllrb.com/2014/01/03/moving-to-jekyll.md\">")
23
+ expect(page_content).to include("<link rel=\"canonical\" href=\"http://jekyllrb.com/2014/01/03/moving-to-jekyll.md\">")
24
24
  end
25
25
 
26
26
  it "contains a clickable link to redirect" do
@@ -68,17 +68,17 @@ describe JekyllRedirectFrom::Redirector do
68
68
 
69
69
  it "generates the refresh page for the collection with one redirect_to url" do
70
70
  expect(@dest.join("articles", "redirect-somewhere-else-plz.html")).to exist
71
- expect(destination_doc_contents("articles", "redirect-somewhere-else-plz.html")).to include(%|<meta http-equiv=refresh content="0; url=http://www.zombo.com">|)
71
+ expect(destination_doc_contents("articles", "redirect-somewhere-else-plz.html")).to include(%|<meta http-equiv="refresh" content="0; url=http://www.zombo.com">|)
72
72
  end
73
73
 
74
74
  it "generates the refresh page for the page with one redirect_to url" do
75
75
  expect(destination_file_exists?("one_redirect_to.html")).to be_truthy
76
- expect(destination_file_contents("one_redirect_to.html")).to include(%|<meta http-equiv=refresh content="0; url=https://www.github.com">|)
76
+ expect(destination_file_contents("one_redirect_to.html")).to include(%|<meta http-equiv="refresh" content="0; url=https://www.github.com">|)
77
77
  end
78
78
 
79
79
  it "generates the refresh page for the page with multiple redirect_to urls" do
80
80
  expect(destination_file_exists?("multiple_redirect_tos.html")).to be_truthy
81
- expect(destination_file_contents("multiple_redirect_tos.html")).to include(%|<meta http-equiv=refresh content="0; url=https://www.jekyllrb.com">|)
81
+ expect(destination_file_contents("multiple_redirect_tos.html")).to include(%|<meta http-equiv="refresh" content="0; url=https://www.jekyllrb.com">|)
82
82
  end
83
83
  end
84
84
 
@@ -88,6 +88,11 @@ describe JekyllRedirectFrom::Redirector do
88
88
  expect(redirector.redirect_url(@site, page_with_one)).to start_with("http://example.github.io/test")
89
89
  end
90
90
 
91
+ it "converts non-string values in site.github.url to strings" do
92
+ @site.config['github'] = { "url" => TestStringContainer.new("http://example.github.io/test") }
93
+ expect(redirector.redirect_url(@site, page_with_one)).to start_with("http://example.github.io/test")
94
+ end
95
+
91
96
  it "uses site.baseurl as the redirect prefix when site.github.url is not set" do
92
97
  @site.config['baseurl'] = "/fancy/prefix"
93
98
  expect(redirector.redirect_url(@site, page_with_one)).to start_with("/fancy/prefix")
data/spec/spec_helper.rb CHANGED
@@ -79,3 +79,13 @@ RSpec.configure do |config|
79
79
  File.read(File.join(@dest.to_s, 'sitemap.xml'))
80
80
  end
81
81
  end
82
+
83
+ class TestStringContainer
84
+ def initialize(strValue)
85
+ @val = strValue
86
+ end
87
+
88
+ def to_s
89
+ @val
90
+ end
91
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-redirect-from
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Parker Moore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-28 00:00:00.000000000 Z
11
+ date: 2015-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  version: '0'
137
137
  requirements: []
138
138
  rubyforge_project:
139
- rubygems_version: 2.2.3
139
+ rubygems_version: 2.2.5
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: Seamlessly specify multiple redirection URLs for your pages and posts