Class: BlueDoc::SML::Rules::Plantuml

Inherits:
Base
  • Object
show all
Defined in:
lib/bluedoc/sml/rules/plantuml.rb

Constant Summary

Constants inherited from Base

Base::INDENT_PX

Class Method Summary collapse

Methods inherited from Base

to_text

Class Method Details

.match?(node) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/bluedoc/sml/rules/plantuml.rb', line 5

def self.match?(node)
  tag_name(node) == "plantuml"
end

.to_html(node, opts = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bluedoc/sml/rules/plantuml.rb', line 9

def self.to_html(node, opts = {})
  attrs = attributes(node)
  renderer = opts[:renderer]

  code = (attrs[:code] || "").strip
  return "" if code.blank?

  svg_code = BlueDoc::Plantuml.encode(code)
  nid_attr = name_by_attrs(attrs)
  %(<div#{nid_attr}><img src="#{renderer.config.plantuml_service_host}/svg/#{svg_code}" class="plantuml-image" /></div>)
end