module Asciidoctor::Diagram

Constants

VERSION

Public Instance Methods

collect_options(source) click to toggle source
# File lib/asciidoctor-diagram/blockdiag/converter.rb, line 16
def collect_options(source)
  {
    :font_path => source.attr('fontpath')
  }
end
convert(source, format, options) click to toggle source
# File lib/asciidoctor-diagram/blockdiag/converter.rb, line 22
def convert(source, format, options)
  # On Debian based systems the Python 3.x packages python3-(act|block|nw|seq)diag executables with
  # a '3' suffix.
  cmd_name = self.class.const_get(:TOOL)
  alt_cmd_name = "#{cmd_name}3"

  font_path = options[:font_path]

  generate_stdin(source.find_command(cmd_name, :alt_cmds => [alt_cmd_name]), format.to_s, source.to_s) do |tool_path, output_path|
    args = [tool_path, '-a', '-o', Platform.native_path(output_path), "-T#{format.to_s}"]
    args << "-f#{Platform.native_path(font_path)}" if font_path
    args << '-'

    {
      :args => args,
      :chdir => source.base_dir
    }
  end
end
supported_formats() click to toggle source
# File lib/asciidoctor-diagram/blockdiag/converter.rb, line 12
def supported_formats
  [:png, :pdf, :svg]
end