Update include tag to be more permissive (#8618)
Merge pull request 8618
This commit is contained in:
parent
6c170f11af
commit
5d01099e22
|
@ -13,7 +13,7 @@ module Jekyll
|
|||
!mx.freeze
|
||||
|
||||
FULL_VALID_SYNTAX = %r!\A\s*(?:#{VALID_SYNTAX}(?=\s|\z)\s*)*\z!.freeze
|
||||
VALID_FILENAME_CHARS = %r!^[\w/.-]+$!.freeze
|
||||
VALID_FILENAME_CHARS = %r!^[\w/.\-()+~\#@]+$!.freeze
|
||||
INVALID_SEQUENCES = %r![./]{2,}!.freeze
|
||||
|
||||
def initialize(tag_name, markup, tokens)
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<span id='include-param'>{{include.param}}</span>
|
||||
|
||||
<ul id='param-list'>
|
||||
{% for param in include %}
|
||||
<li>{{param[0]}} = {{param[1]}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
|
@ -907,6 +907,49 @@ class TestTags < JekyllUnitTest
|
|||
end
|
||||
end
|
||||
|
||||
context "with include file with special characters without params" do
|
||||
setup do
|
||||
content = <<~CONTENT
|
||||
---
|
||||
title: special characters
|
||||
---
|
||||
|
||||
{% include params@2.0.html %}
|
||||
CONTENT
|
||||
create_post(content,
|
||||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true)
|
||||
end
|
||||
|
||||
should "include file with empty parameters" do
|
||||
assert_match "<span id=\"include-param\"></span>", @result
|
||||
end
|
||||
end
|
||||
|
||||
context "with include file with special characters with params" do
|
||||
setup do
|
||||
content = <<~CONTENT
|
||||
---
|
||||
title: special characters
|
||||
---
|
||||
|
||||
{% include params@2.0.html param1="foobar" param2="bazbar" %}
|
||||
CONTENT
|
||||
create_post(content,
|
||||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true)
|
||||
end
|
||||
|
||||
should "include file with empty parameters" do
|
||||
assert_match "<li>param1 = foobar</li>", @result
|
||||
assert_match "<li>param2 = bazbar</li>", @result
|
||||
end
|
||||
end
|
||||
|
||||
context "with custom includes directory" do
|
||||
setup do
|
||||
content = <<~CONTENT
|
||||
|
|
Loading…
Reference in New Issue