module Jekyll::Diagrams

Constants

VERSION

Public Class Methods

config_name() click to toggle source
# File lib/jekyll-diagrams.rb, line 27
def config_name
  'jekyll-diagrams'
end
default_error_mode() click to toggle source
# File lib/jekyll-diagrams.rb, line 35
def default_error_mode
  :warn
end
logger_topic() click to toggle source
# File lib/jekyll-diagrams.rb, line 31
def logger_topic
  'Jekyll Diagrams:'
end

Public Instance Methods

build_command(config) click to toggle source
# File lib/jekyll-diagrams/blockdiag/renderer.rb, line 20
def build_command(config)
  command = +"#{@diagram} -T svg --nodoctype"

  switches = self.class.const_get(:SWITCHES)

  switches.merge(config.slice(*switches.keys)).each do |switch, value|
    command << " --#{switch}" if value != false
  end

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

  command
end
render_svg(code, config) click to toggle source
# File lib/jekyll-diagrams/blockdiag/renderer.rb, line 12
def render_svg(code, config)
  command = build_command(config)

  render_with_tempfile(command, code) do |input, output|
    "#{input} -o #{output}"
  end
end