Class: Banzai::Filter::FrontMatterFilter
- Inherits:
-
HTML::Pipeline::Filter
- Object
- HTML::Pipeline::Filter
- Banzai::Filter::FrontMatterFilter
- Includes:
- Concerns::PipelineTimingCheck
- Defined in:
- lib/banzai/filter/front_matter_filter.rb
Constant Summary
Constants included from Concerns::PipelineTimingCheck
Concerns::PipelineTimingCheck::MAX_PIPELINE_SECONDS
Instance Method Summary collapse
Methods included from Concerns::PipelineTimingCheck
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/banzai/filter/front_matter_filter.rb', line 8 def call lang_mapping = Gitlab::FrontMatter::DELIM_LANG Gitlab::FrontMatter::PATTERN_UNTRUSTED_REGEX .replace_gsub(html, limit: Banzai::Filter::FILTER_ITEM_LIMIT) do |match| lang = match[:lang].presence || lang_mapping[match[:delim]] before = match[:before] before = "\n#{before}" if match[:encoding].presence "#{before}```#{lang}:frontmatter\n#{match[:front_matter]}```\n" end end |