Class: Banzai::Filter::FrontMatterFilter
- Inherits:
-
HTML::Pipeline::Filter
- Object
- HTML::Pipeline::Filter
- Banzai::Filter::FrontMatterFilter
- Defined in:
- lib/banzai/filter/front_matter_filter.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/banzai/filter/front_matter_filter.rb', line 6 def call lang_mapping = Gitlab::FrontMatter::DELIM_LANG Gitlab::FrontMatter::PATTERN_UNTRUSTED_REGEX.replace_gsub(html) 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 |