Class: Banzai::Filter::PlantumlFilter

Inherits:
HTML::Pipeline::Filter
  • Object
show all
Defined in:
lib/banzai/filter/plantuml_filter.rb

Overview

HTML that replaces all `code plantuml` tags with PlantUML img tags.

Instance Method Summary collapse

Instance Method Details

#callObject


11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/banzai/filter/plantuml_filter.rb', line 11

def call
  return doc unless doc.at('pre > code[lang="plantuml"]') && settings.plantuml_enabled

  plantuml_setup

  doc.css('pre > code[lang="plantuml"]').each do |node|
    img_tag = Nokogiri::HTML::DocumentFragment.parse(
      Asciidoctor::PlantUml::Processor.plantuml_content(node.content, {}))
    node.parent.replace(img_tag)
  end

  doc
end