jekyll-feed 0.1.4 → 0.2.0

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: 79e4003a864be95fa4d845116d5719a76f8906c1
4
- data.tar.gz: a41c885f6259a7b939b4cdcab4b2243c55ceb32f
3
+ metadata.gz: 14ee44b7a02f6709b95e9266a5e3b56d36ac065d
4
+ data.tar.gz: 25ea1ebdaf2ae8f7a5993726e9e73402b96a1136
5
5
  SHA512:
6
- metadata.gz: 247ff0949c0070bd2b7b589fab0b5486ad7d8f1917c38720e48b8aa6bb23a644ae80f803055e172dc50a8fd96407b5e73e9403bb06c9eba6d75ecc444d0d5c12
7
- data.tar.gz: 3cddc65822777dddb916d88a84dbb9065cdaba9da1e29341273f9975b0b4f10575553ba55a701e3c813df035ac4f623bb8f920f6adc6fa7cc6269f8c35c98392
6
+ metadata.gz: f9a1af3d768c6d8c921c11d3eb71205119b8b01e9569ca2f3697ee2f2c8f38c3e73cf9f7857b52fec581da487bd022499deab2a0cbfa4ff212af15737e6d06f6
7
+ data.tar.gz: 59435b91142b86809fd70e33b9293125e2a3e9ac28c789e0f735436ed4355e0a2d0378acf3fbad0148ce38a6b537e0f27af8d36bd728f297cdec78042c820c2d
data/README.md CHANGED
@@ -30,7 +30,11 @@ The plugin will automatically use any of the following configuration variables,
30
30
  * `name` - The title of the site, e.g., "My awesome site"
31
31
  * `description` - A longer description of what your site is about, e.g., "Where I blog about Jekyll and other awesome things"
32
32
  * `url` - The URL to your site, e.g., `http://example.com`. If none is provided, the plugin will try to use `site.github.url`.
