Skip to content

Commit c18de55

Browse files
committed
Titles in code plugins can have slashes in them. Closes #892
1 parent 48d3e75 commit c18de55

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

plugins/backtick_code_block.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module BacktickCodeBlock
44
include HighlightCode
5-
AllOptions = /([^\s]+)\s+(.+?)(https?:\/\/\S+|\/\S+)\s*(.+)?/i
5+
AllOptions = /([^\s]+)\s+(.+?)\s+(https?:\/\/\S+|\/\S+)\s*(.+)?/i
66
LangCaption = /([^\s]+)\s*(.+)?/i
77
def render_code_block(input)
88
@options = nil

plugins/code_block.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ module Jekyll
4949
class CodeBlock < Liquid::Block
5050
include HighlightCode
5151
include TemplateWrapper
52-
CaptionUrlTitle = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)\s+(.+)/i
53-
CaptionUrl = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)/i
52+
CaptionUrlTitle = /(\S[\S\s]*)\s+(https?:\/\/\S+|\/\S+)\s*(.+)?/i
53+
CaptionUrl = /(\S[\S\s]*)\s+(https?:\/\/\S+|\/\S+)/i
5454
Caption = /(\S[\S\s]*)/
5555
def initialize(tag_name, markup, tokens)
5656
@title = nil
@@ -63,10 +63,10 @@ def initialize(tag_name, markup, tokens)
6363
end
6464
if markup =~ CaptionUrlTitle
6565
@file = $1
66-
@caption = "<figcaption><span>#{$1}</span><a href='#{$2 + $3}'>#{$4}</a></figcaption>"
66+
@caption = "<figcaption><span>#{$1}</span><a href='#{$2}'>#{$3}</a></figcaption>"
6767
elsif markup =~ CaptionUrl
6868
@file = $1
69-
@caption = "<figcaption><span>#{$1}</span><a href='#{$2 + $3}'>link</a></figcaption>"
69+
@caption = "<figcaption><span>#{$1}</span><a href='#{$2}'>link</a></figcaption>"
7070
elsif markup =~ Caption
7171
@file = $1
7272
@caption = "<figcaption><span>#{$1}</span></figcaption>\n"

source/images/icon-sdc231d6676.png

1.48 KB
Loading

0 commit comments

Comments
 (0)