Permalink
Browse files

Allow various sizes for the dot/graphviz stuff, and include google an…

…alytics
  • Loading branch information...
plexus committed Jun 25, 2013
1 parent 324243d commit 2acb0ab0b3407c301f8ee7c8f2be11f0c1d1c591
Showing with 14 additions and 2 deletions.
  1. +14 −2 lib/impress_renderer.rb
View
@@ -54,12 +54,13 @@ def hrule
end
def block_code code, lang
if lang == 'dot'
if lang =~ /^dot/
_, size = lang.split('-')
file = Tempfile.new(['mdpress','.dot'])
file << code
file.close
"<div class='dot-wrap'>" +
(Nokogiri(`dot #{file.path} -Tsvg`)/'svg').first.tap{|svg| svg.search('polygon').first.remove; svg['width']='600px' ; svg.attributes['height'].remove }.to_html +
(Nokogiri(`dot #{file.path} -Tsvg`)/'svg').first.tap{|svg| svg.search('polygon').first.remove; svg['width']=(size||'600')+'px' ; svg.attributes['height'].remove }.to_html +
"</div>"
elsif lang == 'notes'
"<div class='notes' style='display:none;'>#{code}</div>"
@@ -111,6 +112,17 @@ def doc_header
<link href="css/highlight.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-16178122-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
#{mathjax}
<link href="css/style.css" rel="stylesheet" />
#{@head}

0 comments on commit 2acb0ab

Please sign in to comment.