Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gjtorikian/html-pipeline
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.0.0.pre5
Choose a base ref
...
head repository: gjtorikian/html-pipeline
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.0.0.pre6
Choose a head ref
  • 8 commits
  • 19 files changed
  • 2 contributors

Commits on Jun 5, 2023

  1. docs: update changelog

    actions-user committed Jun 5, 2023
    Copy the full SHA
    a2e02ac View commit details

Commits on Aug 16, 2023

  1. Have Zeitwerk not automatically load filters

    This causes problems if the underlying filter is not called, because
    Zeitwerk attempts to laod the required dependencies
    
    cf https://github.com/fxn/zeitwerk#use-case-the-adapter-pattern
    gjtorikian committed Aug 16, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    gjtorikian Garen Torikian
    Copy the full SHA
    5fec5a2 View commit details
  2. update dependency schedule

    gjtorikian committed Aug 16, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    gjtorikian Garen Torikian
    Copy the full SHA
    f71cb34 View commit details
  3. require filters in tests

    gjtorikian committed Aug 16, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    gjtorikian Garen Torikian
    Copy the full SHA
    3b013a8 View commit details
  4. lint

    gjtorikian committed Aug 16, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    gjtorikian Garen Torikian
    Copy the full SHA
    716e537 View commit details
  5. Merge pull request #383 from gjtorikian/ignore-dirs-for-zeitwerk

    Have Zeitwerk not automatically load filters
    gjtorikian authored Aug 16, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e848621 View commit details
  6. grumble

    gjtorikian committed Aug 16, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    gjtorikian Garen Torikian
    Copy the full SHA
    3d039d0 View commit details
  7. Copy the full SHA
    75578b5 View commit details
16 changes: 13 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -3,15 +3,25 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
interval: weekly
day: monday
time: "09:00"
timezone: "Etc/UTC"
groups:
github-actions:
patterns:
- "*"
open-pull-requests-limit: 10

