14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/graphdown/renderable.rb', line 14
def block_code_with_graphdown(code, language)
if language == "dot"
if code =~ /digraph\s+(\w+)\s+{/
dot_path = Pathname.pwd.join("#{$1}.dot")
dot_path.open("wb") { |f| f.write(code) }
graph_path = Pathname.pwd.join("#{$1}.png")
generate_graph(dot_path.to_s, graph_path.to_s)
dot_path.delete
%(<img src="#{graph_path.to_s}"/>)
else
%(<img src="#"/>)
end
else
block_code_without_graphdown(code, language)
end
end
|