mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-12-24 08:28:50 -05:00
Added escape for liquid tags {{ and {% so that Liquid doesn't barf when a language uses these characters. Closes #466
This commit is contained in:
parent
bfb348695f
commit
f3978d1604
@ -39,9 +39,11 @@ module HighlightCode
|
|||||||
linenos = options[:linenos]
|
linenos = options[:linenos]
|
||||||
start = options[:start]
|
start = options[:start]
|
||||||
|
|
||||||
|
code = code.gsub(/{{/, '{{').gsub(/{%/, '{%')
|
||||||
|
|
||||||
if lang == 'plain'
|
if lang == 'plain'
|
||||||
# Escape html tags
|
# Escape html tags
|
||||||
code = code.gsub('<','<').gsub('>','>')
|
code = code.gsub('<','<')
|
||||||
elsif lang.include? "-raw"
|
elsif lang.include? "-raw"
|
||||||
output = "``` #{$1.sub('-raw', '')}\n"
|
output = "``` #{$1.sub('-raw', '')}\n"
|
||||||
output += code
|
output += code
|
||||||
|
Loading…
Reference in New Issue
Block a user