Permalink
Browse files

Removed unnecessary regex in code block plugin

  • Loading branch information...
1 parent c18de55 commit 55fa9b3d8e82e5e2699e4d30a77a71bac26ba443 @imathis imathis committed Dec 26, 2012
Showing with 1 addition and 5 deletions.
  1. +1 −5 plugins/code_block.rb
View
@@ -50,7 +50,6 @@ class CodeBlock < Liquid::Block
include HighlightCode
include TemplateWrapper
CaptionUrlTitle = /(\S[\S\s]*)\s+(https?:\/\/\S+|\/\S+)\s*(.+)?/i
- CaptionUrl = /(\S[\S\s]*)\s+(https?:\/\/\S+|\/\S+)/i
Caption = /(\S[\S\s]*)/
def initialize(tag_name, markup, tokens)
@title = nil
@@ -63,10 +62,7 @@ def initialize(tag_name, markup, tokens)
end
if markup =~ CaptionUrlTitle
@file = $1
- @caption = "<figcaption><span>#{$1}</span><a href='#{$2}'>#{$3}</a></figcaption>"
- elsif markup =~ CaptionUrl
- @file = $1
- @caption = "<figcaption><span>#{$1}</span><a href='#{$2}'>link</a></figcaption>"
+ @caption = "<figcaption><span>#{$1}</span><a href='#{$2}'>#{$3 || 'link'}</a></figcaption>"
elsif markup =~ Caption
@file = $1
@caption = "<figcaption><span>#{$1}</span></figcaption>\n"

0 comments on commit 55fa9b3

Please sign in to comment.