Browse code

Removed unnecessary regex in code block plugin

Brandon Mathis authored on 26/12/2012 at 23:33:48
Showing 1 changed files
... ...
@@ -50,7 +50,6 @@ module Jekyll
50 50
     include HighlightCode
51 51
     include TemplateWrapper
52 52
     CaptionUrlTitle = /(\S[\S\s]*)\s+(https?:\/\/\S+|\/\S+)\s*(.+)?/i
53
-    CaptionUrl = /(\S[\S\s]*)\s+(https?:\/\/\S+|\/\S+)/i
54 53
     Caption = /(\S[\S\s]*)/
55 54
     def initialize(tag_name, markup, tokens)
56 55
       @title = nil
... ...
@@ -63,10 +62,7 @@ module Jekyll
63 63
       end
64 64
       if markup =~ CaptionUrlTitle
65 65
         @file = $1
66
-        @caption = "<figcaption><span>#{$1}</span><a href='#{$2}'>#{$3}</a></figcaption>"
67
-      elsif markup =~ CaptionUrl
68
-        @file = $1
69
-        @caption = "<figcaption><span>#{$1}</span><a href='#{$2}'>link</a></figcaption>"
66
+        @caption = "<figcaption><span>#{$1}</span><a href='#{$2}'>#{$3 || 'link'}</a></figcaption>"
70 67
       elsif markup =~ Caption
71 68
         @file = $1
72 69
         @caption = "<figcaption><span>#{$1}</span></figcaption>\n"