html-pipeline 3.2.2 → 3.2.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
  SHA256:
3
- metadata.gz: 6e66a69a9e35bc5703f036d091740bdc654f98cfaf38870761797699ed28199b
4
- data.tar.gz: 7624bb08357fa9f358cb4947dbf5742916a3e620fa7db2d5296e9aba414e40f5
3
+ metadata.gz: 4ee767ba855fbce40027a79f0a7847c5455354efe01293d07dd5dfc4cf0ee915
4
+ data.tar.gz: 0210caf87e60730954c56005ef6cf372a1aad46b72f14554790799e9a3741ba3
5
5
  SHA512:
6
- metadata.gz: 19083c1093cf8908028e8ea5233c97005a25072b5d77e9c28368570d477ff09cba5f6ae78e93e3633b766b9dcaeccc7bd746aacecbfdf480cd467306b230c1af
7
- data.tar.gz: 74e3afc29616225353448945af5a3ee516a8cea67924e865edf89a65b92cf77d56196b2be50ccd6fce6d5d343ed4cc7181b3b6b7d2a146dbb281a1165ba66ef3
6
+ metadata.gz: bcf817cc462caf0f082aac827c3959dba7aab1b988d072304c450415fdf763ee32d8e6974d95f856fa98bf1b2505115e9e75ee09b242fecb49db0d75dd7056a8
7
+ data.tar.gz: f4ba81e5b1acba6a6e22b799a2ac802a0ae67822371b9d351ae2d3e033f7495e93e1f64495a280104768453b5c9ed26be5bd7007a2bb95fe077274ce8b2fa524
data/.rubocop.yml CHANGED
@@ -15,3 +15,6 @@ AllCops:
15
15
  - "vendor/**/*"
16
16
  - "tmp/**/*"
17
17
  - "test/progit/**/*"
18
+
19
+ ThreadSafety/ClassAndModuleAttributes:
20
+ Enabled: false
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class HTMLPipeline
4
- VERSION = "3.2.2"
4
+ VERSION = "3.2.3"
5
5
  end
data/lib/html_pipeline.rb CHANGED
@@ -122,7 +122,7 @@ class HTMLPipeline
122
122
 
123
123
  @convert_filter = convert_filter
124
124
 
125
- if @convert_filter.nil? && (!@text_filters.empty? && !@node_filters.empty?)
125
+ if @convert_filter.nil? && !@text_filters.empty? && !@node_filters.empty?
126
126
  raise InvalidFilterError, "Must provide `convert_filter` if `text_filters` and `node_filters` are also provided"
127
127
  elsif !@convert_filter.nil?
128
128
  validate_filter(@convert_filter, HTMLPipeline::ConvertFilter)
@@ -154,13 +154,13 @@ class HTMLPipeline
154
154
  if @text_filters.any?
155
155
  payload = default_payload({
156
156
  text_filters: @text_filters.map { |f| f.class.name },
157
- context: context,
158
- result: result,
157
+ context:,
158
+ result:,
159
159
  })
160
160
  instrument("call_text_filters.html_pipeline", payload) do
161
161
  result[:output] =
162
162
  @text_filters.inject(text) do |doc, filter|
163
- perform_filter(filter, doc, context: (filter.context || {}).merge(context), result: result)
163
+ perform_filter(filter, doc, context: (filter.context || {}).merge(context), result:)
164
164
  end
165
165
  end
166
166
  end
@@ -181,18 +181,18 @@ class HTMLPipeline
181
181
  },
182
182
  }
183
183
 
184
- if @node_filters.empty?
184
+ if @node_filters.empty? && !@sanitization_config.nil?
185
185
  instrument("sanitization.html_pipeline", payload) do
186
186
  result[:output] = Selma::Rewriter.new(sanitizer: @sanitization_config, options: rewriter_options).rewrite(html)
187
187
  end
188
- else
188
+ elsif @node_filters.any?
189
189
  instrument("call_node_filters.html_pipeline", payload) do
190
190
  @node_filters.each { |filter| filter.context = (filter.context || {}).merge(context) }
191
191
  result[:output] = Selma::Rewriter.new(sanitizer: @sanitization_config, handlers: @node_filters, options: rewriter_options).rewrite(html)
192
192
  payload = default_payload({
193
193
  node_filters: @node_filters.map { |f| f.class.name },
194
- context: context,
195
- result: result,
194
+ context:,
195
+ result:,
196
196
  })
197
197
  end
198
198
  end
@@ -211,18 +211,18 @@ class HTMLPipeline
211
211
  def perform_filter(filter, doc, context: {}, result: {})
212
212
  payload = default_payload({
213
213
  filter: filter.class.name,
214
- context: context,
215
- result: result,
214
+ context:,
215
+ result:,
216
216
  })
217
217
 
218
218
  instrument("call_filter.html_pipeline", payload) do
219
- filter.call(doc, context: context, result: result)
219
+ filter.call(doc, context:, result:)
220
220
  end
221
221
  end
222
222
 
223
223
  # Like call but guarantee the value returned is a string of HTML markup.
224
224
  def to_html(input, context: {}, result: {})
225
- result = call(input, context: context, result: result)
225
+ result = call(input, context:, result:)
226
226
  output = result[:output]
227
227
  if output.respond_to?(:to_html)
228
228
  output.to_html
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-pipeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.2
4
+ version: 3.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen J. Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-15 00:00:00.000000000 Z
11
+ date: 2025-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selma