Class: Asciidoctor::Diagram::SyntraxConverter

Inherits:
Object
  • Object
show all
Includes:
CliGenerator, DiagramConverter
Defined in:
lib/asciidoctor-diagram/syntrax/converter.rb

Instance Method Summary collapse

Methods included from CliGenerator

#generate_file, #generate_file_stdout, #generate_stdin, #generate_stdin_file, #generate_stdin_stdout

Methods included from DiagramConverter

#wrap_source

Instance Method Details

#collect_options(source) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/asciidoctor-diagram/syntrax/converter.rb', line 17

def collect_options(source)
  {
      :heading => source.attr('heading'),
      :scale => source.attr('scale'),
      :transparent => source.attr('transparent'),
      :style => source.attr('style-file')
  }
end

#convert(source, format, options) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/asciidoctor-diagram/syntrax/converter.rb', line 26

def convert(source, format, options)
  generate_file(source.find_command('syntrax'), 'spec', format.to_s, source.to_s) do |tool_path, input_path, output_path|
    args = [tool_path, '-i', Platform.native_path(input_path), '-o', Platform.native_path(output_path)]

    title = options[:heading]
    if title
      args << '--title' << title
    end

    scale = options[:scale]
    if scale
      args << '--scale' << scale
    end

    transparent = options[:transparent]
    if transparent == 'true'
      args << '--transparent'
    end
    style = options[:style]
    if style
      args << '--style' << style
    end

    args
  end
end

#native_scaling?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/asciidoctor-diagram/syntrax/converter.rb', line 53

def native_scaling?
  true
end

#supported_formatsObject



13
14
15
# File 'lib/asciidoctor-diagram/syntrax/converter.rb', line 13

def supported_formats
  [:png, :svg]
end