Fix code to allow dots in variables
This commit is contained in:
parent
a93795bcc0
commit
2138dfc0ac
|
@ -37,7 +37,8 @@ Feature: Include tags
|
||||||
Scenario: Include a file from a variable
|
Scenario: Include a file from a variable
|
||||||
Given I have an _includes directory
|
Given I have an _includes directory
|
||||||
And I have an "_includes/snippet.html" file that contains "a snippet"
|
And I have an "_includes/snippet.html" file that contains "a snippet"
|
||||||
And I have an "index.html" page that contains "{% assign file = 'snippet.html' %}{% include {{file}} %}"
|
And I have a configuration file with "include_file" set to "snippet.html"
|
||||||
|
And I have an "index.html" page that contains "{% include {{site.include_file}} %}"
|
||||||
When I run jekyll
|
When I run jekyll
|
||||||
Then the _site directory should exist
|
Then the _site directory should exist
|
||||||
And I should see "a snippet" in "_site/index.html"
|
And I should see "a snippet" in "_site/index.html"
|
|
@ -76,7 +76,7 @@ eos
|
||||||
end
|
end
|
||||||
|
|
||||||
def retrieve_variable(context)
|
def retrieve_variable(context)
|
||||||
if /\{\{([\w\-]+)\}\}/ =~ @file
|
if /\{\{([\w\-\.]+)\}\}/ =~ @file
|
||||||
raise ArgumentError.new("No variable #{$1} was found in include tag") if context[$1].nil?
|
raise ArgumentError.new("No variable #{$1} was found in include tag") if context[$1].nil?
|
||||||
@file = context[$1]
|
@file = context[$1]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue