aboutsummaryrefslogtreecommitdiff
path: root/plugins/code_block.rb
diff options
context:
space:
mode:
authorLeonardo Saraiva <vyper@maneh.org>2013-02-24 20:51:31 -0300
committerLeonardo Saraiva <vyper@maneh.org>2013-02-24 20:51:31 -0300
commit2fe9da91f5a4b5ba3edaee47ee24dbce523e739e (patch)
treecca3792ae030b550015633b4b855451fa8455bc3 /plugins/code_block.rb
parente1020ed888439a480cb13af2585f9fea5283c609 (diff)
parent4790b939807be4d9abcc567f02773ff24b99320d (diff)
downloadmy_new_personal_website-2fe9da91f5a4b5ba3edaee47ee24dbce523e739e.tar.xz
my_new_personal_website-2fe9da91f5a4b5ba3edaee47ee24dbce523e739e.zip
Merge branch 'master' of github.com:imathis/octopress
Conflicts: plugins/category_generator.rb
Diffstat (limited to 'plugins/code_block.rb')
-rw-r--r--plugins/code_block.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/plugins/code_block.rb b/plugins/code_block.rb
index 44e34945..660f73d7 100644
--- a/plugins/code_block.rb
+++ b/plugins/code_block.rb
@@ -49,8 +49,7 @@ module Jekyll
class CodeBlock < Liquid::Block
include HighlightCode
include TemplateWrapper
- CaptionUrlTitle = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)\s+(.+)/i
- CaptionUrl = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)/i
+ CaptionUrlTitle = /(\S[\S\s]*)\s+(https?:\/\/\S+|\/\S+)\s*(.+)?/i
Caption = /(\S[\S\s]*)/
def initialize(tag_name, markup, tokens)
@title = nil
@@ -63,10 +62,7 @@ module Jekyll
end
if markup =~ CaptionUrlTitle
@file = $1
- @caption = "<figcaption><span>#{$1}</span><a href='#{$2 + $3}'>#{$4}</a></figcaption>"
- elsif markup =~ CaptionUrl
- @file = $1
- @caption = "<figcaption><span>#{$1}</span><a href='#{$2 + $3}'>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"