33
- * `author` - Your name, e.g., "Dr. Jekyll"
33
+ * `author` - Your name, e.g., "Dr. Jekyll." This can be a string (with the author's name), or an object with the following properties:
34
+ - `name` - **Required** Display name of the author
35
+ - `email` - Email address of the author
36
+ - `uri` - Webpage where more information about the author can be found
37
+
34
38
 
35
39
  ### Optional front matter
36
40
 
@@ -45,7 +49,7 @@ The plugin will use the following post metadata, automatically generated by Jeky
45
49
 
46
50
  Additionally, the plugin will use the following values, if present in a post's YAML front matter:
47
51
 
48
- * `author` - The author of the post, e.g., "Dr. Jekyll". If none is given, feed readers will look to the feed author as defined in `_config.yml`
52
+ * `author` - The author of the post, e.g., "Dr. Jekyll". If none is given, feed readers will look to the feed author as defined in `_config.yml`. Like the feed author, this can also be an object.
49
53
 
50
54
  ### Meta tags
51
55
 
data/jekyll-feed.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "jekyll-feed"
5
- spec.version = "0.1.4"
5
+ spec.version = "0.2.0"
6
6
  spec.authors = ["Ben Balter"]
7
7
  spec.email = ["ben.balter@github.com"]
8
8
  spec.summary = "A Jekyll plugin to generate an Atom feed of your Jekyll posts"
@@ -20,5 +20,6 @@ Gem::Specification.new do |spec|
20
20
  spec.add_development_dependency "rspec", "~> 3.0"
21
21
  spec.add_development_dependency "typhoeus", "~> 0.7"
22
22
  spec.add_development_dependency "nokogiri", "~> 1.6"
23
+ spec.add_development_dependency "jekyll-last-modified-at", "0.3.4"
23
24
 
24
25
  end
data/lib/feed.xml CHANGED
@@ -21,7 +21,19 @@
21
21
 
22
22
  {% if site.author %}
23
23
  <author>
24
- <name>{{ site.author | xml_escape }}</name>
24
+ {% if site.author.name %}
25
+ <name>{{ site.author.name | xml_escape }}</name>
26
+ {% else %}
27
+ <name>{{ site.author | xml_escape }}</name>
28
+ {% endif %}
29
+ {% if site.author.email %}
30
+ <email>{{ site.author.email | xml_escape }}</email>
31
+ {% endif %}
32
+ {% if site.author.uri %}
33
+ </uri>{{ site.author.uri | xml_escape }}</uri>
34
+ {% elsif site.author.url %}
35
+ </uri>{{ site.author.url | xml_escape }}</uri>
36
+ {% endif %}
25
37
  </author>
26
38
  {% endif %}
27
39
 
@@ -30,14 +42,30 @@
30
42
  <title>{{ post.title | markdownify | strip_html | strip_newlines | xml_escape }}</title>
31
43
  <link href="{{ post.url | prepend: url_base }}" rel="alternate" type="text/html" title="{{ post.title | xml_escape }}" />
32
44
  <published>{{ post.date | date_to_xmlschema }}</published>
33
- <updated>{{ post.date | date_to_xmlschema }}</updated>
45
+ {% if post.last_modified_at %}
46
+ <updated>{{ post.last_modified_at | date_to_xmlschema }}</updated>
47
+ {% else %}
48
+ <updated>{{ post.date | date_to_xmlschema }}</updated>
49
+ {% endif %}
34
50
 
35
51
  <id>{{ post.id | prepend: url_base | xml_escape }}</id>
36
52
  <content type="html" xml:base="{{ post.url | prepend: url_base | xml_escape }}">{{ post.content | markdownify | xml_escape }}</content>
37
53
 
38
54
  {% if post.author %}
39
55
  <author>
56
+ {% if post.author.name %}
57
+ <name>{{ post.author.name | xml_escape }}</name>
58
+ {% else %}
40
59
  <name>{{ post.author | xml_escape }}</name>
60
+ {% endif %}
61
+ {% if post.author.email %}
62
+ <email>{{ post.author.email | xml_escape }}</email>
63
+ {% endif %}
64
+ {% if post.author.url %}
65
+ </uri>{{ post.author.url | xml_escape }}</uri>
66
+ {% elsif post.author.url %}
67
+ </uri>{{ post.author.url | xml_escape }}</uri>
68
+ {% endif %}
41
69
  </author>
42
70
  {% endif %}
43
71
 
@@ -1,5 +1,8 @@
1
1
  timezone: UTC
2
2
 
3
+ gems:
4
+ - jekyll-last-modified-at
5
+
3
6
  defaults:
4
7
  -
5
8
  scope:
@@ -1,4 +1,5 @@
1
1
  ---
2
+ author: Pat
2
3
  ---
3
4
 
4
5
  <pre>Line 1
@@ -0,0 +1,8 @@
1
+ ---
2
+ author:
3
+ name: Ben
4
+ uri: "http://ben.balter.com"
5
+ email: ben@example.com
6
+ ---
7
+
8
+ # December the twelfth, actually.
@@ -53,10 +53,26 @@ describe(Jekyll::JekyllFeed) do
53
53
  expect(contents).to match /Line 1\nLine 2\nLine 3/
54
54
  end
55
55
 
56
+ it "supports post author name as an object" do
57
+ expect(contents).to match /<author>\s*<name>Ben<\/name>\s*<email>ben@example.com<\/email>\s*<\/author>/
58
+ end
59
+
60
+ it "supports post author name as a string" do
61
+ expect(contents).to match /<author>\s*<name>Pat<\/name>\s*<\/author>/
62
+ end
63
+
64
+ it "does not output author tag no author is provided" do
65
+ expect(contents).not_to match /<author>\s*<name><\/name>\s*<\/author>/
66
+ end
67
+
56
68
  it "converts markdown posts to HTML" do
57
69
  expect(contents).to match /&lt;p&gt;March the second!&lt;\/p&gt;/
58
70
  end
59
71
 
72
+ it "converts uses last_modified_at where available" do
73
+ expect(contents).to match /<updated>2015-05-12T13:27:59\+00:00<\/updated>/
74
+ end
75
+
60
76
  context "parsing" do
61
77
  let(:feed) { RSS::Parser.parse(contents) }
62
78
 
@@ -76,7 +92,7 @@ describe(Jekyll::JekyllFeed) do
76
92
  end
77
93
 
78
94
  it "includes the items" do
79
- expect(feed.items.count).to eql(6)
95
+ expect(feed.items.count).to eql(7)
80
96
  end
81
97
 
82
98
  it "includes item contents" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-feed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-21 00:00:00.000000000 Z
11
+ date: 2015-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.6'
97
+ - !ruby/object:Gem::Dependency
98
+ name: jekyll-last-modified-at
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 0.3.4
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 0.3.4
97
111
  description:
98
112
  email:
99
113
  - ben.balter@github.com
@@ -126,6 +140,7 @@ files:
126
140
  - spec/fixtures/_posts/2014-05-11-exclude-this-post.md
127
141
  - spec/fixtures/_posts/2015-01-18-jekyll-last-modified-at.md
128
142
  - spec/fixtures/_posts/2015-05-12-pre.html
143
+ - spec/fixtures/_posts/2015-05-18-author-detail.md
129
144
  - spec/fixtures/feeds/atom.xml
130
145
  - spec/fixtures/images/hubot.png
131
146
  - spec/fixtures/index.html
@@ -173,6 +188,7 @@ test_files:
173
188
  - spec/fixtures/_posts/2014-05-11-exclude-this-post.md
174
189
  - spec/fixtures/_posts/2015-01-18-jekyll-last-modified-at.md
175
190
  - spec/fixtures/_posts/2015-05-12-pre.html
191
+ - spec/fixtures/_posts/2015-05-18-author-detail.md
176
192
  - spec/fixtures/feeds/atom.xml
177
193
  - spec/fixtures/images/hubot.png
178
194
  - spec/fixtures/index.html