Browse code

improved lang:language for codeblock and include code. It no longer strips out surrounding whitespace.

Brandon Mathis authored on 21/08/2011 at 14:31:14
Showing 2 changed files
... ...
@@ -55,9 +55,9 @@ module Jekyll
55 55
       @caption = nil
56 56
       @filetype = nil
57 57
       @highlight = true
58
-      if markup =~ /\s+lang:(\w+)/i
58
+      if markup =~ /\s*lang:(\w+)/i
59 59
         @filetype = $1
60
-        markup = markup.sub(/\s+lang:\w+\s*/i,'')
60
+        markup = markup.sub(/lang:\w+/i,'')
61 61
       end
62 62
       if markup =~ CaptionUrlTitle
63 63
         @file = $1
... ...
@@ -30,9 +30,9 @@ module Jekyll
30 30
     def initialize(tag_name, markup, tokens)
31 31
       @title = nil
32 32
       @file = nil
33
-      if markup.strip =~ /\s+lang:(\w+)/i
33
+      if markup.strip =~ /\s*lang:(\w+)/i
34 34
         @filetype = $1
35
-        markup = markup.strip.sub(/\s+lang:\w+\s*/i,'')
35
+        markup = markup.strip.sub(/lang:\w+/i,'')
36 36
       end
37 37
       if markup.strip =~ /(.*)?(\s+|^)(\/*\S+)/i
38 38
         @title = $1 || nil