jekyll-feed 0.13.0 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.markdown +32 -0
- data/README.md +48 -1
- data/lib/jekyll-feed/feed.xml +20 -5
- data/lib/jekyll-feed/generator.rb +30 -2
- data/lib/jekyll-feed/meta-tag.rb +5 -2
- data/lib/jekyll-feed/version.rb +1 -1
- metadata +13 -61
- data/.gitignore +0 -21
- data/.rspec +0 -2
- data/.rubocop.yml +0 -27
- data/.travis.yml +0 -32
- data/Gemfile +0 -11
- data/Rakefile +0 -8
- data/appveyor.yml +0 -29
- data/jekyll-feed.gemspec +0 -30
- data/script/bootstrap +0 -3
- data/script/cibuild +0 -7
- data/script/fmt +0 -10
- data/script/release +0 -7
- data/script/test +0 -4
- data/spec/fixtures/_collection/2018-01-01-collection-doc.md +0 -4
- data/spec/fixtures/_collection/2018-01-02-collection-category-doc.md +0 -5
- data/spec/fixtures/_config.yml +0 -9
- data/spec/fixtures/_data/authors.yml +0 -5
- data/spec/fixtures/_drafts/2015-01-12-a-draft.md +0 -4
- data/spec/fixtures/_layouts/some_default.html +0 -11
- data/spec/fixtures/_posts/2013-12-12-dec-the-second.md +0 -7
- data/spec/fixtures/_posts/2014-03-02-march-the-second.md +0 -6
- data/spec/fixtures/_posts/2014-03-04-march-the-fourth.md +0 -9
- data/spec/fixtures/_posts/2015-01-18-jekyll-last-modified-at.md +0 -5
- data/spec/fixtures/_posts/2015-02-12-strip-newlines.md +0 -6
- data/spec/fixtures/_posts/2015-05-12-liquid.md +0 -7
- data/spec/fixtures/_posts/2015-05-12-pre.html +0 -8
- data/spec/fixtures/_posts/2015-05-18-author-detail.md +0 -9
- data/spec/fixtures/_posts/2015-08-08-stuck-in-the-middle.html +0 -6
- data/spec/fixtures/_posts/2016-04-25-author-reference.md +0 -6
- data/spec/fixtures/feed.xslt.xml +0 -0
- data/spec/jekyll-feed_spec.rb +0 -524
- data/spec/spec_helper.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8f1fde42e53f27b048363aa57f03f5d51a3f68fbe6af4e0ffb69209b373ffeb
|
4
|
+
data.tar.gz: aaaa1c370f29527e3806c6753ae76a2fa8297337f0e667f25fd43d05779fcfef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6800a223adf7b8c6ae236d6b9d3e355d4ca31c7d2e67752cfd2cb5b3fe599ddda2d9c6f28a38a7c6d5e648ac67ca585fe6fe2a2e08f38c158a1b6a95ded11fd7
|
7
|
+
data.tar.gz: a17bf5e936302721494bba9028ccda96ca88a4e229e0b1c88e6abe63f1ee2c60e3992296da05721d30400952fcc0ccafe4a2bd179038553ee57d3c940a1d04e9
|
data/History.markdown
CHANGED
@@ -1,3 +1,35 @@
|
|
1
|
+
## HEAD
|
2
|
+
|
3
|
+
## 0.15.1 / 2020-10-04
|
4
|
+
|
5
|
+
### Bug Fixes
|
6
|
+
|
7
|
+
* MetaTag: when encoding for XML special characters, handle non-string objects (#326)
|
8
|
+
|
9
|
+
## 0.15.0 / 2020-07-10
|
10
|
+
|
11
|
+
### Minor Enhancements
|
12
|
+
|
13
|
+
* Add support for drafts (#316)
|
14
|
+
|
15
|
+
## 0.14.0 / 2020-06-24
|
16
|
+
|
17
|
+
### Minor Enhancements
|
18
|
+
|
19
|
+
* add support for categories (#153) (#233)
|
20
|
+
* add support for tags (#264)
|
21
|
+
* Make posts limit configurable (#314)
|
22
|
+
* XML escape the title field of feed_meta (#306)
|
23
|
+
|
24
|
+
### Bug Fixes
|
25
|
+
|
26
|
+
* Fix feed link when post title contains HTML (#305)
|
27
|
+
|
28
|
+
### Development Fixes
|
29
|
+
|
30
|
+
* Use Dir to list source files (#309)
|
31
|
+
* Require Ruby >=2.4.0 (#307)
|
32
|
+
|
1
33
|
## 0.13.0 / 2019-11-13
|
2
34
|
|
3
35
|
### Minor Enhancements
|
data/README.md
CHANGED
@@ -134,7 +134,7 @@ Jekyll's `smartify` filter uses [kramdown](https://kramdown.gettalong.org/option
|
|
134
134
|
|
135
135
|
### Custom styling
|
136
136
|
|
137
|
-
Want to style what your feed looks like in the browser?
|
137
|
+
Want to style what your feed looks like in the browser? When a XSLT Styleheet file named `feed.xslt.xml` exists at the root of your repository, a link to this stylesheet is added to the generated feed.
|
138
138
|
|
139
139
|
## Why Atom, and not RSS?
|
140
140
|
|
@@ -151,6 +151,15 @@ feed:
|
|
151
151
|
- updates
|
152
152
|
```
|
153
153
|
|
154
|
+
## Posts limit
|
155
|
+
|
156
|
+
By default the plugin limits the number of posts in the feed to 10. Simply define a new limit in your config:
|
157
|
+
|
158
|
+
```yml
|
159
|
+
feed:
|
160
|
+
posts_limit: 20
|
161
|
+
```
|
162
|
+
|
154
163
|
## Collections
|
155
164
|
|
156
165
|
Jekyll Feed can generate feeds for collections other than the Posts collection. This works best for chronological collections (e.g., collections with dates in the filenames). Simply define which collections you'd like feeds for in your config:
|
@@ -196,6 +205,44 @@ feed:
|
|
196
205
|
The same flag can be used directly in post file. It will be disable `<content>` tag for selected post.
|
197
206
|
Settings in post file has higher priority than in config file.
|
198
207
|
|
208
|
+
## Tags
|
209
|
+
|
210
|
+
To automatically generate feeds for each tag you apply to your posts you can add a tags setting to your config:
|
211
|
+
|
212
|
+
```yml
|
213
|
+
feed:
|
214
|
+
tags: true
|
215
|
+
```
|
216
|
+
|
217
|
+
If there are tags you don't want included in this auto generation you can exclude them
|
218
|
+
|
219
|
+
```yml
|
220
|
+
feed:
|
221
|
+
tags:
|
222
|
+
except:
|
223
|
+
- tag-to-exclude
|
224
|
+
- another-tag
|
225
|
+
```
|
226
|
+
|
227
|
+
If you wish to change the location of these auto generated feeds (`/feed/by_tag/<TAG>.xml` by default) you can provide an alternative folder for them to live in.
|
228
|
+
|
229
|
+
```yml
|
230
|
+
feed:
|
231
|
+
tags:
|
232
|
+
path: "alternative/path/for/tags/feeds/"
|
233
|
+
```
|
234
|
+
|
235
|
+
If you only want to generate feeds for a few tags you can also set this.
|
236
|
+
|
237
|
+
```yml
|
238
|
+
feed:
|
239
|
+
tags:
|
240
|
+
only:
|
241
|
+
- tag-to-include
|
242
|
+
- another-tag
|
243
|
+
```
|
244
|
+
|
245
|
+
Note that if you include a tag that is excluded a feed will not be generated for it.
|
199
246
|
|
200
247
|
## Contributing
|
201
248
|
|
data/lib/jekyll-feed/feed.xml
CHANGED
@@ -39,14 +39,25 @@
|
|
39
39
|
</author>
|
40
40
|
{% endif %}
|
41
41
|
|
42
|
-
{%
|
42
|
+
{% if page.tags %}
|
43
|
+
{% assign posts = site.tags[page.tags] %}
|
44
|
+
{% else %}
|
45
|
+
{% assign posts = site[page.collection] %}
|
46
|
+
{% endif %}
|
43
47
|
{% if page.category %}
|
44
|
-
{% assign posts = posts | where: "category",page.category %}
|
48
|
+
{% assign posts = posts | where: "category", page.category %}
|
45
49
|
{% endif %}
|
46
|
-
{%
|
50
|
+
{% unless site.show_drafts %}
|
51
|
+
{% assign posts = posts | where_exp: "post", "post.draft != true" %}
|
52
|
+
{% endunless %}
|
53
|
+
{% assign posts = posts | sort: "date" | reverse %}
|
54
|
+
{% assign posts_limit = site.feed.posts_limit | default: 10 %}
|
55
|
+
{% for post in posts limit: posts_limit %}
|
47
56
|
<entry{% if post.lang %}{{" "}}xml:lang="{{ post.lang }}"{% endif %}>
|
48
|
-
|
49
|
-
|
57
|
+
{% assign post_title = post.title | smartify | strip_html | normalize_whitespace | xml_escape %}
|
58
|
+
|
59
|
+
<title type="html">{{ post_title }}</title>
|
60
|
+
<link href="{{ post.url | absolute_url }}" rel="alternate" type="text/html" title="{{ post_title }}" />
|
50
61
|
<published>{{ post.date | date_to_xmlschema }}</published>
|
51
62
|
<updated>{{ post.last_modified_at | default: post.date | date_to_xmlschema }}</updated>
|
52
63
|
<id>{{ post.id | absolute_url | xml_escape }}</id>
|
@@ -73,6 +84,10 @@
|
|
73
84
|
|
74
85
|
{% if post.category %}
|
75
86
|
<category term="{{ post.category | xml_escape }}" />
|
87
|
+
{% elsif post.categories %}
|
88
|
+
{% for category in post.categories %}
|
89
|
+
<category term="{{ category | xml_escape }}" />
|
90
|
+
{% endfor %}
|
76
91
|
{% endif %}
|
77
92
|
|
78
93
|
{% for tag in post.tags %}
|
@@ -17,6 +17,7 @@ module JekyllFeed
|
|
17
17
|
@site.pages << make_page(path, :collection => name, :category => category)
|
18
18
|
end
|
19
19
|
end
|
20
|
+
generate_feed_by_tag if config["tags"] && !@site.tags.empty?
|
20
21
|
end
|
21
22
|
|
22
23
|
private
|
@@ -69,6 +70,32 @@ module JekyllFeed
|
|
69
70
|
@collections
|
70
71
|
end
|
71
72
|
|
73
|
+
def generate_feed_by_tag
|
74
|
+
tags_config = config["tags"]
|
75
|
+
tags_config = {} unless tags_config.is_a?(Hash)
|
76
|
+
|
77
|
+
except = tags_config["except"] || []
|
78
|
+
only = tags_config["only"] || @site.tags.keys
|
79
|
+
tags_pool = only - except
|
80
|
+
tags_path = tags_config["path"] || "/feed/by_tag/"
|
81
|
+
|
82
|
+
generate_tag_feed(tags_pool, tags_path)
|
83
|
+
end
|
84
|
+
|
85
|
+
def generate_tag_feed(tags_pool, tags_path)
|
86
|
+
tags_pool.each do |tag|
|
87
|
+
# allow only tags with basic alphanumeric characters and underscore to keep
|
88
|
+
# feed path simple.
|
89
|
+
next if %r![^a-zA-Z0-9_]!.match?(tag)
|
90
|
+
|
91
|
+
Jekyll.logger.info "Jekyll Feed:", "Generating feed for posts tagged #{tag}"
|
92
|
+
path = "#{tags_path}#{tag}.xml"
|
93
|
+
next if file_exists?(path)
|
94
|
+
|
95
|
+
@site.pages << make_page(path, :tags => tag)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
72
99
|
# Path to feed.xml template file
|
73
100
|
def feed_source_path
|
74
101
|
@feed_source_path ||= File.expand_path "feed.xml", __dir__
|
@@ -85,7 +112,7 @@ module JekyllFeed
|
|
85
112
|
|
86
113
|
# Generates contents for a file
|
87
114
|
|
88
|
-
def make_page(file_path, collection: "posts", category: nil)
|
115
|
+
def make_page(file_path, collection: "posts", category: nil, tags: nil)
|
89
116
|
PageWithoutAFile.new(@site, __dir__, "", file_path).tap do |file|
|
90
117
|
file.content = feed_template
|
91
118
|
file.data.merge!(
|
@@ -93,7 +120,8 @@ module JekyllFeed
|
|
93
120
|
"sitemap" => false,
|
94
121
|
"xsl" => file_exists?("feed.xslt.xml"),
|
95
122
|
"collection" => collection,
|
96
|
-
"category" => category
|
123
|
+
"category" => category,
|
124
|
+
"tags" => tags
|
97
125
|
)
|
98
126
|
file.output
|
99
127
|
end
|
data/lib/jekyll-feed/meta-tag.rb
CHANGED
@@ -7,8 +7,11 @@ module JekyllFeed
|
|
7
7
|
|
8
8
|
def render(context)
|
9
9
|
@context = context
|
10
|
-
attrs = attributes.map
|
11
|
-
|
10
|
+
attrs = attributes.map do |k, v|
|
11
|
+
v = v.to_s unless v.respond_to?(:encode)
|
12
|
+
%(#{k}=#{v.encode(:xml => :attr)})
|
13
|
+
end
|
14
|
+
"<link #{attrs.join(" ")} />"
|
12
15
|
end
|
13
16
|
|
14
17
|
private
|
data/lib/jekyll-feed/version.rb
CHANGED
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.
|
4
|
+
version: 0.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Balter
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -120,59 +120,30 @@ dependencies:
|
|
120
120
|
- - "<"
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '2.0'
|
123
|
-
description:
|
123
|
+
description:
|
124
124
|
email:
|
125
125
|
- ben.balter@github.com
|
126
126
|
executables: []
|
127
127
|
extensions: []
|
128
|
-
extra_rdoc_files:
|
128
|
+
extra_rdoc_files:
|
129
|
+
- README.md
|
130
|
+
- History.markdown
|
131
|
+
- LICENSE.txt
|
129
132
|
files:
|
130
|
-
- ".gitignore"
|
131
|
-
- ".rspec"
|
132
|
-
- ".rubocop.yml"
|
133
|
-
- ".travis.yml"
|
134
|
-
- Gemfile
|
135
133
|
- History.markdown
|
136
134
|
- LICENSE.txt
|
137
135
|
- README.md
|
138
|
-
- Rakefile
|
139
|
-
- appveyor.yml
|
140
|
-
- jekyll-feed.gemspec
|
141
136
|
- lib/jekyll-feed.rb
|
142
137
|
- lib/jekyll-feed/feed.xml
|
143
138
|
- lib/jekyll-feed/generator.rb
|
144
139
|
- lib/jekyll-feed/meta-tag.rb
|
145
140
|
- lib/jekyll-feed/page-without-a-file.rb
|
146
141
|
- lib/jekyll-feed/version.rb
|
147
|
-
- script/bootstrap
|
148
|
-
- script/cibuild
|
149
|
-
- script/fmt
|
150
|
-
- script/release
|
151
|
-
- script/test
|
152
|
-
- spec/fixtures/_collection/2018-01-01-collection-doc.md
|
153
|
-
- spec/fixtures/_collection/2018-01-02-collection-category-doc.md
|
154
|
-
- spec/fixtures/_config.yml
|
155
|
-
- spec/fixtures/_data/authors.yml
|
156
|
-
- spec/fixtures/_drafts/2015-01-12-a-draft.md
|
157
|
-
- spec/fixtures/_layouts/some_default.html
|
158
|
-
- spec/fixtures/_posts/2013-12-12-dec-the-second.md
|
159
|
-
- spec/fixtures/_posts/2014-03-02-march-the-second.md
|
160
|
-
- spec/fixtures/_posts/2014-03-04-march-the-fourth.md
|
161
|
-
- spec/fixtures/_posts/2015-01-18-jekyll-last-modified-at.md
|
162
|
-
- spec/fixtures/_posts/2015-02-12-strip-newlines.md
|
163
|
-
- spec/fixtures/_posts/2015-05-12-liquid.md
|
164
|
-
- spec/fixtures/_posts/2015-05-12-pre.html
|
165
|
-
- spec/fixtures/_posts/2015-05-18-author-detail.md
|
166
|
-
- spec/fixtures/_posts/2015-08-08-stuck-in-the-middle.html
|
167
|
-
- spec/fixtures/_posts/2016-04-25-author-reference.md
|
168
|
-
- spec/fixtures/feed.xslt.xml
|
169
|
-
- spec/jekyll-feed_spec.rb
|
170
|
-
- spec/spec_helper.rb
|
171
142
|
homepage: https://github.com/jekyll/jekyll-feed
|
172
143
|
licenses:
|
173
144
|
- MIT
|
174
145
|
metadata: {}
|
175
|
-
post_install_message:
|
146
|
+
post_install_message:
|
176
147
|
rdoc_options: []
|
177
148
|
require_paths:
|
178
149
|
- lib
|
@@ -180,34 +151,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
180
151
|
requirements:
|
181
152
|
- - ">="
|
182
153
|
- !ruby/object:Gem::Version
|
183
|
-
version: 2.
|
154
|
+
version: 2.4.0
|
184
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
156
|
requirements:
|
186
157
|
- - ">="
|
187
158
|
- !ruby/object:Gem::Version
|
188
159
|
version: '0'
|
189
160
|
requirements: []
|
190
|
-
rubygems_version: 3.0.
|
191
|
-
signing_key:
|
161
|
+
rubygems_version: 3.0.3
|
162
|
+
signing_key:
|
192
163
|
specification_version: 4
|
193
164
|
summary: A Jekyll plugin to generate an Atom feed of your Jekyll posts
|
194
|
-
test_files:
|
195
|
-
- spec/fixtures/_collection/2018-01-01-collection-doc.md
|
196
|
-
- spec/fixtures/_collection/2018-01-02-collection-category-doc.md
|
197
|
-
- spec/fixtures/_config.yml
|
198
|
-
- spec/fixtures/_data/authors.yml
|
199
|
-
- spec/fixtures/_drafts/2015-01-12-a-draft.md
|
200
|
-
- spec/fixtures/_layouts/some_default.html
|
201
|
-
- spec/fixtures/_posts/2013-12-12-dec-the-second.md
|
202
|
-
- spec/fixtures/_posts/2014-03-02-march-the-second.md
|
203
|
-
- spec/fixtures/_posts/2014-03-04-march-the-fourth.md
|
204
|
-
- spec/fixtures/_posts/2015-01-18-jekyll-last-modified-at.md
|
205
|
-
- spec/fixtures/_posts/2015-02-12-strip-newlines.md
|
206
|
-
- spec/fixtures/_posts/2015-05-12-liquid.md
|
207
|
-
- spec/fixtures/_posts/2015-05-12-pre.html
|
208
|
-
- spec/fixtures/_posts/2015-05-18-author-detail.md
|
209
|
-
- spec/fixtures/_posts/2015-08-08-stuck-in-the-middle.html
|
210
|
-
- spec/fixtures/_posts/2016-04-25-author-reference.md
|
211
|
-
- spec/fixtures/feed.xslt.xml
|
212
|
-
- spec/jekyll-feed_spec.rb
|
213
|
-
- spec/spec_helper.rb
|
165
|
+
test_files: []
|
data/.gitignore
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
/vendor
|
2
|
-
/.bundle/
|
3
|
-
/.yardoc
|
4
|
-
/Gemfile.lock
|
5
|
-
/_yardoc/
|
6
|
-
/coverage/
|
7
|
-
/doc/
|
8
|
-
/pkg/
|
9
|
-
/spec/reports/
|
10
|
-
/tmp/
|
11
|
-
*.bundle
|
12
|
-
*.so
|
13
|
-
*.o
|
14
|
-
*.a
|
15
|
-
mkmf.log
|
16
|
-
*.gem
|
17
|
-
Gemfile.lock
|
18
|
-
spec/dest
|
19
|
-
.bundle
|
20
|
-
spec/fixtures/.jekyll-metadata
|
21
|
-
spec/fixtures/.jekyll-cache
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require: rubocop-jekyll
|
2
|
-
|
3
|
-
inherit_gem:
|
4
|
-
rubocop-jekyll: .rubocop.yml
|
5
|
-
|
6
|
-
AllCops:
|
7
|
-
TargetRubyVersion: 2.3
|
8
|
-
Include:
|
9
|
-
- lib/**/*.rb
|
10
|
-
|
11
|
-
Exclude:
|
12
|
-
- .gitignore
|
13
|
-
- .rspec
|
14
|
-
- .rubocop.yml
|
15
|
-
- .travis.yml
|
16
|
-
|
17
|
-
- Gemfile.lock
|
18
|
-
- History.markdown
|
19
|
-
- LICENSE.txt
|
20
|
-
- README.md
|
21
|
-
|
22
|
-
- script/**/*
|
23
|
-
- vendor/**/*
|
24
|
-
|
25
|
-
Naming/MemoizedInstanceVariableName:
|
26
|
-
Exclude:
|
27
|
-
- lib/jekyll-feed/page-without-a-file.rb
|
data/.travis.yml
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
rvm:
|
4
|
-
- &latest_ruby 2.6
|
5
|
-
- 2.4
|
6
|
-
- 2.3
|
7
|
-
env:
|
8
|
-
global:
|
9
|
-
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
10
|
-
matrix:
|
11
|
-
- JEKYLL_VERSION="~> 3.8"
|
12
|
-
matrix:
|
13
|
-
include:
|
14
|
-
- rvm: *latest_ruby
|
15
|
-
env: JEKYLL_VERSION="~> 3.7.4"
|
16
|
-
- rvm: *latest_ruby
|
17
|
-
env: JEKYLL_VERSION=">= 4.0.0.pre.alpha1"
|
18
|
-
before_install:
|
19
|
-
- gem update --system
|
20
|
-
- gem install bundler
|
21
|
-
before_script: bundle update
|
22
|
-
script: script/cibuild
|
23
|
-
notifications:
|
24
|
-
email: false
|
25
|
-
deploy:
|
26
|
-
provider: rubygems
|
27
|
-
api_key:
|
28
|
-
secure: qz0q6ur0kGo03jjLdoAak6WcEAwxX2r9LG3DVrhOrcfoFipkuW+uwR0et4tpK8uFrz0P9y7eTIKOb0XCXeIsIXWj6R5benpRGr2U8m9A+tE/jxviBFUaxaokte0lqWiX1fEyhRmW3zvcdLQ47Vd2EwTNaq6ZmPulmEe9gS0rBQghyclakGlZ17LI7oGgiNL9SQ335Yqa1qJklTHYHbodWQ3Z07v7VN2jxqi3WH6NacT5gUGp5iCNCLLa8+jpKr4uONNIoy6/geAWdqtvgGUE8oTjIWDoJarrknJpqfx9Rd0KLDzkyneAigHDYPW60QtrE6GGpK/+TF1pF4DzdK2EgTWqGFnZf8ehfnxmtHVl2Xq/DPr6hS8Q/f+ut4ioMzBQxPD0hfh8/EOMYKsO8mOuOlYTiZXC7iuGyvFUOl2hnBgWA99t+I0NNB06qFp3ZxIjolEc3zjzc9f1a5HUXlEut5V8nqvCwbctNiTVpT8ZEWlsQlyRUnr9cIMUTEfLgQ+v6DnvAJBMO1EILq6liB5qfutjNhzhlREt7P/ZdppGsAzWpgt0q2PafqVoPe62WR3+/8Lj2ErMr034xSSqZVNcBS0mbdvW6k3jaABo1VJ4XuHm6/yDuemWzWb7kdG9/14+IIJMW1VuaWcmnCnB6gxjkCW3Dm2ftYiN7Rfn3AUz/nU=
|
29
|
-
gem: jekyll-feed
|
30
|
-
on:
|
31
|
-
tags: true
|
32
|
-
repo: jekyll/jekyll-feed
|
data/Gemfile
DELETED
data/Rakefile
DELETED
data/appveyor.yml
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
version: "{build}"
|
2
|
-
clone_depth: 5
|
3
|
-
build: off
|
4
|
-
|
5
|
-
environment:
|
6
|
-
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
|
7
|
-
JEKYLL_VERSION: "~> 3.8"
|
8
|
-
matrix:
|
9
|
-
- RUBY_FOLDER_VER: "26"
|
10
|
-
JEKYLL_VERSION : "~> 3.7.4"
|
11
|
-
- RUBY_FOLDER_VER: "26"
|
12
|
-
JEKYLL_VERSION : ">= 4.0.0.pre.alpha1"
|
13
|
-
- RUBY_FOLDER_VER: "26"
|
14
|
-
- RUBY_FOLDER_VER: "24"
|
15
|
-
- RUBY_FOLDER_VER: "23"
|
16
|
-
|
17
|
-
install:
|
18
|
-
- SET PATH=C:\Ruby%RUBY_FOLDER_VER%-x64\bin;%PATH%
|
19
|
-
- bundle install --retry 5 --jobs=%NUMBER_OF_PROCESSORS% --clean --path vendor\bundle
|
20
|
-
|
21
|
-
test_script:
|
22
|
-
- ruby --version
|
23
|
-
- gem --version
|
24
|
-
- bundler --version
|
25
|
-
- bash ./script/test
|
26
|
-
|
27
|
-
cache:
|
28
|
-
# If one of the files after the right arrow changes, cache will be invalidated
|
29
|
-
- 'vendor\bundle -> appveyor.yml, Gemfile, jekyll-feed.gemspec'
|
data/jekyll-feed.gemspec
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
lib = File.expand_path("lib", __dir__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require "jekyll-feed/version"
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec|
|
8
|
-
spec.name = "jekyll-feed"
|
9
|
-
spec.version = Jekyll::Feed::VERSION
|
10
|
-
spec.authors = ["Ben Balter"]
|
11
|
-
spec.email = ["ben.balter@github.com"]
|
12
|
-
spec.summary = "A Jekyll plugin to generate an Atom feed of your Jekyll posts"
|
13
|
-
spec.homepage = "https://github.com/jekyll/jekyll-feed"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.test_files = spec.files.grep(%r!^spec/!)
|
18
|
-
spec.require_paths = ["lib"]
|
19
|
-
|
20
|
-
spec.required_ruby_version = ">= 2.3.0"
|
21
|
-
|
22
|
-
spec.add_dependency "jekyll", ">= 3.7", "< 5.0"
|
23
|
-
|
24
|
-
spec.add_development_dependency "bundler"
|
25
|
-
spec.add_development_dependency "nokogiri", "~> 1.6"
|
26
|
-
spec.add_development_dependency "rake", "~> 12.0"
|
27
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
-
spec.add_development_dependency "rubocop-jekyll", "~> 0.5"
|
29
|
-
spec.add_development_dependency "typhoeus", ">= 0.7", "< 2.0"
|
30
|
-
end
|
data/script/bootstrap
DELETED
data/script/cibuild
DELETED
data/script/fmt
DELETED
data/script/release
DELETED
data/script/test
DELETED
data/spec/fixtures/_config.yml
DELETED
data/spec/fixtures/feed.xslt.xml
DELETED
File without changes
|
data/spec/jekyll-feed_spec.rb
DELETED
@@ -1,524 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe(JekyllFeed) do
|
6
|
-
let(:overrides) { {} }
|
7
|
-
let(:config) do
|
8
|
-
Jekyll.configuration(Jekyll::Utils.deep_merge_hashes({
|
9
|
-
"full_rebuild" => true,
|
10
|
-
"source" => source_dir,
|
11
|
-
"destination" => dest_dir,
|
12
|
-
"show_drafts" => true,
|
13
|
-
"url" => "http://example.org",
|
14
|
-
"name" => "My awesome site",
|
15
|
-
"author" => {
|
16
|
-
"name" => "Dr. Jekyll",
|
17
|
-
},
|
18
|
-
"collections" => {
|
19
|
-
"my_collection" => { "output" => true },
|
20
|
-
"other_things" => { "output" => false },
|
21
|
-
},
|
22
|
-
}, overrides))
|
23
|
-
end
|
24
|
-
let(:site) { Jekyll::Site.new(config) }
|
25
|
-
let(:contents) { File.read(dest_dir("feed.xml")) }
|
26
|
-
let(:context) { make_context(:site => site) }
|
27
|
-
let(:feed_meta) { Liquid::Template.parse("{% feed_meta %}").render!(context, {}) }
|
28
|
-
before(:each) do
|
29
|
-
site.process
|
30
|
-
end
|
31
|
-
|
32
|
-
it "has no layout" do
|
33
|
-
expect(contents).not_to match(%r!\ATHIS IS MY LAYOUT!)
|
34
|
-
end
|
35
|
-
|
36
|
-
it "creates a feed.xml file" do
|
37
|
-
expect(Pathname.new(dest_dir("feed.xml"))).to exist
|
38
|
-
end
|
39
|
-
|
40
|
-
it "doesn't have multiple new lines or trailing whitespace" do
|
41
|
-
expect(contents).to_not match %r!\s+\n!
|
42
|
-
expect(contents).to_not match %r!\n{2,}!
|
43
|
-
end
|
44
|
-
|
45
|
-
it "puts all the posts in the feed.xml file" do
|
46
|
-
expect(contents).to match "http://example.org/updates/jekyll/2014/03/04/march-the-fourth.html"
|
47
|
-
expect(contents).to match "http://example.org/news/2014/03/02/march-the-second.html"
|
48
|
-
expect(contents).to match "http://example.org/news/2013/12/12/dec-the-second.html"
|
49
|
-
expect(contents).to match "http://example.org/2015/08/08/stuck-in-the-middle.html"
|
50
|
-
expect(contents).to_not match "http://example.org/2016/02/09/a-draft.html"
|
51
|
-
end
|
52
|
-
|
53
|
-
it "does not include assets or any static files that aren't .html" do
|
54
|
-
expect(contents).not_to match "http://example.org/images/hubot.png"
|
55
|
-
expect(contents).not_to match "http://example.org/feeds/atom.xml"
|
56
|
-
end
|
57
|
-
|
58
|
-
it "preserves linebreaks in preformatted text in posts" do
|
59
|
-
expect(contents).to match "Line 1\nLine 2\nLine 3"
|
60
|
-
end
|
61
|
-
|
62
|
-
it "supports post author name as an object" do
|
63
|
-
expect(contents).to match %r!<author>\s*<name>Ben</name>\s*<email>ben@example\.com</email>\s*<uri>http://ben\.balter\.com</uri>\s*</author>!
|
64
|
-
end
|
65
|
-
|
66
|
-
it "supports post author name as a string" do
|
67
|
-
expect(contents).to match %r!<author>\s*<name>Pat</name>\s*</author>!
|
68
|
-
end
|
69
|
-
|
70
|
-
it "does not output author tag no author is provided" do
|
71
|
-
expect(contents).not_to match %r!<author>\s*<name></name>\s*</author>!
|
72
|
-
end
|
73
|
-
|
74
|
-
it "does use author reference with data from _data/authors.yml" do
|
75
|
-
expect(contents).to match %r!<author>\s*<name>Garth</name>\s*<email>example@mail\.com</email>\s*<uri>http://garthdb\.com</uri>\s*</author>!
|
76
|
-
end
|
77
|
-
|
78
|
-
it "converts markdown posts to HTML" do
|
79
|
-
expect(contents).to match %r!<p>March the second\!</p>!
|
80
|
-
end
|
81
|
-
|
82
|
-
it "uses last_modified_at where available" do
|
83
|
-
expect(contents).to match %r!<updated>2015-05-12T13:27:59\+00:00</updated>!
|
84
|
-
end
|
85
|
-
|
86
|
-
it "replaces newlines in posts to spaces" do
|
87
|
-
expect(contents).to match '<title type="html">The plugin will properly strip newlines.</title>'
|
88
|
-
end
|
89
|
-
|
90
|
-
it "renders Liquid inside posts" do
|
91
|
-
expect(contents).to match "Liquid is rendered."
|
92
|
-
expect(contents).not_to match "Liquid is not rendered."
|
93
|
-
end
|
94
|
-
|
95
|
-
context "images" do
|
96
|
-
let(:image1) { 'http://example.org/image.png' }
|
97
|
-
let(:image2) { 'https://cdn.example.org/absolute.png?h=188&w=250' }
|
98
|
-
let(:image3) { 'http://example.org/object-image.png' }
|
99
|
-
|
100
|
-
it "includes the item image" do
|
101
|
-
expect(contents).to include(%(<media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="#{image1}" />))
|
102
|
-
expect(contents).to include(%(<media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="#{image2}" />))
|
103
|
-
expect(contents).to include(%(<media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="#{image3}" />))
|
104
|
-
end
|
105
|
-
|
106
|
-
it "included media content for mail templates (Mailchimp)" do
|
107
|
-
expect(contents).to include(%(<media:content medium="image" url="#{image1}" xmlns:media="http://search.yahoo.com/mrss/" />))
|
108
|
-
expect(contents).to include(%(<media:content medium="image" url="#{image2}" xmlns:media="http://search.yahoo.com/mrss/" />))
|
109
|
-
expect(contents).to include(%(<media:content medium="image" url="#{image3}" xmlns:media="http://search.yahoo.com/mrss/" />))
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
context "parsing" do
|
114
|
-
let(:feed) { RSS::Parser.parse(contents) }
|
115
|
-
|
116
|
-
it "outputs an RSS feed" do
|
117
|
-
expect(feed.feed_type).to eql("atom")
|
118
|
-
expect(feed.feed_version).to eql("1.0")
|
119
|
-
expect(feed.encoding).to eql("UTF-8")
|
120
|
-
expect(feed.lang).to be_nil
|
121
|
-
expect(feed.valid?).to eql(true)
|
122
|
-
end
|
123
|
-
|
124
|
-
it "outputs the link" do
|
125
|
-
expect(feed.link.href).to eql("http://example.org/feed.xml")
|
126
|
-
end
|
127
|
-
|
128
|
-
it "outputs the generator" do
|
129
|
-
expect(feed.generator.content).to eql("Jekyll")
|
130
|
-
expect(feed.generator.version).to eql(Jekyll::VERSION)
|
131
|
-
end
|
132
|
-
|
133
|
-
it "includes the items" do
|
134
|
-
expect(feed.items.count).to eql(10)
|
135
|
-
end
|
136
|
-
|
137
|
-
it "includes item contents" do
|
138
|
-
post = feed.items.last
|
139
|
-
expect(post.title.content).to eql("Dec The Second")
|
140
|
-
expect(post.link.href).to eql("http://example.org/news/2013/12/12/dec-the-second.html")
|
141
|
-
expect(post.published.content).to eql(Time.parse("2013-12-12"))
|
142
|
-
end
|
143
|
-
|
144
|
-
it "includes the item's excerpt" do
|
145
|
-
post = feed.items.last
|
146
|
-
expect(post.summary.content).to eql("Foo")
|
147
|
-
end
|
148
|
-
|
149
|
-
it "doesn't include the item's excerpt if blank" do
|
150
|
-
post = feed.items.first
|
151
|
-
expect(post.summary).to be_nil
|
152
|
-
end
|
153
|
-
|
154
|
-
context "with site.lang set" do
|
155
|
-
lang = "en_US"
|
156
|
-
let(:overrides) { { "lang" => lang } }
|
157
|
-
it "outputs a valid feed" do
|
158
|
-
expect(feed.feed_type).to eql("atom")
|
159
|
-
expect(feed.feed_version).to eql("1.0")
|
160
|
-
expect(feed.encoding).to eql("UTF-8")
|
161
|
-
expect(feed.valid?).to eql(true)
|
162
|
-
end
|
163
|
-
|
164
|
-
it "outputs the correct language" do
|
165
|
-
expect(feed.lang).to eql(lang)
|
166
|
-
end
|
167
|
-
|
168
|
-
it "sets the language of entries" do
|
169
|
-
post = feed.items.first
|
170
|
-
expect(post.lang).to eql(lang)
|
171
|
-
end
|
172
|
-
|
173
|
-
it "renders the feed meta" do
|
174
|
-
expected = %r!<link href="http://example.org/" rel="alternate" type="text/html" hreflang="#{lang}" />!
|
175
|
-
expect(contents).to match(expected)
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
context "with site.title set" do
|
180
|
-
let(:site_title) { "My Site Title" }
|
181
|
-
let(:overrides) { { "title" => site_title } }
|
182
|
-
|
183
|
-
it "uses site.title for the title" do
|
184
|
-
expect(feed.title.content).to eql(site_title)
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
context "with site.name set" do
|
189
|
-
let(:site_name) { "My Site Name" }
|
190
|
-
let(:overrides) { { "name" => site_name } }
|
191
|
-
|
192
|
-
it "uses site.name for the title" do
|
193
|
-
expect(feed.title.content).to eql(site_name)
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
context "with site.name and site.title set" do
|
198
|
-
let(:site_title) { "My Site Title" }
|
199
|
-
let(:site_name) { "My Site Name" }
|
200
|
-
let(:overrides) { { "title" => site_title, "name" => site_name } }
|
201
|
-
|
202
|
-
it "uses site.title for the title, dropping site.name" do
|
203
|
-
expect(feed.title.content).to eql(site_title)
|
204
|
-
end
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
context "smartify" do
|
209
|
-
let(:site_title) { "Pat's Site" }
|
210
|
-
let(:overrides) { { "title" => site_title } }
|
211
|
-
let(:feed) { RSS::Parser.parse(contents) }
|
212
|
-
|
213
|
-
it "processes site title with SmartyPants" do
|
214
|
-
expect(feed.title.content).to eql("Pat’s Site")
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
context "validation" do
|
219
|
-
it "validates" do
|
220
|
-
skip "Typhoeus couldn't find the 'libcurl' module on Windows" if Gem.win_platform?
|
221
|
-
# See https://validator.w3.org/docs/api.html
|
222
|
-
url = "https://validator.w3.org/feed/check.cgi?output=soap12"
|
223
|
-
response = Typhoeus.post(url, :body => { :rawdata => contents }, :accept_encoding => "gzip")
|
224
|
-
pending "Something went wrong with the W3 validator" unless response.success?
|
225
|
-
result = Nokogiri::XML(response.body)
|
226
|
-
result.remove_namespaces!
|
227
|
-
|
228
|
-
result.css("warning").each do |warning|
|
229
|
-
# Quiet a warning that results from us passing the feed as a string
|
230
|
-
next if warning.css("text").text =~ %r!Self reference doesn't match document location!
|
231
|
-
|
232
|
-
# Quiet expected warning that results from blank summary test case
|
233
|
-
next if warning.css("text").text =~ %r!(content|summary) should not be blank!
|
234
|
-
|
235
|
-
# Quiet expected warning about multiple posts with same updated time
|
236
|
-
next if warning.css("text").text =~ %r!Two entries with the same value for atom:updated!
|
237
|
-
|
238
|
-
warn "Validation warning: #{warning.css("text").text} on line #{warning.css("line").text} column #{warning.css("column").text}"
|
239
|
-
end
|
240
|
-
|
241
|
-
errors = result.css("error").map do |error|
|
242
|
-
"Validation error: #{error.css("text").text} on line #{error.css("line").text} column #{error.css("column").text}"
|
243
|
-
end
|
244
|
-
|
245
|
-
expect(result.css("validity").text).to eql("true"), errors.join("\n")
|
246
|
-
end
|
247
|
-
end
|
248
|
-
|
249
|
-
context "with a baseurl" do
|
250
|
-
let(:overrides) do
|
251
|
-
{ "baseurl" => "/bass" }
|
252
|
-
end
|
253
|
-
|
254
|
-
it "correctly adds the baseurl to the posts" do
|
255
|
-
expect(contents).to match "http://example.org/bass/updates/jekyll/2014/03/04/march-the-fourth.html"
|
256
|
-
expect(contents).to match "http://example.org/bass/news/2014/03/02/march-the-second.html"
|
257
|
-
expect(contents).to match "http://example.org/bass/news/2013/12/12/dec-the-second.html"
|
258
|
-
end
|
259
|
-
|
260
|
-
it "renders the feed meta" do
|
261
|
-
expected = 'href="http://example.org/bass/feed.xml"'
|
262
|
-
expect(feed_meta).to include(expected)
|
263
|
-
end
|
264
|
-
end
|
265
|
-
|
266
|
-
context "feed meta" do
|
267
|
-
it "renders the feed meta" do
|
268
|
-
expected = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed.xml" title="My awesome site" />'
|
269
|
-
expect(feed_meta).to eql(expected)
|
270
|
-
end
|
271
|
-
|
272
|
-
context "with a blank site name" do
|
273
|
-
let(:config) do
|
274
|
-
Jekyll.configuration(
|
275
|
-
"source" => source_dir,
|
276
|
-
"destination" => dest_dir,
|
277
|
-
"url" => "http://example.org"
|
278
|
-
)
|
279
|
-
end
|
280
|
-
|
281
|
-
it "does not output blank title" do
|
282
|
-
expect(feed_meta).not_to include("title=")
|
283
|
-
end
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
|
-
context "changing the feed path" do
|
288
|
-
let(:overrides) do
|
289
|
-
{
|
290
|
-
"feed" => {
|
291
|
-
"path" => "atom.xml",
|
292
|
-
},
|
293
|
-
}
|
294
|
-
end
|
295
|
-
|
296
|
-
it "should write to atom.xml" do
|
297
|
-
expect(Pathname.new(dest_dir("atom.xml"))).to exist
|
298
|
-
end
|
299
|
-
|
300
|
-
it "renders the feed meta with custom feed path" do
|
301
|
-
expected = 'href="http://example.org/atom.xml"'
|
302
|
-
expect(feed_meta).to include(expected)
|
303
|
-
end
|
304
|
-
end
|
305
|
-
|
306
|
-
context "changing the file path via collection meta" do
|
307
|
-
let(:overrides) do
|
308
|
-
{
|
309
|
-
"feed" => {
|
310
|
-
"collections" => {
|
311
|
-
"posts" => {
|
312
|
-
"path" => "atom.xml",
|
313
|
-
},
|
314
|
-
},
|
315
|
-
},
|
316
|
-
}
|
317
|
-
end
|
318
|
-
|
319
|
-
it "should write to atom.xml" do
|
320
|
-
expect(Pathname.new(dest_dir("atom.xml"))).to exist
|
321
|
-
end
|
322
|
-
|
323
|
-
it "renders the feed meta with custom feed path" do
|
324
|
-
expected = 'href="http://example.org/atom.xml"'
|
325
|
-
expect(feed_meta).to include(expected)
|
326
|
-
end
|
327
|
-
end
|
328
|
-
|
329
|
-
context "feed stylesheet" do
|
330
|
-
it "includes the stylesheet" do
|
331
|
-
expect(contents).to include('<?xml-stylesheet type="text/xml" href="http://example.org/feed.xslt.xml"?>')
|
332
|
-
end
|
333
|
-
end
|
334
|
-
|
335
|
-
context "with site.lang set" do
|
336
|
-
let(:overrides) { { "lang" => "en-US" } }
|
337
|
-
|
338
|
-
it "should set the language" do
|
339
|
-
expect(contents).to match 'type="text/html" hreflang="en-US" />'
|
340
|
-
end
|
341
|
-
end
|
342
|
-
|
343
|
-
context "with post.lang set" do
|
344
|
-
it "should set the language for that entry" do
|
345
|
-
expect(contents).to match '<entry xml:lang="en">'
|
346
|
-
expect(contents).to match '<entry>'
|
347
|
-
end
|
348
|
-
end
|
349
|
-
|
350
|
-
context "categories" do
|
351
|
-
context "with top-level post categories" do
|
352
|
-
let(:overrides) do
|
353
|
-
{
|
354
|
-
"feed" => { "categories" => ["news"] },
|
355
|
-
}
|
356
|
-
end
|
357
|
-
let(:news_feed) { File.read(dest_dir("feed/news.xml")) }
|
358
|
-
|
359
|
-
it "outputs the primary feed" do
|
360
|
-
expect(contents).to match "http://example.org/updates/jekyll/2014/03/04/march-the-fourth.html"
|
361
|
-
expect(contents).to match "http://example.org/news/2014/03/02/march-the-second.html"
|
362
|
-
expect(contents).to match "http://example.org/news/2013/12/12/dec-the-second.html"
|
363
|
-
expect(contents).to match "http://example.org/2015/08/08/stuck-in-the-middle.html"
|
364
|
-
expect(contents).to_not match "http://example.org/2016/02/09/a-draft.html"
|
365
|
-
end
|
366
|
-
|
367
|
-
it "outputs the category feed" do
|
368
|
-
expect(news_feed).to match '<title type="html">My awesome site | News</title>'
|
369
|
-
expect(news_feed).to match "http://example.org/news/2014/03/02/march-the-second.html"
|
370
|
-
expect(news_feed).to match "http://example.org/news/2013/12/12/dec-the-second.html"
|
371
|
-
expect(news_feed).to_not match "http://example.org/updates/jekyll/2014/03/04/march-the-fourth.html"
|
372
|
-
expect(news_feed).to_not match "http://example.org/2015/08/08/stuck-in-the-middle.html"
|
373
|
-
end
|
374
|
-
end
|
375
|
-
|
376
|
-
context "with collection-level post categories" do
|
377
|
-
let(:overrides) do
|
378
|
-
{
|
379
|
-
"feed" => {
|
380
|
-
"collections" => {
|
381
|
-
"posts" => {
|
382
|
-
"categories" => ["news"],
|
383
|
-
},
|
384
|
-
},
|
385
|
-
},
|
386
|
-
}
|
387
|
-
end
|
388
|
-
let(:news_feed) { File.read(dest_dir("feed/news.xml")) }
|
389
|
-
|
390
|
-
it "outputs the primary feed" do
|
391
|
-
expect(contents).to match "http://example.org/updates/jekyll/2014/03/04/march-the-fourth.html"
|
392
|
-
expect(contents).to match "http://example.org/news/2014/03/02/march-the-second.html"
|
393
|
-
expect(contents).to match "http://example.org/news/2013/12/12/dec-the-second.html"
|
394
|
-
expect(contents).to match "http://example.org/2015/08/08/stuck-in-the-middle.html"
|
395
|
-
expect(contents).to_not match "http://example.org/2016/02/09/a-draft.html"
|
396
|
-
end
|
397
|
-
|
398
|
-
it "outputs the category feed" do
|
399
|
-
expect(news_feed).to match '<title type="html">My awesome site | News</title>'
|
400
|
-
expect(news_feed).to match "http://example.org/news/2014/03/02/march-the-second.html"
|
401
|
-
expect(news_feed).to match "http://example.org/news/2013/12/12/dec-the-second.html"
|
402
|
-
expect(news_feed).to_not match "http://example.org/updates/jekyll/2014/03/04/march-the-fourth.html"
|
403
|
-
expect(news_feed).to_not match "http://example.org/2015/08/08/stuck-in-the-middle.html"
|
404
|
-
end
|
405
|
-
end
|
406
|
-
end
|
407
|
-
|
408
|
-
context "collections" do
|
409
|
-
let(:collection_feed) { File.read(dest_dir("feed/collection.xml")) }
|
410
|
-
|
411
|
-
context "when initialized as an array" do
|
412
|
-
let(:overrides) do
|
413
|
-
{
|
414
|
-
"collections" => {
|
415
|
-
"collection" => {
|
416
|
-
"output" => true,
|
417
|
-
},
|
418
|
-
},
|
419
|
-
"feed" => { "collections" => ["collection"] },
|
420
|
-
}
|
421
|
-
end
|
422
|
-
|
423
|
-
it "outputs the collection feed" do
|
424
|
-
expect(collection_feed).to match '<title type="html">My awesome site | Collection</title>'
|
425
|
-
expect(collection_feed).to match "http://example.org/collection/2018-01-01-collection-doc.html"
|
426
|
-
expect(collection_feed).to match "http://example.org/collection/2018-01-02-collection-category-doc.html"
|
427
|
-
expect(collection_feed).to_not match "http://example.org/updates/jekyll/2014/03/04/march-the-fourth.html"
|
428
|
-
expect(collection_feed).to_not match "http://example.org/2015/08/08/stuck-in-the-middle.html"
|
429
|
-
end
|
430
|
-
end
|
431
|
-
|
432
|
-
context "with categories" do
|
433
|
-
let(:overrides) do
|
434
|
-
{
|
435
|
-
"collections" => {
|
436
|
-
"collection" => {
|
437
|
-
"output" => true,
|
438
|
-
},
|
439
|
-
},
|
440
|
-
"feed" => {
|
441
|
-
"collections" => {
|
442
|
-
"collection" => {
|
443
|
-
"categories" => ["news"],
|
444
|
-
},
|
445
|
-
},
|
446
|
-
},
|
447
|
-
}
|
448
|
-
end
|
449
|
-
let(:news_feed) { File.read(dest_dir("feed/collection/news.xml")) }
|
450
|
-
|
451
|
-
it "outputs the collection category feed" do
|
452
|
-
expect(news_feed).to match '<title type="html">My awesome site | Collection | News</title>'
|
453
|
-
expect(news_feed).to match "http://example.org/collection/2018-01-02-collection-category-doc.html"
|
454
|
-
expect(news_feed).to_not match "http://example.org/collection/2018-01-01-collection-doc.html"
|
455
|
-
expect(news_feed).to_not match "http://example.org/updates/jekyll/2014/03/04/march-the-fourth.html"
|
456
|
-
expect(news_feed).to_not match "http://example.org/2015/08/08/stuck-in-the-middle.html"
|
457
|
-
end
|
458
|
-
end
|
459
|
-
|
460
|
-
context "with a custom path" do
|
461
|
-
let(:overrides) do
|
462
|
-
{
|
463
|
-
"collections" => {
|
464
|
-
"collection" => {
|
465
|
-
"output" => true,
|
466
|
-
},
|
467
|
-
},
|
468
|
-
"feed" => {
|
469
|
-
"collections" => {
|
470
|
-
"collection" => {
|
471
|
-
"categories" => ["news"],
|
472
|
-
"path" => "custom.xml",
|
473
|
-
},
|
474
|
-
},
|
475
|
-
},
|
476
|
-
}
|
477
|
-
end
|
478
|
-
|
479
|
-
it "should write to the custom path" do
|
480
|
-
expect(Pathname.new(dest_dir("custom.xml"))).to exist
|
481
|
-
expect(Pathname.new(dest_dir("feed/collection.xml"))).to_not exist
|
482
|
-
expect(Pathname.new(dest_dir("feed/collection/news.xml"))).to exist
|
483
|
-
end
|
484
|
-
end
|
485
|
-
end
|
486
|
-
|
487
|
-
context "excerpt_only flag" do
|
488
|
-
context "backward compatibility for no excerpt_only flag" do
|
489
|
-
it "should be in contents" do
|
490
|
-
expect(contents).to match '<content '
|
491
|
-
end
|
492
|
-
end
|
493
|
-
|
494
|
-
context "when site.excerpt_only flag is true" do
|
495
|
-
let(:overrides) do
|
496
|
-
{ "feed" => { "excerpt_only" => true } }
|
497
|
-
end
|
498
|
-
|
499
|
-
it "should not set any contents" do
|
500
|
-
expect(contents).to_not match '<content '
|
501
|
-
end
|
502
|
-
end
|
503
|
-
|
504
|
-
context "when site.excerpt_only flag is false" do
|
505
|
-
let(:overrides) do
|
506
|
-
{ "feed" => { "excerpt_only" => false } }
|
507
|
-
end
|
508
|
-
|
509
|
-
it "should be in contents" do
|
510
|
-
expect(contents).to match '<content '
|
511
|
-
end
|
512
|
-
end
|
513
|
-
|
514
|
-
context "when post.excerpt_only flag is true" do
|
515
|
-
let(:overrides) do
|
516
|
-
{ "feed" => { "excerpt_only" => false } }
|
517
|
-
end
|
518
|
-
|
519
|
-
it "should not be in contents" do
|
520
|
-
expect(contents).to_not match "This content should not be in feed.</content>"
|
521
|
-
end
|
522
|
-
end
|
523
|
-
end
|
524
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "jekyll"
|
4
|
-
require "typhoeus" unless Gem.win_platform?
|
5
|
-
require "nokogiri"
|
6
|
-
require "rss"
|
7
|
-
require File.expand_path("../lib/jekyll-feed", __dir__)
|
8
|
-
|
9
|
-
Jekyll.logger.log_level = :error
|
10
|
-
|
11
|
-
RSpec.configure do |config|
|
12
|
-
config.run_all_when_everything_filtered = true
|
13
|
-
config.filter_run :focus
|
14
|
-
config.order = "random"
|
15
|
-
|
16
|
-
SOURCE_DIR = File.expand_path("fixtures", __dir__)
|
17
|
-
DEST_DIR = File.expand_path("dest", __dir__)
|
18
|
-
|
19
|
-
def source_dir(*files)
|
20
|
-
File.join(SOURCE_DIR, *files)
|
21
|
-
end
|
22
|
-
|
23
|
-
def dest_dir(*files)
|
24
|
-
File.join(DEST_DIR, *files)
|
25
|
-
end
|
26
|
-
|
27
|
-
def make_context(registers = {})
|
28
|
-
Liquid::Context.new({}, {}, { :site => site }.merge(registers))
|
29
|
-
end
|
30
|
-
end
|