html-pipeline-linuxfr 0.15.2 → 0.15.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2b34c2e74c6d60c5f5e1c53507d723cb3d3880d
|
4
|
+
data.tar.gz: 714d3dcc7a085b4791ccb24c1dd75abac4cf1195
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f6223e461419d3495de58275ad48cbf1c414ee5acd79bba2951137926cea8463cc7ed7502bd912904ccf8165d08b79303cac5b48e28b0b0f1e7b2563cd471b2
|
7
|
+
data.tar.gz: 5e059fff509bf5e14973f983953fb43a7586d4710d29f129750295d36766536319a59e5573bde53ea1f99594a18a7012480af37a7b8369bdab53a923322b32c3
|
data/lib/html/pipeline/filter.rb
CHANGED
@@ -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.
|
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
|
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
|
-
|
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
|
-
:
|
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 = { :
|
57
|
+
FULL = { elements: [] }.freeze
|
57
58
|
|
58
59
|
# Sanitize markup using the Sanitize library.
|
59
60
|
def call
|
60
|
-
Sanitize.
|
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
|
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.
|
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:
|
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
|