Class: Qiita::Markdown::Filters::Simplify
- Inherits:
-
HTML::Pipeline::Filter
- Object
- HTML::Pipeline::Filter
- Qiita::Markdown::Filters::Simplify
- Defined in:
- lib/qiita/markdown/filters/simplify.rb
Overview
A filter for simplifying document structure by removing complex markups (mainly block elements) and complex contents.
The logic of this filter is similar to the ‘FinalSanitizer` filter, but this does not use the `sanitize` gem internally for the following reasons:
-
Each filter should do only its own responsibility, and this filter is not for sanitization.
-
The ‘sanitize` gem automatically adds extra transformers even if we want to clean up only some elements, and they would be run in the `FinalSanitizer` filter later. github.com/rgrove/sanitize/blob/v3.1.2/lib/sanitize.rb#L77-L100
Constant Summary collapse
- SIMPLE_ELEMENTS =
%w[a b code em i ins q s samp span strike strong sub sup var]
- COMPLEX_CONTENT_ELEMENTS =
%w[table]
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
22 23 24 25 26 |
# File 'lib/qiita/markdown/filters/simplify.rb', line 22 def call remove_complex_contents clean_complex_markups doc end |