Class: Asciidoctor::Diagram::VhsConverter
Instance Method Summary
collapse
#generate_file, #generate_file_stdout, #generate_stdin, #generate_stdin_file, #generate_stdin_stdout
#native_scaling?, #wrap_source
Instance Method Details
#collect_options(source) ⇒ Object
16
17
18
|
# File 'lib/asciidoctor-diagram/vhs/converter.rb', line 16
def collect_options(source)
{}
end
|
#convert(source, format, options) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/asciidoctor-diagram/vhs/converter.rb', line 20
def convert(source, format, options)
document = source.instance_variable_get(:@parent_block).document
safe_mode = document.safe
if safe_mode >= Asciidoctor::SafeMode::SAFE
raise "vhs diagram generation is not allowed in safe mode #{safe_mode}. vhs executes terminal commands and requires UNSAFE mode (0)."
end
generate_file(source.find_command('vhs'), 'tape', format.to_s, source.code) do |tool_path, input_path, output_path|
{
:args => [tool_path, Platform.native_path(input_path), '-o', Platform.native_path(output_path)],
:chdir => source.base_dir,
:encoding => Encoding::ASCII_8BIT
}
end
end
|
12
13
14
|
# File 'lib/asciidoctor-diagram/vhs/converter.rb', line 12
def supported_formats
[:gif, :svg] end
|