Skip to content

Commit

Permalink
fixed GA snippet,
Browse files Browse the repository at this point in the history
add a way to provide options to haml from site.yml
  • Loading branch information
tcurdt committed Apr 21, 2011
1 parent 688cdb1 commit 681dfe8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/awestruct/extensions/google_analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def google_analytics()
def google_analytics_async()
html = ''
html += %Q(<script type="text/javascript">\n)
html += %Q(var _gaq = [['_setAccount','#{site.google_analytics}"'],)
html += %Q(var _gaq = [['_setAccount','#{site.google_analytics}'],)
if site.google_analytics_anonymize
html += %Q(['_gat._anonymizeIp'],)
end
Expand All @@ -31,7 +31,7 @@ def google_analytics_async()
html += %Q( g.async = true;\n)
html += %Q( g.src = ('https:' == location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n)
html += %Q( s.parentNode.insertBefore(g, s);\n)
html += %Q[})(document, 'script');\n]
html += %Q[})(document, 'script');\n</script>\n]
html
end
end
Expand Down
3 changes: 2 additions & 1 deletion lib/awestruct/hamlable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ module Hamlable
def render(context)
rendered = ''
begin
haml_engine = Haml::Engine.new( raw_page_content )
options = (site.haml || {}).inject({}){|h,(k,v)| h[k.to_sym] = v.to_sym; h }
haml_engine = Haml::Engine.new( raw_page_content, options )
rendered = haml_engine.render( context )
rescue => e
puts e
Expand Down

0 comments on commit 681dfe8

Please sign in to comment.