Skip to content

Commit 089af26

Browse files
committed
improved lang:language for codeblock and include code. It no longer strips out surrounding whitespace.
1 parent 83d87f9 commit 089af26

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

plugins/code_block.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ def initialize(tag_name, markup, tokens)
5555
@caption = nil
5656
@filetype = nil
5757
@highlight = true
58-
if markup =~ /\s+lang:(\w+)/i
58+
if markup =~ /\s*lang:(\w+)/i
5959
@filetype = $1
60-
markup = markup.sub(/\s+lang:\w+\s*/i,'')
60+
markup = markup.sub(/lang:\w+/i,'')
6161
end
6262
if markup =~ CaptionUrlTitle
6363
@file = $1

plugins/include_code.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ class IncludeCodeTag < Liquid::Tag
3030
def initialize(tag_name, markup, tokens)
3131
@title = nil
3232
@file = nil
33-
if markup.strip =~ /\s+lang:(\w+)/i
33+
if markup.strip =~ /\s*lang:(\w+)/i
3434
@filetype = $1
35-
markup = markup.strip.sub(/\s+lang:\w+\s*/i,'')
35+
markup = markup.strip.sub(/lang:\w+/i,'')
3636
end
3737
if markup.strip =~ /(.*)?(\s+|^)(\/*\S+)/i
3838
@title = $1 || nil

0 commit comments

Comments
 (0)