Class: Jekyll::Diagrams::PlantUMLRenderer

Inherits:
BasicRenderer show all
Defined in:
lib/jekyll-diagrams/plantuml/renderer.rb

Constant Summary collapse

XML_REGEX =
/^<\?xml([^>]|\n)*>\n?/.freeze

Instance Method Summary collapse

Methods inherited from BasicRenderer

#initialize, render, #render

Methods included from Rendering

render_with_command, render_with_stdin_stdout, render_with_tempfile

Constructor Details

This class inherits a constructor from Jekyll::Diagrams::BasicRenderer

Instance Method Details

#build_command(_config) ⇒ Object



15
16
17
18
19
20
# File 'lib/jekyll-diagrams/plantuml/renderer.rb', line 15

def build_command(_config)
  jar = Utils.vendor_path('plantuml.1.2020.1.jar')

  options = +Utils.run_jar(jar)
  options << ' -tsvg -pipe'
end

#render_svg(code, config) ⇒ Object



8
9
10
11
12
13
# File 'lib/jekyll-diagrams/plantuml/renderer.rb', line 8

def render_svg(code, config)
  command = build_command(config)

  svg = render_with_stdin_stdout(command, code)
  svg.sub!(XML_REGEX, '')
end