Class: Jekyll::Diagrams::SvgbobRenderer

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

Constant Summary collapse

CONFIGURATIONS =
%w[font-family font-size scale stroke-width].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



14
15
16
17
18
19
20
21
22
# File 'lib/jekyll-diagrams/svgbob/renderer.rb', line 14

def build_command(config)
  command = +'svgbob'

  CONFIGURATIONS.each do |conf|
    command << " --#{conf} #{config[conf]}" if config.key?(conf)
  end

  command
end

#render_svg(code, config) ⇒ Object



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

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

  render_with_stdin_stdout(command, code)
end