class Asciidoctor::Diagram::PikchrConverter

@private

Public Instance Methods

convert(source, format, options) click to toggle source
# File lib/asciidoctor-diagram/pikchr/converter.rb, line 17
def convert(source, format, options)
  pikchr_path = source.find_command('pikchr')

  output = generate_file_stdout(pikchr_path, format.to_s, source.to_s) do |tool_path, input_path|
    {
      :args => [tool_path, "--svg-only", input_path],
      :chdir => source.base_dir
    }
  end

  if output.start_with? '<svg'
    output
  else
    error = output.gsub(/<\/?[a-z]+>\n?/i, '')
    raise error
  end
end
supported_formats() click to toggle source
# File lib/asciidoctor-diagram/pikchr/converter.rb, line 13
def supported_formats
  [:svg]
end