Allow users to input multiple variables in include tag
This commit is contained in:
parent
effe23a008
commit
657a8d7239
|
@ -89,3 +89,11 @@ Feature: Include tags
|
||||||
Then I have an "_includes/one.html" file that contains "include content changed"
|
Then I have an "_includes/one.html" file that contains "include content changed"
|
||||||
When I run jekyll build
|
When I run jekyll build
|
||||||
Then I should see "include content changed" in "_site/index.html"
|
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"
|
||||||
|
|
|
@ -16,7 +16,7 @@ module Jekyll
|
||||||
attr_reader :includes_dir
|
attr_reader :includes_dir
|
||||||
|
|
||||||
VALID_SYNTAX = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/
|
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)
|
def initialize(tag_name, markup, tokens)
|
||||||
super
|
super
|
||||||
|
|
Loading…
Reference in New Issue