Class: Jekyll::Diagrams::PlantUMLBlock

Inherits:
Block
  • Object
show all
Defined in:
lib/jekyll-diagrams/plantuml.rb

Instance Method Summary collapse

Methods inherited from Block

#read_config, #render, #wrap_class

Methods included from Util

#config_for, #diagrams_config, #vendor_path

Methods included from Renderer

#render_with_command, #render_with_stdin, #render_with_stdin_stdout, #render_with_stdout, #render_with_tempfile

Instance Method Details

#build_command(config) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/jekyll-diagrams/plantuml.rb', line 11

def build_command(config)
  options = 'java'
  options << ' -Djava.awt.headless=true'
  options << ' -jar '
  options << vendor_path('plantuml.1.2020.1.jar')
  options << ' -tsvg -pipe'
end

#render_svg(code, config) ⇒ Object



4
5
6
7
8
9
# File 'lib/jekyll-diagrams/plantuml.rb', line 4

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

  svg = render_with_stdin_stdout(command, code)
  svg.sub!(/^<\?xml([^>]|\n)*>\n?/, '')
end