Merge pull request #4183 from rebornix/MultiVariableInclude

Merge pull request 4183
This commit is contained in:
Parker Moore 2015-11-25 10:27:36 -08:00
commit 4359dba84a
2 changed files with 9 additions and 1 deletions

View File

@ -89,3 +89,11 @@ Feature: Include tags
Then I have an "_includes/one.html" file that contains "include content changed"
When I run jekyll build
Then I should see "include content changed" in "_site/index.html"
Scenario: Include a file with multiple variables
Given I have an _includes directory
And I have an "_includes/header-en.html" file that contains "include"
And I have an "index.html" page that contains "{% assign name = 'header' %}{% assign locale = 'en' %}{% include {{name}}-{{locale}}.html %}"
When I run jekyll build
Then the _site directory should exist
And I should see "include" in "_site/index.html"

View File

@ -16,7 +16,7 @@ module Jekyll
attr_reader :includes_dir
VALID_SYNTAX = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/
VARIABLE_SYNTAX = /(?<variable>[^{]*\{\{\s*(?<name>[\w\-\.]+)\s*(\|.*)?\}\}[^\s}]*)(?<params>.*)/
VARIABLE_SYNTAX = /(?<variable>[^{]*(\{\{\s*[\w\-\.]+\s*(\|.*)?\}\}[^\s{}]*)+)(?<params>.*)/
def initialize(tag_name, markup, tokens)
super