Browse code

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.

Brandon Mathis authored on 01/08/2011 at 13:06:37
Showing 1 changed files
... ...
@@ -30,22 +30,17 @@ module OctopressFilters
30 30
     input = input.gsub /<p>`{3}\s*(\w+)?<\/p>\s*<pre><code>\s*(.+?)\s*<\/code><\/pre>\s*<p>`{3}<\/p>/m do
31 31
       lang = $1
32 32
       if lang != ''
33
-        str  = $2.gsub('&lt;','<').gsub('&gt;','>')
33
+        str  = $2.gsub('&lt;','<').gsub('&gt;','>').gsub('&amp;','&')
34 34
         highlight(str, lang)
35 35
       else
36 36
         "<pre><code>#{$2}</code></pre>"
37 37
       end
38 38
     end
39 39
 
40
-    # Textile support
40
+    # Textile warning
41 41
     input = input.gsub /<p>`{3}\s*(\w+)?<br\s*\/>\n(.+?)`{3}<\/p>/m do
42 42
       lang = $1
43
-      str  = $2.gsub('&lt;','<').gsub('&gt;','>').gsub(/^\s{4}/, '').gsub(/(<br\s\/>)?$/, '')
44
-      if lang != ''
45
-        highlight(str, lang)
46
-      else
47
-        "<pre><code>#{$2}</code></pre>"
48
-      end
43
+      "<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>"
49 44
     end
50 45
 
51 46
     # Regular HTML support