Skip to content

Commit

Permalink
Support inline dot/graphviz
Browse files Browse the repository at this point in the history
  • Loading branch information
plexus committed Jun 6, 2013
1 parent 2e335db commit e98fcd8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/impress_renderer.rb
Expand Up @@ -31,7 +31,16 @@ def hrule
end

def block_code code, lang
"<pre><code class='prettyprint #{lang}'>#{code}</code></pre>"
if lang == 'dot'
file = Tempfile.new(['mdpress','.dot'])
file << code
file.close
svg_file = file.path.gsub(%r{.*/},'')+'.svg'
puts `dot #{file.path} -Tsvg > ./presentation/#{svg_file}`
"<img src='#{svg_file}' />"
else
"<pre><code class='prettyprint #{lang}'>#{code}</code></pre>"
end
end

def codespan code
Expand Down Expand Up @@ -92,4 +101,3 @@ def doc_footer
}
end
end

0 comments on commit e98fcd8

Please sign in to comment.