planet 0.5.3 → 0.5.4

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: fc9853812a11a4693abf7bd40cb460904efb136c
4
- data.tar.gz: c85ae576b4f93b369a5f85fb4c2daa77c231e4ac
3
+ metadata.gz: 2bc71a4ca0c085c6d0bb470b6c0959d85a147459
4
+ data.tar.gz: 897d0fca5b14c0e472ae667c0fbf7bf428e2f4e1
5
5
  SHA512:
6
- metadata.gz: e657ce7a41137f5d88aac9c72ed02b6a037dfa1bb4d93f108e33f8e91f7a48ee09aab6695d304511693f1fd634d14822a1a2663b31cc39d2f5976e8c8c759736
7
- data.tar.gz: 9d918de83e623d4f60ff086660c2c16ea9844c36968e44a1aa86c952f36dce04b4d6b97b975c6ae8ec3877b68b0debb97aa99b1bf70e3f91208ba7bbe950c583
6
+ metadata.gz: 2c73c7b13cfc15fa982293285a1f4df2d6f28de8e4104df026f8f533fcd7b3e90d5ef9128b5184f9f6ce0e59b590606a55e77f2abe06abec8d2257ed976f207f
7
+ data.tar.gz: 3c144e476307381e2a7444059b3507dab3f3a8dad31e3ca181d1f87b8cda672274a7d186e2cbac2d297310e8d4549354ce2b0375f405b0c3eeee5f87cc77d96a
data/bin/planet CHANGED
@@ -154,6 +154,8 @@ title: "{{ post_title }}"
154
154
  kind: article
155
155
  created_at: {{ post_date }}
156
156
  author: {{ author }}
157
+ categories: {{ blog_categories }}
158
+ tags: {{ blog_tags }}
157
159
  layout: post
158
160
  ---
159
161
 
@@ -164,6 +166,7 @@ planet:
164
166
  posts_directory: source/_posts/
165
167
  templates_directory: source/_layouts/
166
168
  whitelisted_tags: []
169
+ sanitize_html: false
167
170
 
168
171
  blogs:
169
172
  # Bare minimum to get it working
@@ -176,4 +179,6 @@ blogs:
176
179
  image: "http://poteland.com/images/avatars/red_mage.png"
177
180
  # Other fields:
178
181
  twitter: "poteland"
182
+ categories: "programming"
183
+ tags: "go ruby jekyll git"
179
184
  url: "http://blog.poteland.com" # => only required for people that don\'t have a \'url\' field on their RSS/Atom field'
@@ -36,13 +36,15 @@ class Planet
36
36
  planet = config.fetch('planet', {})
37
37
  blogs = config.fetch('blogs', []).map do |blog|
38
38
  Blog.new(
39
- feed: blog['feed'],
40
- url: blog['url'],
41
- author: blog['author'],
42
- image: blog['image'],
43
- posts: [],
44
- planet: self,
45
- twitter: blog['twitter']
39
+ feed: blog['feed'],
40
+ url: blog['url'],
41
+ author: blog['author'],
42
+ image: blog['image'],
43
+ posts: [],
44
+ planet: self,
45
+ twitter: blog['twitter'],
46
+ categories: blog['categories'],
47
+ tags: blog['tags']
46
48
  )
47
49
  end
48
50
 
@@ -1,3 +1,4 @@
1
+ require 'sanitize'
1
2
  require 'planet/post'
2
3
  require 'planet/parsers'
3
4
 
@@ -12,19 +13,23 @@ class Planet
12
13
  :image,
13
14
  :twitter,
14
15
  :posts,
16
+ :categories,
17
+ :tags,
15
18
  :planet,
16
19
  :rss_data
17
20
 
18
21
  def initialize(attributes = {})
