octopress-feeds 1.2.4 → 1.2.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: 32fe7ffd3a4d4a8b9e168653192cf322bc366ca5
4
- data.tar.gz: 79a174f7ee75a3c5c01f162d86baaa95e75a0799
3
+ metadata.gz: abd728ec448b8e141757d5f6182aae70a3e8556c
4
+ data.tar.gz: a5bf1c25a69d11bb40d633b7a159fe4080c673b2
5
5
  SHA512:
6
- metadata.gz: 3ef7adf155249df5cac2c22b002ee51360066cf544d3391e86459eee3d236cc5e68c2528708cc6726949c20b33478c95a26ffa080cf6bf46cb6505e94095c95c
7
- data.tar.gz: 7fc999ccdc6124362d2fa58c0897c03d411f523fa4d5a03134474e4bd69dc7ba0a8c34d924a69ca11632deb3f5500370476cd2373bfe31cd9aabea461d57eb65
6
+ metadata.gz: 0022830a0f430dd5ec1e3fb6f6d2d5f3139475eec936ea524eab0b9607645e9624cd8e7e3e5b8741697943fe2fa61fc3f6ba7018a242a0cb440c299d5a3b7ec6
7
+ data.tar.gz: 2e98b682b48988a9c3d34299471cfa0389f643a4c03959dd0515e74fda81dfd4c9e695e306e51ebfd59b2e226fafd441d6a3153822eea6f386746a3f894c7143
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.2.5 (2015-01-26)
4
+
5
+ - Fix: Feed excerpts work with linkblog and multilingual sites.
6
+ - Fix: Only add link and article feeds if octopress-linkblog is installed.
7
+
3
8
  ### 1.2.4 (2015-01-26)
4
9
 
5
10
  - Link and Article feeds are automatically added when linkblog plugin is added.
@@ -14,17 +14,17 @@
14
14
  </author>
15
15
  <content type="html" xml:base="{{ site.url | join_url: site.baseurl }}" xml:lang="{% return site.lang || 'en' %}">
16
16
  <![CDATA[
17
- {% if plugins.feeds.excerpts and post.linkpost == false %}
18
- {{ post.excerpt | full_urls }}
19
-
20
- {% if post.excerpted %}
21
- <p><a href="{{ post.url | canonical_url }}">Continue reading &rarr;</a></p>
22
- {% endif %}
23
- {% else %}
17
+ {% if plugins.feeds.excerpts == false or post.linkpost %}
24
18
  {{ post.content | full_urls }}
25
19
  {% if post.linkpost %}
26
20
  <p><a href="{{ post.url | canonical_url }}">&infin; Permalink</a></p>
27
21
  {% endif %}
22
+ {% else %}
23
+ {{ post.excerpt | full_urls }}
24
+
25
+ {% if post.excerpt != post.content %}
26
+ <p><a href="{{ post.url | canonical_url }}">Continue reading &rarr;</a></p>
27
+ {% endif %}
28
28
  {% endif %}
29
29
  ]]>
30
30
  </content>
@@ -6,5 +6,5 @@
6
6
  <id>{{ site.url | join_url: site.baseurl }}</id>
7
7
  <updated>{% feed_updated_date %}</updated>
8
8
  <generator uri="http://octopress.org/">Octopress</generator>
9
- <language>{{ site.lang }}</language>
9
+ <language>{% return site.lang || 'en' %}</language>
10
10
  <rights>Copyright © {{ site.time | date: '%Y' }}, {{ site.author | strip_html }}</rights>
@@ -3,4 +3,4 @@ permalink: /feed/articles/
3
3
  title: Articles Feed
4
4
  feed: true
5
5
  ---
6
- {% abort unless site.articles and site.articles.size > 0 %}{% include feeds:article-feed.xml %}
6
+ {% include feeds:article-feed.xml %}
@@ -3,4 +3,4 @@ permalink: /feed/links/
3
3
  title: Links Feed
4
4
  feed: true
5
5
  ---
6
- {% abort unless site.linkposts and site.linkposts.size > 0 %}{% include feeds:link-feed.xml %}
6
+ {% include feeds:link-feed.xml %}
@@ -4,68 +4,28 @@ require 'octopress-include-tag'
4
4
  require 'octopress-abort-tag'
5
5
  require 'octopress-return-tag'
6
6
  require 'octopress-date-format'
7
+ require 'octopress-feeds/tags'
7
8
 
8
- begin
9
- require 'octopress-linkblog'
10
- rescue LoadError; end
11
9
 
12
10
  module Octopress
13
11
  module Feeds
