Class: Asciidoctor::Diagram::AsciiToSvgConverter
Instance Method Summary
collapse
#generate_file, #generate_file_stdout, #generate_stdin, #generate_stdin_file, #generate_stdin_stdout
#wrap_source
Instance Method Details
#collect_options(source) ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/asciidoctor-diagram/a2s/converter.rb', line 16
def collect_options(source)
options = {}
options[:sx] = source.attr('scalex')
options[:sy] = source.attr('scaley')
options[:scale] = source.attr('scale')
options[:noblur] = source.attr('noblur') == 'true'
options[:font] = source.attr('fontfamily')
options
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
52
53
54
55
56
57
|
# File 'lib/asciidoctor-diagram/a2s/converter.rb', line 26
def convert(source, format, options)
return source.to_s if format == :txt
sx = options[:sx]
sy = options[:sy]
scale = options[:scale]
noblur = options[:noblur]
font = options[:font]
generate_stdin(source.find_command('a2s'), format.to_s, source.to_s) do |tool_path, output_path|
args = [tool_path, '-o', Platform.native_path(output_path)]
if sx && sy
args << '-s' << "#{sx},#{sy}"
elsif scale
args << '-s' << "#{scale},#{scale}"
end
if noblur
args << '-b'
end
if font
args << '-f' << font
end
{
:args => args,
:chdir => source.base_dir
}
end
end
|
#native_scaling? ⇒ Boolean
59
60
61
|
# File 'lib/asciidoctor-diagram/a2s/converter.rb', line 59
def native_scaling?
true
end
|
12
13
14
|
# File 'lib/asciidoctor-diagram/a2s/converter.rb', line 12
def supported_formats
[:svg, :txt]
end
|