html-pipeline-linuxfr 0.15.2 → 0.15.3

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
  SHA1:
3
- metadata.gz: 0fa4bbc1589f15bf804d1430b449c437a7f96bee
4
- data.tar.gz: adc4f934359904cc9571f195244feabd2d79a370
3
+ metadata.gz: d2b34c2e74c6d60c5f5e1c53507d723cb3d3880d
4
+ data.tar.gz: 714d3dcc7a085b4791ccb24c1dd75abac4cf1195
5
5
  SHA512:
6
- metadata.gz: 40c6ac2b8f3247745c241198c17ab261bce6145cbf7834c0fc5373e38207d557dd7001e5342e03b634c213843b57bad028c12582d75e2267da18fcf37037bb70
7
- data.tar.gz: f4f333d359168212e111e555a63ba4d18bd542d0a1f85d32c243efcb0db60fcb221bb7bb6b2553e016faad294529ce657431a4216e4cea4f9a82672a5ded59d7
6
+ metadata.gz: 9f6223e461419d3495de58275ad48cbf1c414ee5acd79bba2951137926cea8463cc7ed7502bd912904ccf8165d08b79303cac5b48e28b0b0f1e7b2563cd471b2
7
+ data.tar.gz: 5e059fff509bf5e14973f983953fb43a7586d4710d29f129750295d36766536319a59e5573bde53ea1f99594a18a7012480af37a7b8369bdab53a923322b32c3
@@ -16,7 +16,7 @@ module HTML
16
16
  IGNORE_PARENTS = %w(pre code a).to_set
17
17
 
18
18
  def call
19
- doc.search('text()').each do |node|
19
+ doc.search('.//text()').each do |node|
20
20
  content = node.to_html
21
21
  next if !content.include?('[[')
22
22
  next if has_ancestor?(node, IGNORE_PARENTS)
@@ -30,7 +30,7 @@ module HTML
30
30
  class InvalidDocumentException < StandardError; end
31
31
 
32
32
  def initialize(doc, context = nil, result = nil)
33
- if doc.kind_of?(String)
33
+ if doc.is_a?(String)
34
34
  @html = doc.to_str
35
35
  @doc = nil
36
36
  else
@@ -76,8 +76,7 @@ module HTML
76
76
  end
77
77
 
78
78
  # Make sure the context has everything we need. Noop: Subclasses can override.
79
- def validate
80
- end
79
+ def validate; end
81
80
 
82
81
  # The Repository object provided in the context hash, or nil when no
83
82
  # :repository was specified.
@@ -116,9 +115,7 @@ module HTML
116
115
  # Returns true when the node has a matching ancestor.
117
116
  def has_ancestor?(node, tags)
118
117
  while node = node.parent
119
- if tags.include?(node.name.downcase)
120
- break true
121
- end
118
+ break true if tags.include?(node.name.downcase)
122
119
  end
123
120
  end
124
121
 
@@ -134,7 +131,7 @@ module HTML
134
131
  # the last filter returns a String.
135
132
  def self.to_document(input, context = nil)
136
133
  html = call(input, context)
137
- HTML::Pipeline::parse(html)
134
+ HTML::Pipeline.parse(html)
138
135
  end
139
136
 
140
137
  # Like call but guarantees that a string of HTML markup is returned.
@@ -158,7 +155,7 @@ module HTML
158
155
 
159
156
  if missing.any?
160
157
  raise ArgumentError,
161
- "Missing context keys for #{self.class.name}: #{missing.map(&:inspect).join ', '}"
158
+ "Missing context keys for #{self.class.name}: #{missing.map(&:inspect).join ', '}"
162
159
  end
163
160
  end
164
161
  end
@@ -50,14 +50,15 @@ module HTML
50
50
  # protocols, and transformers from WHITELIST but with a more locked down
51
51
  # set of allowed elements.
52
52
  LIMITED = WHITELIST.merge(
53
- :elements => %w(b i strong em a pre code img ins del sup sub p ol ul li))
53
+ elements: %w[b i strong em a pre code img ins del sup sub p ol ul li]
54
+ )
54
55
 
55
56
  # Strip all HTML tags from the document.
56
- FULL = { :elements => [] }
57
+ FULL = { elements: [] }.freeze
57
58
 
58
59
  # Sanitize markup using the Sanitize library.
59
60
  def call
60
- Sanitize.node!(doc, whitelist)
61
+ Sanitize.clean_node!(doc, whitelist)
61
62
  end
62
63
 
63
64
  # The whitelist to use when sanitizing. This can be passed in the context
@@ -1,5 +1,5 @@
1
1
  module HTML
2
2
  class Pipeline
3
- VERSION = "0.15.2"
3
+ VERSION = "0.15.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-pipeline-linuxfr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.2
4
+ version: 0.15.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Tomayko
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-11-03 00:00:00.000000000 Z
13
+ date: 2018-07-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
179
  version: '0'
180
180
  requirements: []
181
181
  rubyforge_project:
182
- rubygems_version: 2.5.2
182
+ rubygems_version: 2.5.2.1
183
183
  signing_key:
184
184
  specification_version: 4
185
185
  summary: Helpers for processing content through a chain of filters