- package-ecosystem: "bundler"
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
interval: weekly
day: monday
time: "09:00"
timezone: "Etc/UTC"
open-pull-requests-limit: 10
groups:
bundler-dependencies:
patterns:
- "*"
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ jobs:
uses: yettoapp/actions/.github/workflows/ruby_gem_release.yml@main
secrets:
rubygems_api_key: ${{ secrets.RUBYGEMS_API_BOT_KEY }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
gh_token: ${{ secrets.PUBLIC_PUSH_TO_PROTECTED_BRANCH }}
with:
gem_name: html-pipeline
version_filepath: lib/html_pipeline/version.rb
20 changes: 18 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
## [v3.0.0.pre6] - 16-08-2023
null
# Changelog

## [Unreleased](https://github.com/gjtorikian/html-pipeline/tree/HEAD)
## [v3.0.0.pre5](https://github.com/gjtorikian/html-pipeline/tree/v3.0.0.pre5) (2023-06-05)

[Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v3.0.0.pre3...HEAD)
[Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v3.0.0.pre4...v3.0.0.pre5)

## [v3.0.0.pre4](https://github.com/gjtorikian/html-pipeline/tree/v3.0.0.pre4) (2023-06-05)

[Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v3.0.0.pre3...v3.0.0.pre4)

**Closed issues:**

- Suggestion: add more tags to the sanitization filter [\#378](https://github.com/gjtorikian/html-pipeline/issues/378)
- v3 gemoji, gemojione seem required - is there a way to not require at puma startup? [\#376](https://github.com/gjtorikian/html-pipeline/issues/376)
- v3: Question regarding requiring a ConvertFilter if there are NodeFilters [\#374](https://github.com/gjtorikian/html-pipeline/issues/374)
- alt Attribute for Emoji Images Should Use Unicode [\#272](https://github.com/gjtorikian/html-pipeline/issues/272)

**Merged pull requests:**

- Update gemoji requirement from ~\> 3.0 to ~\> 4.1 [\#382](https://github.com/gjtorikian/html-pipeline/pull/382) ([dependabot[bot]](https://github.com/apps/dependabot))
- Update rouge requirement from ~\> 3.1 to ~\> 4.1 [\#381](https://github.com/gjtorikian/html-pipeline/pull/381) ([dependabot[bot]](https://github.com/apps/dependabot))
- Add the AssetProxyFilter [\#379](https://github.com/gjtorikian/html-pipeline/pull/379) ([digitalmoksha](https://github.com/digitalmoksha))
- Update selma requirement from ~\> 0.0.1 to \>= 0.0.1, \< 0.2.0 [\#377](https://github.com/gjtorikian/html-pipeline/pull/377) ([dependabot[bot]](https://github.com/apps/dependabot))

## [v3.0.0.pre3](https://github.com/gjtorikian/html-pipeline/tree/v3.0.0.pre3) (2023-02-15)

20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -79,7 +79,7 @@ end

pipeline = HTMLPipeline.new(
text_filters: [HelloJohnnyFilter.new]
convert_filter: HTMLPipeline::ConvertFilter::MarkdownFilter.new),
convert_filter: HTMLPipeline::ConvertFilter::MarkdownFilter.new,
# note: next line is not needed as sanitization occurs by default;
# see below for more info
sanitization_config: HTMLPipeline::SanitizationFilter::DEFAULT_CONFIG,
@@ -126,8 +126,8 @@ context = {

# Pipeline used for user provided content on the web
MarkdownPipeline = HTMLPipeline.new (
text_filters: [HTMLPipeline::TextFilter::ImageMaxWidthFilter.new],
convert_filter: [HTMLPipeline::ConvertFilter::MarkdownFilter.new],
text_filters: [HTMLPipeline::TextFilter::ImageFilter.new],
convert_filter: HTMLPipeline::ConvertFilter::MarkdownFilter.new,
node_filters: [
HTMLPipeline::NodeFilter::HttpsFilter.new,HTMLPipeline::NodeFilter::MentionFilter.new,
], context: context)
@@ -137,7 +137,7 @@ MarkdownPipeline = HTMLPipeline.new (
HtmlEmailPipeline = HTMLPipeline.new(
text_filters: [
PlainTextInputFilter.new,
ImageMaxWidthFilter.new
ImageFilter.new
], {})
```

@@ -173,7 +173,7 @@ pipeline = HTMLPipeline.new \
text_filters: [
HTMLPipeline::MarkdownFilter,
],
convert_filter: [HTMLPipeline::ConvertFilter::MarkdownFilter.new],
convert_filter: HTMLPipeline::ConvertFilter::MarkdownFilter.new,
sanitization_config: ALLOWLIST

result = pipeline.call <<-CODE
@@ -201,7 +201,7 @@ pipeline = HTMLPipeline.new \
text_filters: [
HTMLPipeline::MarkdownFilter,
],
convert_filter: [HTMLPipeline::ConvertFilter::MarkdownFilter.new],
convert_filter: HTMLPipeline::ConvertFilter::MarkdownFilter.new,
sanitization_config: nil
```

@@ -267,6 +267,14 @@ gem "rouge"
When developing a custom filter, call `HTMLPipeline.require_dependency` at the start to ensure that the local machine has the necessary dependency. You can also use `HTMLPipeline.require_dependencies` to provide a list of dependencies to check.

On a similar note, you must manually require whichever filters you desire:

```ruby
require "html_pipeline" # must be included
require "html_pipeline/convert_filter/markdown_filter" # included because you want to use this filter
require "html_pipeline/node_filter/mention_filter" # included because you want to use this filter
```

## Documentation

Full reference documentation can be [found here](http://rubydoc.info/gems/html-pipeline/frames).
5 changes: 5 additions & 0 deletions lib/html_pipeline.rb
Original file line number Diff line number Diff line change
@@ -2,10 +2,15 @@

require "zeitwerk"
lib_dir = File.join(File.dirname(__dir__), "lib")
lib_html_pipeline_dir = File.join(File.dirname(__dir__), "lib", "html_pipeline")
gem_loader = Zeitwerk::Loader.for_gem
gem_loader.inflector.inflect(
"html_pipeline" => "HTMLPipeline",
)

gem_loader.ignore(File.join(lib_html_pipeline_dir, "convert_filter"))
gem_loader.ignore(File.join(lib_html_pipeline_dir, "node_filter"))
gem_loader.ignore(File.join(lib_html_pipeline_dir, "text_filter"))
gem_loader.ignore(File.join(lib_dir, "html-pipeline.rb"))
gem_loader.setup

2 changes: 1 addition & 1 deletion lib/html_pipeline/node_filter/emoji_filter.rb
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ class EmojiFilter < NodeFilter

# Build a regexp that matches all valid :emoji: names.
def after_initialize
@emoji_pattern ||= /:(#{emoji_names.map { |name| Regexp.escape(name) }.join('|')}):/
@emoji_pattern ||= /:(#{emoji_names.map { |name| Regexp.escape(name) }.join("|")}):/
end

def selector
2 changes: 1 addition & 1 deletion lib/html_pipeline/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

class HTMLPipeline
VERSION = "3.0.0.pre5"
VERSION = "3.0.0.pre6"
end
1 change: 1 addition & 0 deletions test/html_pipeline/convert_filter/markdown_filter_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "test_helper"
require "html_pipeline/convert_filter/markdown_filter"

MarkdownFilter = HTMLPipeline::ConvertFilter::MarkdownFilter

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "test_helper"
require "html_pipeline/node_filter/absolute_source_filter"

AbsoluteSourceFilter = HTMLPipeline::NodeFilter::AbsoluteSourceFilter
class HTMLPipeline
1 change: 1 addition & 0 deletions test/html_pipeline/node_filter/asset_proxy_filter_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "test_helper"
require "html_pipeline/node_filter/asset_proxy_filter"

class HTMLPipeline
class AssetProxyFilterTest < Minitest::Spec
1 change: 1 addition & 0 deletions test/html_pipeline/node_filter/emoji_filter_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "test_helper"
require "html_pipeline/node_filter/emoji_filter"

EmojiFilterFilter = HTMLPipeline::NodeFilter::EmojiFilter
class HTMLPipeline
1 change: 1 addition & 0 deletions test/html_pipeline/node_filter/https_filter_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "test_helper"
require "html_pipeline/node_filter/https_filter"

HttpsFilter = HTMLPipeline::NodeFilter::HttpsFilter

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "test_helper"
require "html_pipeline/node_filter/syntax_highlight_filter"

SyntaxHighlightFilter = HTMLPipeline::NodeFilter::SyntaxHighlightFilter

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "test_helper"
require "html_pipeline/node_filter/table_of_contents_filter"

class HTMLPipeline
class NodeFilter
1 change: 1 addition & 0 deletions test/html_pipeline/node_filter/team_mention_filter_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "test_helper"
require "html_pipeline/node_filter/team_mention_filter"

class HTMLPipeline
class TeamMentionFilterTest < Minitest::Test
1 change: 1 addition & 0 deletions test/html_pipeline/text_filter/image_filter_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "test_helper"
require "html_pipeline/text_filter/image_filter"

ImageFilter = HTMLPipeline::TextFilter::ImageFilter

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "test_helper"
require "html_pipeline/text_filter/plain_text_input_filter"

class HTMLPipeline
class PlainTextInputFilterTest < Minitest::Test
1 change: 1 addition & 0 deletions test/html_pipeline_test.rb
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

require "test_helper"
require "helpers/mocked_instrumentation_service"
require "html_pipeline/node_filter/image_max_width_filter"

class HTMLPipelineTest < Minitest::Test
def setup
1 change: 1 addition & 0 deletions test/sanitization_filter_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "test_helper"
require "html_pipeline/node_filter/mention_filter"

class HTMLPipeline
class SanitizationFilterTest < Minitest::Test