From 0ce6655e027dd22bf8815c20be78b8ffbf73496e Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Mon, 11 Jun 2012 01:08:05 -0500 Subject: [PATCH] Added escape for liquid tags {{ and {% so that Liquid doesn't barf when a language uses these characters. Closes #466 --- plugins/pygments_code.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/pygments_code.rb b/plugins/pygments_code.rb index fe828ac..ca6f6d6 100644 --- a/plugins/pygments_code.rb +++ b/plugins/pygments_code.rb @@ -39,9 +39,11 @@ module HighlightCode linenos = options[:linenos] start = options[:start] + code = code.gsub(/{{/, '{{').gsub(/{%/, '{%') + if lang == 'plain' # Escape html tags - code = code.gsub('<','<').gsub('>','>') + code = code.gsub('<','<') elsif lang.include? "-raw" output = "``` #{$1.sub('-raw', '')}\n" output += code