Browse code

Removes also leading tab from backtick codeblock

Frederic Hemberger authored on 16/10/2011 at 10:02:14
Showing 1 changed files
... ...
@@ -10,7 +10,7 @@ module BacktickCodeBlock
10 10
     @lang = nil
11 11
     @url = nil
12 12
     @title = nil
13
-    input.gsub /^`{3} *([^\n]+)?\n(.+?)\n`{3}/m do
13
+    input.gsub(/^`{3} *([^\n]+)?\n(.+?)\n`{3}/m) do
14 14
       @options = $1 || ''
15 15
       str = $2
16 16
 
... ...
@@ -22,8 +22,8 @@ module BacktickCodeBlock
22 22
         @caption = "<figcaption><span>#{$2}</span></figcaption>"
23 23
       end
24 24
 
25
-      if str.match(/\A {4}/)
26
-        str = str.gsub /^ {4}/, ''
25
+      if str.match(/\A( {4}|\t)/)
26
+        str = str.gsub(/^( {4}|\t)/, '')
27 27
       end
28 28
       if @lang.nil? || @lang == 'plain'
29 29
         code = tableize_code(str.gsub('<','&lt;').gsub('>','&gt;'))