Merge pull request #2693 from ivantsepp/2142_partial_liquid_output_tag_in_include_tag

This commit is contained in:
Parker Moore 2014-08-06 15:28:07 -04:00
commit 21b6a01980
4 changed files with 20 additions and 1 deletions

View File

@ -66,3 +66,14 @@ Feature: Include tags
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then the _site directory should exist
And I should see "one included" in "_site/index.html" And I should see "one included" in "_site/index.html"
Scenario: Include a file with partial variables
Given I have an _includes directory
And I have an "_includes/one.html" file that contains "one included"
And I have a configuration file with:
| key | value |
| include_file | one |
And I have an "index.html" page that contains "{% include {{ site.include_file }}.html %}"
When I run jekyll build
Then the _site directory should exist
And I should see "one included" in "_site/index.html"

View File

@ -14,7 +14,7 @@ module Jekyll
SYNTAX_EXAMPLE = "{% include file.ext param='value' param2='value' %}" SYNTAX_EXAMPLE = "{% include file.ext param='value' param2='value' %}"
VALID_SYNTAX = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/ VALID_SYNTAX = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/
VARIABLE_SYNTAX = /(?<variable>\{\{\s*(?<name>[\w\-\.]+)\s*(\|.*)?\}\})(?<params>.*)/ VARIABLE_SYNTAX = /(?<variable>[^{]*\{\{\s*(?<name>[\w\-\.]+)\s*(\|.*)?\}\}[^\s}]*)(?<params>.*)/
INCLUDES_DIR = '_includes' INCLUDES_DIR = '_includes'

View File

@ -5,6 +5,7 @@ include1: include.html
include2: include include2: include
include3: INCLUDE include3: INCLUDE
include4: params include4: params
include5: clude
--- ---
Liquid tests Liquid tests
@ -19,3 +20,6 @@ Whitespace tests
Parameters test Parameters test
- 7 {% include {{ page.include4 | append: '.html' }} var1='foo' var2='bar' %} - 7 {% include {{ page.include4 | append: '.html' }} var1='foo' var2='bar' %}
Partial variable test
- 8 {% include in{{ page.include5 }}.html %}

View File

@ -504,6 +504,10 @@ CONTENT
assert_match '<li>var1 = foo</li>', @content assert_match '<li>var1 = foo</li>', @content
assert_match '<li>var2 = bar</li>', @content assert_match '<li>var2 = bar</li>', @content
end end
should "include file as partial variable" do
assert_match %r{8 included}, @content
end
end end
end end
end end