Module: Asciidoctor::Diagram::Stupid

Includes:
CliGenerator, Which
Included in:
StupidBlockMacroProcessor, StupidBlockProcessor
Defined in:
lib/asciidoctor-diagram-stupid.rb,
lib/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CliGenerator

#generate, #generate_file, #generate_stdin

Class Method Details

.included(mod) ⇒ Object



74
75
76
77
78
79
80
# File 'lib/asciidoctor-diagram-stupid.rb', line 74

def self.included(mod)
    [:png, :svg].each do |f|
        mod.register_format(f, :image) do |parent, source|
            stupid(parent, source, f)
        end
    end
end

Instance Method Details

#stupid(parent, source, format) ⇒ Object



82
83
84
85
86
87
# File 'lib/asciidoctor-diagram-stupid.rb', line 82

def stupid(parent, source, format)
    generate_stdin(which(parent, 'stupid'), format.to_s, source.to_s) do |tool_path, output_path|
        args = [tool_path, 'render', format.to_s, Platform.native_path(output_path).chomp(".#{format.to_s}")]
        args
    end
end