Validate the entire markup as soon as possible
This commit is contained in:
parent
25519b38f6
commit
7cec996f90
|
@ -2,21 +2,24 @@ module Jekyll
|
||||||
module Tags
|
module Tags
|
||||||
class IncludeTag < Liquid::Tag
|
class IncludeTag < Liquid::Tag
|
||||||
|
|
||||||
VALID_SYNTAX = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/
|
|
||||||
|
|
||||||
SYNTAX_EXAMPLE = "{% include file.ext param='value' param2='value' %}"
|
SYNTAX_EXAMPLE = "{% include file.ext param='value' param2='value' %}"
|
||||||
|
|
||||||
|
VALID_SYNTAX = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/
|
||||||
|
|
||||||
INCLUDES_DIR = '_includes'
|
INCLUDES_DIR = '_includes'
|
||||||
|
|
||||||
def initialize(tag_name, markup, tokens)
|
def initialize(tag_name, markup, tokens)
|
||||||
super
|
super
|
||||||
@file, @params = markup.strip.split(' ', 2);
|
@file, @params = markup.strip.split(' ', 2);
|
||||||
|
validate_syntax
|
||||||
|
end
|
||||||
|
|
||||||
|
def validate_syntax
|
||||||
validate_file_name
|
validate_file_name
|
||||||
|
validate_params if @params
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_params(context)
|
def parse_params(context)
|
||||||
validate_params
|
|
||||||
|
|
||||||
params = {}
|
params = {}
|
||||||
markup = @params
|
markup = @params
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue