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:
Brandon Mathis 2011-08-01 09:06:37 -04:00
parent 5d24e0ba2b
commit ff1dba19f2

View File

@ -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('&lt;','<').gsub('&gt;','>') str = $2.gsub('&lt;','<').gsub('&gt;','>').gsub('&amp;','&')
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('&lt;','<').gsub('&gt;','>').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