19
- self.url = attributes[:url]
20
- self.feed = attributes[:feed]
21
- self.type = attributes[:type]
22
- self.name = attributes[:name]
23
- self.author = attributes[:author]
24
- self.image = attributes[:image]
25
- self.twitter = attributes[:twitter]
26
- self.posts = attributes.fetch(:posts, [])
27
- self.planet = attributes[:planet]
22
+ self.url = attributes[:url]
23
+ self.feed = attributes[:feed]
24
+ self.type = attributes[:type]
25
+ self.name = attributes[:name]
26
+ self.author = attributes[:author]
27
+ self.image = attributes[:image]
28
+ self.twitter = attributes[:twitter]
29
+ self.posts = attributes.fetch(:posts, [])
30
+ self.planet = attributes[:planet]
31
+ self.categories = attributes.fetch(:categories, '')
32
+ self.tags = attributes.fetch(:tags, '')
28
33
 
29
34
  # Feedzirra parsed data is made available for when the information
30
35
  # provides is not enough. Transparency should help use cases we're
@@ -65,6 +70,10 @@ class Planet
65
70
  abort "=> No content found on entry"
66
71
  end
67
72
 
73
+ if self.planet.config.fetch('sanitize_html', false)
74
+ content = Sanitize.fragment(content, Sanitize::Config::RELAXED)
75
+ end
76
+
68
77
  self.posts << @post = Post.new(
69
78
  title: entry.title.nil? ? self.name : entry.title,
70
79
  content: content,
@@ -28,6 +28,8 @@ class Planet::Post
28
28
  blog_url: self.blog.url,
29
29
  blog_name: self.blog.name,
30
30
  blog_slug: self.blog.name.to_url(:limit => 50, :truncate_words => true),
31
+ blog_categories: self.blog.categories,
32
+ blog_tags: self.blog.tags,
31
33
  post_url: self.url,
32
34
  twitter: self.blog.twitter,
33
35
  twitter_url: "http://twitter.com/#{ self.blog.twitter }",
@@ -39,7 +41,6 @@ class Planet::Post
39
41
  alias_method :to_hash, :to_h
40
42
 
41
43
  def header
42
- ## TODO: We need categories/tags
43
44
  file = self.blog.planet.config.fetch('templates_directory', '_layouts/') + 'header.md'
44
45
  file_contents = File.read(file)
45
46
 
@@ -2,7 +2,7 @@ class Planet
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 5
5
- PATCH = 3
5
+ PATCH = 4
6
6
 
7
7
  def self.to_s
8
8
  [MAJOR, MINOR, PATCH].join('.')
metadata CHANGED
@@ -1,83 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: planet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - PoTe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-11 00:00:00.000000000 Z
11
+ date: 2014-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: feedjira
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mustache
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: box
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: stringex
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: sanitize
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  description:
@@ -88,15 +102,16 @@ extensions: []
88
102
  extra_rdoc_files: []
89
103
  files:
90
104
  - bin/planet
105
+ - lib/planet.rb
91
106
  - lib/planet/blog.rb
92
107
  - lib/planet/importer.rb
93
- - lib/planet/parsers/base_parser.rb
94
108
  - lib/planet/parsers.rb
109
+ - lib/planet/parsers/base_parser.rb
95
110
  - lib/planet/post.rb
96
111
  - lib/planet/version.rb
97
- - lib/planet.rb
98
112
  homepage: http://github.com/pote/planet.rb
99
- licenses: []
113
+ licenses:
114
+ - MIT
100
115
  metadata: {}
101
116
  post_install_message:
102
117
  rdoc_options: []
@@ -105,17 +120,17 @@ require_paths:
105
120
  - lib
106
121
  required_ruby_version: !ruby/object:Gem::Requirement
107
122
  requirements:
108
- - - '>='
123
+ - - ">="
109
124
  - !ruby/object:Gem::Version
110
125
  version: '0'
111
126
  required_rubygems_version: !ruby/object:Gem::Requirement
112
127
  requirements:
113
- - - '>='
128
+ - - ">="
114
129
  - !ruby/object:Gem::Version
115
130
  version: '0'
116
131
  requirements: []
117
132
  rubyforge_project:
118
- rubygems_version: 2.0.3
133
+ rubygems_version: 2.2.2
119
134
  signing_key:
120
135
  specification_version: 4
121
136
  summary: An rss/atom feed aggregator designed to work with Octopress/Jekyll