From 1a96b235fc748d3f65b26c77fcbabf736b99f221 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Thu, 6 Sep 2012 11:10:32 -0500 Subject: [PATCH] Now code blocks automatically escape liquid {{ and {% characters fixes #745 --- plugins/pygments_code.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/pygments_code.rb b/plugins/pygments_code.rb index 45623d0..eae638a 100644 --- a/plugins/pygments_code.rb +++ b/plugins/pygments_code.rb @@ -21,6 +21,7 @@ module HighlightCode else highlighted_code = Pygments.highlight(code, :lexer => lang, :formatter => 'html', :options => {:encoding => 'utf-8'}) end + highlighted_code = highlighted_code.gsub(/{{/, '{{').gsub(/{%/, '{%') File.open(path, 'w') {|f| f.print(highlighted_code) } if path end highlighted_code.to_s @@ -44,8 +45,6 @@ module HighlightCode linenos = options[:linenos] start = options[:start] - code = code.gsub(/{{/, '{{').gsub(/{%/, '{%') - if lang == 'plain' # Escape html tags code = code.gsub('<','<')