html2rss 0.5.0 → 0.5.1

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
  SHA256:
3
- metadata.gz: 803f570ac19ab526a065ab4514725b15e692f9fc3ead0516f337841afce35f20
4
- data.tar.gz: 887228a092ec286b5796b98ba92b32cb1391eab9abceee1d05dae042a8b607ac
3
+ metadata.gz: 97c8c553722b6f97745e1b9676a2325ecae229bc8871e6fc41681d030cb93a7e
4
+ data.tar.gz: 6aada0c4686051d8c77e1e7ea12d6bbcc7c3ae290221b04823fa96e475554de6
5
5
  SHA512:
6
- metadata.gz: 6526864907dd58f6a9add414e9db804a47c23c0d74907d8b055eeba020754c42d20bb97e5bd344925dbf87129fe4c73e97c6b79adb5eed687ad4f243d6bf7e74
7
- data.tar.gz: 392c4e2f690c7f7e5a3ed511780bc44bd36dde70e237cb524f5f6cb7515d044bd7cc052456763c09e789999063cf513b8bff4c0c99bfdc857a3769f6bd9fc2ad
6
+ metadata.gz: 3af18a4949147f9ff209cd4a668f4184e3f203873a6a28029a53839340cda2eceb614504cf1bf1a3a8a8b398578c1528b33d001c6190f3dbffaace0a8571aea8
7
+ data.tar.gz: 3973df6dfc80a5899b14407338faff71633874fe62c6c9b77ddeb4243a94917b1e9c249708f287afc7e17f884ebb3d0ce912661d34cb95c3e61ade81e5bfd630
@@ -1,4 +1,13 @@
1
- # [](https://github.com/gildesmarais/html2rss/compare/v0.5.0...v) (2019-09-18)
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
- 0. `git pull`
87
- 1. increase version in `lib/version.rb`
88
- 2. `bundle`
89
- 3. commit the changes
90
- 4. `git tag v....`
91
- 5. `git push; git push --tags`
92
- 6. update the changelog, commit and push
93
-
94
- ### Changelog generation
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`
@@ -43,12 +43,16 @@ module Html2rss
43
43
  global_config.fetch('headers', {})
44
44
  end
45
45
 
46
- def options(name)
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 = feed_config.fetch('selectors', {}).keys.map(&:to_s)
60
- attribute_names.delete('items')
61
- attribute_names
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
@@ -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.attribute_names.include?(method_name) || super
18
+ config.attribute?(method_name) || super
19
19
  end
20
20
 
21
21
  def method_missing(method_name, *_args)
22
- attribute_config = config.options(method_name.to_s)
23
- return super unless attribute_config
22
+ return super unless respond_to_missing?(method_name)
24
23
 
25
- extractor = ItemExtractors.get_extractor(attribute_config['extractor'])
26
- value = extractor.new(xml, attribute_config).get
24
+ attribute_options = config.attribute_options(method_name)
27
25
 
28
- post_process(value, attribute_config.fetch('post_process', false))
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
- [title.to_s, description.to_s].join('') != ''
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
  ##
@@ -1,3 +1,3 @@
1
1
  module Html2rss
2
- VERSION = '0.5.0'.freeze
2
+ VERSION = '0.5.1'.freeze
3
3
  end
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.0
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-18 00:00:00.000000000 Z
11
+ date: 2019-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport