Skip to content

Commit 2acb0ab

Browse files
committed
Allow various sizes for the dot/graphviz stuff, and include google analytics
1 parent 324243d commit 2acb0ab

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/impress_renderer.rb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,13 @@ def hrule
5454
end
5555

5656
def block_code code, lang
57-
if lang == 'dot'
57+
if lang =~ /^dot/
58+
_, size = lang.split('-')
5859
file = Tempfile.new(['mdpress','.dot'])
5960
file << code
6061
file.close
6162
"<div class='dot-wrap'>" +
62-
(Nokogiri(`dot #{file.path} -Tsvg`)/'svg').first.tap{|svg| svg.search('polygon').first.remove; svg['width']='600px' ; svg.attributes['height'].remove }.to_html +
63+
(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 +
6364
"</div>"
6465
elsif lang == 'notes'
6566
"<div class='notes' style='display:none;'>#{code}</div>"
@@ -111,6 +112,17 @@ def doc_header
111112
<link href="css/highlight.css" type="text/css" rel="stylesheet" />
112113
<script type="text/javascript" src="js/highlight.pack.js"></script>
113114
<script>hljs.initHighlightingOnLoad();</script>
115+
<script type="text/javascript">
116+
var _gaq = _gaq || [];
117+
_gaq.push(['_setAccount', 'UA-16178122-1']);
118+
_gaq.push(['_trackPageview']);
119+
120+
(function() {
121+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
122+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
123+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
124+
})();
125+
</script>
114126
#{mathjax}
115127
<link href="css/style.css" rel="stylesheet" />
116128
#{@head}

0 commit comments

Comments
 (0)