mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-12-23 16:08:53 -05:00
Now code blocks automatically escape liquid {{ and {% characters fixes #745
This commit is contained in:
parent
c1a0d4ba52
commit
1a96b235fc
@ -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('<','<')
|
||||
|
Loading…
Reference in New Issue
Block a user