14
- class FeedTag < Liquid::Tag
15
- def render(context)
16
- context['site.pages'].dup \
17
- .select { |p| p.data['feed'] } \
18
- .sort_by { |p| p.url } \
19
- .sort_by { |p| p.url.size } \
20
- .map { |p| tag(p) } \
21
- .join("\n")
22
- end
23
-
24
- def tag(page)
25
- url = page.url.sub(File.basename(page.url), '')
26
-
27
- "<link href='#{url}' title='#{page_title(page)}' rel='alternate' type='application/atom+xml'>"
28
- end
12
+ class Plugin < Ink::Plugin
29
13
 
30
- def page_title(page)
31
- title = page.site.config['name'].dup || ''
32
- title << ': ' unless title.empty?
33
- title << page.data['title']
34
-
35
- title
36
- end
37
- end
14
+ def add_pages
15
+ super
38
16
 
39
- class FeedUpdatedTag < Liquid::Tag
40
- def render(context)
41
- feed = context['feed_type'] || 'posts'
42
- site = context['site']
43
-
44
- case feed
45
- when 'articles'
46
- posts = site['articles']
47
- when 'linkposts'
48
- posts = site['linkposts']
49
- else
50
- posts = site['posts']
51
- end
52
-
53
- if !posts.empty?
54
- post = posts.sort_by do |p|
55
- p.data['date_updated'] || p.date
56
- end.last
57
-
58
- post.data['date_updated_xml'] || post.data['date_xml']
17
+ # Remove linkblog pages if the octopress-linkblog plugin isn't installed
18
+ unless defined? Octopress::Linkblog
19
+ @pages.reject! do |p|
20
+ p.file =~ /(article|link)/
21
+ end
59
22
  end
60
23
  end
61
24
  end
62
25
  end
63
26
  end
64
27
 
65
- Liquid::Template.register_tag('feed_tag', Octopress::Feeds::FeedTag)
66
- Liquid::Template.register_tag('feed_updated_date', Octopress::Feeds::FeedUpdatedTag)
67
-
68
- Octopress::Ink.add_plugin({
28
+ Octopress::Ink::Plugins.register_plugin(Octopress::Feeds::Plugin, {
69
29
  name: "Octopress Feeds",
70
30
  slug: "feeds",
71
31
  gem: "octopress-feeds",
@@ -76,3 +36,4 @@ Octopress::Ink.add_plugin({
76
36
  website: "https://github.com/octopress/feeds"
77
37
  })
78
38
 
39
+
@@ -0,0 +1,56 @@
1
+ module Octopress
2
+ module Feeds
3
+ class FeedTag < Liquid::Tag
4
+ def render(context)
5
+ context['site.pages'].dup \
6
+ .select { |p| p.data['feed'] } \
7
+ .sort_by { |p| p.url } \
8
+ .sort_by { |p| p.url.size } \
9
+ .map { |p| tag(p) } \
10
+ .join("\n")
11
+ end
12
+
13
+ def tag(page)
14
+ url = page.url.sub(File.basename(page.url), '')
15
+
16
+ "<link href='#{url}' title='#{page_title(page)}' rel='alternate' type='application/atom+xml'>"
17
+ end
18
+
19
+ def page_title(page)
20
+ title = page.site.config['name'].dup || ''
21
+ title << ': ' unless title.empty?
22
+ title << page.data['title']
23
+
24
+ title
25
+ end
26
+ end
27
+
28
+ class FeedUpdatedTag < Liquid::Tag
29
+ def render(context)
30
+ feed = context['feed_type'] || 'posts'
31
+ site = context['site']
32
+
33
+ case feed
34
+ when 'articles'
35
+ posts = site['articles']
36
+ when 'linkposts'
37
+ posts = site['linkposts']
38
+ else
39
+ posts = site['posts']
40
+ end
41
+
42
+ if !posts.empty?
43
+ post = posts.sort_by do |p|
44
+ p.data['date_updated'] || p.date
45
+ end.last
46
+
47
+ post.data['date_updated_xml'] || post.data['date_xml']
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ Liquid::Template.register_tag('feed_tag', Octopress::Feeds::FeedTag)
55
+ Liquid::Template.register_tag('feed_updated_date', Octopress::Feeds::FeedUpdatedTag)
56
+
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module Feeds
3
- VERSION = "1.2.4"
3
+ VERSION = "1.2.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopress-feeds
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-26 00:00:00.000000000 Z
11
+ date: 2015-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octopress-ink
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: octopress-debugger
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
167
181
  description: A nice RSS feeds for Octopress and Jekyll sites.
168
182
  email:
169
183
  - brandon@imathis.com
@@ -184,6 +198,7 @@ files:
184
198
  - assets/pages/link-feed.xml
185
199
  - assets/pages/main-feed.xml
186
200
  - lib/octopress-feeds.rb
201
+ - lib/octopress-feeds/tags.rb
187
202
  - lib/octopress-feeds/version.rb
188
203
  homepage: https://github.com/octopress/feeds
189
204
  licenses: