html2rss 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/README.md +9 -11
- data/lib/html2rss/config.rb +9 -5
- data/lib/html2rss/item.rb +12 -7
- data/lib/html2rss/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97c8c553722b6f97745e1b9676a2325ecae229bc8871e6fc41681d030cb93a7e
|
4
|
+
data.tar.gz: 6aada0c4686051d8c77e1e7ea12d6bbcc7c3ae290221b04823fa96e475554de6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3af18a4949147f9ff209cd4a668f4184e3f203873a6a28029a53839340cda2eceb614504cf1bf1a3a8a8b398578c1528b33d001c6190f3dbffaace0a8571aea8
|
7
|
+
data.tar.gz: 3973df6dfc80a5899b14407338faff71633874fe62c6c9b77ddeb4243a94917b1e9c249708f287afc7e17f884ebb3d0ce912661d34cb95c3e61ade81e5bfd630
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,13 @@
|
|
1
|
-
# [](https://github.com/gildesmarais/html2rss/compare/v0.5.
|
1
|
+
# [](https://github.com/gildesmarais/html2rss/compare/v0.5.1...v) (2019-09-19)
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
## [0.5.1](https://github.com/gildesmarais/html2rss/compare/v0.5.0...v0.5.1) (2019-09-19)
|
6
|
+
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
* rss contains additional categories ([#39](https://github.com/gildesmarais/html2rss/issues/39)) ([ed164ef](https://github.com/gildesmarais/html2rss/commit/ed164ef))
|
2
11
|
|
3
12
|
|
4
13
|
|
data/README.md
CHANGED
@@ -83,14 +83,12 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/gildes
|
|
83
83
|
|
84
84
|
## Releasing a new version
|
85
85
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
The `CHANGELOG.md` can be generated automatically with [`standard-changelog`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/standard-changelog).
|
86
|
+
1. `git pull`
|
87
|
+
2. increase version in `lib/html2rss/version.rb`
|
88
|
+
3. `bundle`
|
89
|
+
4. commit the changes
|
90
|
+
5. `git tag v....`
|
91
|
+
6. [`standard-changelog -f`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/standard-changelog)
|
92
|
+
7. `git add CHANGELOG.md && git commit --amend`
|
93
|
+
8. `git tag v.... -f`
|
94
|
+
9. `git push && git push --tags`
|
data/lib/html2rss/config.rb
CHANGED
@@ -43,12 +43,16 @@ module Html2rss
|
|
43
43
|
global_config.fetch('headers', {})
|
44
44
|
end
|
45
45
|
|
46
|
-
def
|
46
|
+
def attribute_options(name)
|
47
47
|
feed_config.dig('selectors').fetch(name, {}).merge('channel' => channel_config)
|
48
48
|
end
|
49
49
|
|
50
|
+
def attribute?(name)
|
51
|
+
attribute_names.include?(name.to_s)
|
52
|
+
end
|
53
|
+
|
50
54
|
def categories
|
51
|
-
feed_config.dig('selectors').fetch('categories', [])
|
55
|
+
feed_config.dig('selectors').fetch('categories', []).map(&:to_sym)
|
52
56
|
end
|
53
57
|
|
54
58
|
def selector(name)
|
@@ -56,9 +60,9 @@ module Html2rss
|
|
56
60
|
end
|
57
61
|
|
58
62
|
def attribute_names
|
59
|
-
attribute_names
|
60
|
-
|
61
|
-
|
63
|
+
@attribute_names ||= feed_config.fetch('selectors', {}).keys.map(&:to_s).tap do |attrs|
|
64
|
+
attrs.delete('items')
|
65
|
+
end
|
62
66
|
end
|
63
67
|
|
64
68
|
private
|
data/lib/html2rss/item.rb
CHANGED
@@ -15,17 +15,18 @@ module Html2rss
|
|
15
15
|
private_class_method :new
|
16
16
|
|
17
17
|
def respond_to_missing?(method_name, _include_private = false)
|
18
|
-
config.
|
18
|
+
config.attribute?(method_name) || super
|
19
19
|
end
|
20
20
|
|
21
21
|
def method_missing(method_name, *_args)
|
22
|
-
|
23
|
-
return super unless attribute_config
|
22
|
+
return super unless respond_to_missing?(method_name)
|
24
23
|
|
25
|
-
|
26
|
-
value = extractor.new(xml, attribute_config).get
|
24
|
+
attribute_options = config.attribute_options(method_name)
|
27
25
|
|
28
|
-
|
26
|
+
extractor = ItemExtractors.get_extractor(attribute_options['extractor'])
|
27
|
+
value = extractor.new(xml, attribute_options).get
|
28
|
+
|
29
|
+
post_process(value, attribute_options.fetch('post_process', false))
|
29
30
|
end
|
30
31
|
|
31
32
|
def available_attributes
|
@@ -33,8 +34,12 @@ module Html2rss
|
|
33
34
|
@config.attribute_names) - ['categories']
|
34
35
|
end
|
35
36
|
|
37
|
+
##
|
38
|
+
# At least a title or a description is required to be a valid RSS 2.0 item.
|
36
39
|
def valid?
|
37
|
-
|
40
|
+
title = self.title if config.attribute?(:title)
|
41
|
+
description = self.description if config.attribute?(:description)
|
42
|
+
[title, description].join != ''
|
38
43
|
end
|
39
44
|
|
40
45
|
##
|
data/lib/html2rss/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html2rss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gil Desmarais
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|