html-pipeline 3.2.1 → 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 +4 -4
- data/.gitignore +1 -1
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -1
- data/README.md +0 -28
- data/lib/html_pipeline/node_filter/mention_filter.rb +2 -1
- data/lib/html_pipeline/node_filter/team_mention_filter.rb +2 -1
- data/lib/html_pipeline/version.rb +1 -1
- data/lib/html_pipeline.rb +14 -14
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ee767ba855fbce40027a79f0a7847c5455354efe01293d07dd5dfc4cf0ee915
|
4
|
+
data.tar.gz: 0210caf87e60730954c56005ef6cf372a1aad46b72f14554790799e9a3741ba3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcf817cc462caf0f082aac827c3959dba7aab1b988d072304c450415fdf763ee32d8e6974d95f856fa98bf1b2505115e9e75ee09b242fecb49db0d75dd7056a8
|
7
|
+
data.tar.gz: f4ba81e5b1acba6a6e22b799a2ac802a0ae67822371b9d351ae2d3e033f7495e93e1f64495a280104768453b5c9ed26be5bd7007a2bb95fe077274ce8b2fa524
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
# [v3.2.2] - 09-08-2024
|
2
|
+
## What's Changed
|
3
|
+
* Add support for @ prefix on MentionFilter base_url by @jeremysmithco in https://github.com/gjtorikian/html-pipeline/pull/411
|
4
|
+
* Bugfix: sanitization-only filters should still work by @gjtorikian in https://github.com/gjtorikian/html-pipeline/pull/414
|
5
|
+
|
6
|
+
## New Contributors
|
7
|
+
* @jeremysmithco made their first contribution in https://github.com/gjtorikian/html-pipeline/pull/411
|
8
|
+
|
9
|
+
**Full Changelog**: https://github.com/gjtorikian/html-pipeline/compare/v3.2.1...v3.2.2
|
1
10
|
# [v3.2.1] - 16-07-2024
|
2
11
|
## What's Changed
|
3
12
|
* Update commonmarker requirement from ~> 1.0.0.pre7 to ~> 1.1.2 in the bundler-dependencies group by @dependabot in https://github.com/gjtorikian/html-pipeline/pull/404
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -343,34 +343,6 @@ service.subscribe "call_text_filters.html_pipeline" do |event, start, ending, tr
|
|
343
343
|
end
|
344
344
|
```
|
345
345
|
|
346
|
-
## Third Party Extensions
|
347
|
-
|
348
|
-
If you have an idea for a filter, propose it as
|
349
|
-
[an issue](https://github.com/gjtorikian/html-pipeline/issues) first. This allows us to discuss
|
350
|
-
whether the filter is a common enough use case to belong in this gem, or should be
|
351
|
-
built as an external gem.
|
352
|
-
|
353
|
-
Here are some extensions people have built:
|
354
|
-
|
355
|
-
- [html-pipeline-asciidoc_filter](https://github.com/asciidoctor/html-pipeline-asciidoc_filter)
|
356
|
-
- [jekyll-html-pipeline](https://github.com/gjtorikian/jekyll-html-pipeline)
|
357
|
-
- [nanoc-html-pipeline](https://github.com/burnto/nanoc-html-pipeline)
|
358
|
-
- [html-pipeline-bitly](https://github.com/dewski/html-pipeline-bitly)
|
359
|
-
- [html-pipeline-cite](https://github.com/lifted-studios/html-pipeline-cite)
|
360
|
-
- [tilt-html-pipeline](https://github.com/bradgessler/tilt-html-pipeline)
|
361
|
-
- [html-pipeline-wiki-link'](https://github.com/lifted-studios/html-pipeline-wiki-link) - WikiMedia-style wiki links
|
362
|
-
- [task_list](https://github.com/github/task_list) - GitHub flavor Markdown Task List
|
363
|
-
- [html-pipeline-nico_link](https://github.com/rutan/html-pipeline-nico_link) - An HTMLPipeline filter for [niconico](http://www.nicovideo.jp) description links
|
364
|
-
- [html-pipeline-gitlab](https://gitlab.com/gitlab-org/html-pipeline-gitlab) - This gem implements various filters for html-pipeline used by GitLab
|
365
|
-
- [html-pipeline-youtube](https://github.com/st0012/html-pipeline-youtube) - An HTMLPipeline filter for YouTube links
|
366
|
-
- [html-pipeline-flickr](https://github.com/st0012/html-pipeline-flickr) - An HTMLPipeline filter for Flickr links
|
367
|
-
- [html-pipeline-vimeo](https://github.com/dlackty/html-pipeline-vimeo) - An HTMLPipeline filter for Vimeo links
|
368
|
-
- [html-pipeline-hashtag](https://github.com/mr-dxdy/html-pipeline-hashtag) - An HTMLPipeline filter for hashtags
|
369
|
-
- [html-pipeline-linkify_github](https://github.com/jollygoodcode/html-pipeline-linkify_github) - An HTMLPipeline filter to autolink GitHub urls
|
370
|
-
- [html-pipeline-redcarpet_filter](https://github.com/bmikol/html-pipeline-redcarpet_filter) - Render Markdown source text into Markdown HTML using Redcarpet
|
371
|
-
- [html-pipeline-typogruby_filter](https://github.com/bmikol/html-pipeline-typogruby_filter) - Add Typogruby text filters to your HTMLPipeline
|
372
|
-
- [korgi](https://github.com/jodeci/korgi) - HTMLPipeline filters for links to Rails resources
|
373
|
-
|
374
346
|
## FAQ
|
375
347
|
|
376
348
|
### 1. Why doesn't my pipeline work when there's no root element in the document?
|
@@ -115,7 +115,8 @@ class HTMLPipeline
|
|
115
115
|
result[:mentioned_usernames] |= [login]
|
116
116
|
|
117
117
|
url = base_url.dup
|
118
|
-
|
118
|
+
excluded_prefixes = %r{[/(?:~|@]\z}
|
119
|
+
url << "/" unless excluded_prefixes.match?(url)
|
119
120
|
|
120
121
|
"<a href=\"#{url << login}\" class=\"user-mention\">" \
|
121
122
|
"@#{login}" \
|
@@ -94,7 +94,8 @@ class HTMLPipeline
|
|
94
94
|
result[:mentioned_teams] |= [team]
|
95
95
|
|
96
96
|
url = base_url.dup
|
97
|
-
|
97
|
+
excluded_prefixes = %r{[/(?:~|@]\z}
|
98
|
+
url << "/" unless excluded_prefixes.match?(url)
|
98
99
|
|
99
100
|
"<a href=\"#{url << org}/#{team}\" class=\"team-mention\">" \
|
100
101
|
"@#{org}/#{team}" \
|
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? &&
|
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
|
158
|
-
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:
|
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
|
-
result[:output] = Selma::Rewriter.new(sanitizer: @sanitization_config,
|
187
|
-
end
|
188
|
-
|
186
|
+
result[:output] = Selma::Rewriter.new(sanitizer: @sanitization_config, options: rewriter_options).rewrite(html)
|
187
|
+
end
|
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
|
195
|
-
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
|
215
|
-
result
|
214
|
+
context:,
|
215
|
+
result:,
|
216
216
|
})
|
217
217
|
|
218
218
|
instrument("call_filter.html_pipeline", payload) do
|
219
|
-
filter.call(doc, context
|
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
|
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.
|
4
|
+
version: 3.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen J. Torikian
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selma
|
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
version: 3.3.22
|
113
113
|
requirements: []
|
114
114
|
rubygems_version: 3.4.6
|
115
|
-
signing_key:
|
115
|
+
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: Helpers for processing content through a chain of filters
|
118
118
|
test_files: []
|