From afca876bd46f13002119c6a342ff75c4db28ac0b Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Tue, 9 Apr 2013 09:23:31 -0500 Subject: [PATCH] Accepting all non-whitespace characters as language names for Pygments code highlighting --- plugins/code_block.rb | 4 ++-- plugins/include_code.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/code_block.rb b/plugins/code_block.rb index f2ae3e550ed6..c70e181e2842 100644 --- a/plugins/code_block.rb +++ b/plugins/code_block.rb @@ -56,9 +56,9 @@ def initialize(tag_name, markup, tokens) @caption = nil @filetype = nil @highlight = true - if markup =~ /\s*lang:([\w-]+)/i + if markup =~ /\s*lang:(\S+)/i @filetype = $1 - markup = markup.sub(/\s*lang:([\w-]+)/i,'') + markup = markup.sub(/\s*lang:(\S+)/i,'') end if markup =~ CaptionUrlTitle @file = $1 diff --git a/plugins/include_code.rb b/plugins/include_code.rb index 1ee3223f7cfc..220466b69d1f 100644 --- a/plugins/include_code.rb +++ b/plugins/include_code.rb @@ -32,9 +32,9 @@ class IncludeCodeTag < Liquid::Tag def initialize(tag_name, markup, tokens) @title = nil @file = nil - if markup.strip =~ /\s*lang:([\w-]+)/i + if markup.strip =~ /\s*lang:(\S+)/i @filetype = $1 - markup = markup.strip.sub(/\s*lang:([\w-]+)/i,'') + markup = markup.strip.sub(/lang:\S+/i,'') end if markup.strip =~ /(.*)?(\s+|^)(\/*\S+)/i @title = $1 || nil