From c18de558759dff2c77e6e0fc3ce2ad7a9f3fea99 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Wed, 26 Dec 2012 17:18:29 -0600 Subject: Titles in code plugins can have slashes in them. Closes #892 --- plugins/code_block.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins/code_block.rb') diff --git a/plugins/code_block.rb b/plugins/code_block.rb index 44e34945..62c551a4 100644 --- a/plugins/code_block.rb +++ b/plugins/code_block.rb @@ -49,8 +49,8 @@ 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 + CaptionUrl = /(\S[\S\s]*)\s+(https?:\/\/\S+|\/\S+)/i Caption = /(\S[\S\s]*)/ def initialize(tag_name, markup, tokens) @title = nil @@ -63,10 +63,10 @@ module Jekyll end if markup =~ CaptionUrlTitle @file = $1 - @caption = "
#{$1}#{$4}
" + @caption = "
#{$1}#{$3}
" elsif markup =~ CaptionUrl @file = $1 - @caption = "
#{$1}link
" + @caption = "
#{$1}link
" elsif markup =~ Caption @file = $1 @caption = "
#{$1}
\n" -- cgit v1.2.1 From 55fa9b3d8e82e5e2699e4d30a77a71bac26ba443 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Wed, 26 Dec 2012 17:33:48 -0600 Subject: Removed unnecessary regex in code block plugin --- plugins/code_block.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'plugins/code_block.rb') diff --git a/plugins/code_block.rb b/plugins/code_block.rb index 62c551a4..660f73d7 100644 --- a/plugins/code_block.rb +++ b/plugins/code_block.rb @@ -50,7 +50,6 @@ module Jekyll 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 @@ module Jekyll end if markup =~ CaptionUrlTitle @file = $1 - @caption = "
#{$1}#{$3}
" - elsif markup =~ CaptionUrl - @file = $1 - @caption = "
#{$1}link
" + @caption = "
#{$1}#{$3 || 'link'}
" elsif markup =~ Caption @file = $1 @caption = "
#{$1}
\n" -- cgit v1.2.1