mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-11-17 14:45:01 -05:00
Backtick codeblocks now correctly replace & with & and Textile support for back tick code blocks has been removed. It never really worked. Textile makes me sad.
This commit is contained in:
parent
5d24e0ba2b
commit
ff1dba19f2
@ -30,22 +30,17 @@ module OctopressFilters
|
|||||||
input = input.gsub /<p>`{3}\s*(\w+)?<\/p>\s*<pre><code>\s*(.+?)\s*<\/code><\/pre>\s*<p>`{3}<\/p>/m do
|
input = input.gsub /<p>`{3}\s*(\w+)?<\/p>\s*<pre><code>\s*(.+?)\s*<\/code><\/pre>\s*<p>`{3}<\/p>/m do
|
||||||
lang = $1
|
lang = $1
|
||||||
if lang != ''
|
if lang != ''
|
||||||
str = $2.gsub('<','<').gsub('>','>')
|
str = $2.gsub('<','<').gsub('>','>').gsub('&','&')
|
||||||
highlight(str, lang)
|
highlight(str, lang)
|
||||||
else
|
else
|
||||||
"<pre><code>#{$2}</code></pre>"
|
"<pre><code>#{$2}</code></pre>"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Textile support
|
# Textile warning
|
||||||
input = input.gsub /<p>`{3}\s*(\w+)?<br\s*\/>\n(.+?)`{3}<\/p>/m do
|
input = input.gsub /<p>`{3}\s*(\w+)?<br\s*\/>\n(.+?)`{3}<\/p>/m do
|
||||||
lang = $1
|
lang = $1
|
||||||
str = $2.gsub('<','<').gsub('>','>').gsub(/^\s{4}/, '').gsub(/(<br\s\/>)?$/, '')
|
"<pre><code>Back tick code blocks are not supported for Textile.\nTry HTML or Markdown instead or use the codeblock tag.\n\n{% codeblock #{lang} %}\nYour code snippet\n{% endcodeblock %}</code></pre>"
|
||||||
if lang != ''
|
|
||||||
highlight(str, lang)
|
|
||||||
else
|
|
||||||
"<pre><code>#{$2}</code></pre>"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Regular HTML support
|
# Regular HTML support
|
||||||
|
Loading…
Reference in New Issue
Block a user