Browse files

Titles in code plugins can have slashes in them. Closes #892

  • Loading branch information...
1 parent 48d3e75 commit c18de558759dff2c77e6e0fc3ce2ad7a9f3fea99 @imathis committed Dec 26, 2012
Showing with 5 additions and 5 deletions.
  1. +1 −1 plugins/backtick_code_block.rb
  2. +4 −4 plugins/code_block.rb
  3. BIN source/images/icon-sdc231d6676.png
View
2 plugins/backtick_code_block.rb
@@ -2,7 +2,7 @@
module BacktickCodeBlock
include HighlightCode
- AllOptions = /([^\s]+)\s+(.+?)(https?:\/\/\S+|\/\S+)\s*(.+)?/i
+ AllOptions = /([^\s]+)\s+(.+?)\s+(https?:\/\/\S+|\/\S+)\s*(.+)?/i
LangCaption = /([^\s]+)\s*(.+)?/i
def render_code_block(input)
@options = nil
View
8 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 @@ def initialize(tag_name, markup, tokens)
end
if markup =~ CaptionUrlTitle
@file = $1
- @caption = "<figcaption><span>#{$1}</span><a href='#{$2 + $3}'>#{$4}</a></figcaption>"
+ @caption = "<figcaption><span>#{$1}</span><a href='#{$2}'>#{$3}</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}'>link</a></figcaption>"
elsif markup =~ Caption
@file = $1
@caption = "<figcaption><span>#{$1}</span></figcaption>\n"
View
BIN source/images/icon-sdc231d6676.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c18de55

Please sign in to comment.