Merge branch 'release/2.9.0'
This commit is contained in:
@@ -6,10 +6,21 @@ use Symfony\CS\FixerInterface;
|
||||
$config = Config::create()
|
||||
// use symfony level and extra fixers:
|
||||
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
|
||||
->fixers(array('align_double_arrow', '-concat_without_spaces', 'concat_with_spaces', 'ordered_use', 'strict'))
|
||||
->fixers(array(
|
||||
'-concat_without_spaces',
|
||||
'-pre_increment',
|
||||
'-unalign_double_arrow',
|
||||
'-unalign_equals',
|
||||
'align_double_arrow',
|
||||
'concat_with_spaces',
|
||||
'ordered_use',
|
||||
'strict',
|
||||
))
|
||||
->setUsingLinter(false);
|
||||
|
||||
$finder = $config->getFinder()
|
||||
->in(__DIR__);
|
||||
->in('bin')
|
||||
->in('src')
|
||||
->in('test');
|
||||
|
||||
return $config;
|
||||
|
||||
@@ -8,3 +8,6 @@ enabled:
|
||||
|
||||
disabled:
|
||||
- concat_without_spaces
|
||||
- pre_increment
|
||||
- unalign_double_arrow
|
||||
- unalign_equals
|
||||
|
||||
+1
-6
@@ -13,12 +13,7 @@ php:
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
- hhvm
|
||||
- hhvm-nightly
|
||||
|
||||
sudo: false
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: hhvm-nightly
|
||||
fast_finish: true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2010-2014 Justin Hileman
|
||||
Copyright (c) 2010-2015 Justin Hileman
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -1,181 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* A commandline script to create an example and the needed files.
|
||||
*
|
||||
* $ bin/create_example.php my_new_example
|
||||
*
|
||||
* ... and the folder my_new_example will be created in the examples/ folder containing 3 files:
|
||||
*
|
||||
* my_new_example/my_new_example.mustache
|
||||
* my_new_example/my_new_example.txt
|
||||
* my_new_example/MyNewExample.php
|
||||
*/
|
||||
|
||||
// some constants
|
||||
define('USAGE', <<<USAGE
|
||||
USAGE: {$argv[0]} example_name
|
||||
|
||||
This creates a new example and the corresponding files in the examples/ directory
|
||||
|
||||
USAGE
|
||||
);
|
||||
|
||||
define('EXAMPLE_PATH', realpath(dirname(__FILE__) . '/../test/fixtures/examples'));
|
||||
|
||||
/**
|
||||
* transform a string to lowercase using underlines.
|
||||
*
|
||||
* Examples:
|
||||
* String -> string
|
||||
* AString -> a_string
|
||||
* SomeStrings -> some_strings
|
||||
* AStringMore -> a_string_more
|
||||
*
|
||||
* @param string $name
|
||||
* @access public
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getLowerCaseName($name)
|
||||
{
|
||||
return preg_replace_callback('/([A-Z])/', create_function(
|
||||
'$match',
|
||||
'return "_" . strtolower($match[1]);'
|
||||
), lcfirst($name));
|
||||
}
|
||||
|
||||
/**
|
||||
* transform a string to Uppercase (camelcase).
|
||||
*
|
||||
* Examples
|
||||
* string -> String
|
||||
* a_string -> AString
|
||||
* some_strings -> SomeStrings
|
||||
* a_string_more -> AStringMore -> a_string_more
|
||||
*
|
||||
* @param string $name
|
||||
* @access public
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getUpperCaseName($name)
|
||||
{
|
||||
return preg_replace_callback('/_([a-z])/', create_function(
|
||||
'$match',
|
||||
'return strtoupper($match{1});'
|
||||
), ucfirst($name));
|
||||
}
|
||||
|
||||
/**
|
||||
* return the given value and echo it out appending "\n".
|
||||
*
|
||||
* @param mixed $value
|
||||
* @access public
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function out($value)
|
||||
{
|
||||
echo $value . "\n";
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* create Path for certain files in an example.
|
||||
*
|
||||
* returns the directory name if only $directory is given.
|
||||
* if an extension is given a complete filename is returned.
|
||||
* the returned filename will be echoed out.
|
||||
*
|
||||
* @param string $directory directory without / at the end
|
||||
* @param string $filename filename without path and extension
|
||||
* @param string $extension extension of the file without "."
|
||||
* @access public
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function buildPath($directory, $filename = null, $extension = null)
|
||||
{
|
||||
return out(EXAMPLE_PATH . '/' . $directory .
|
||||
($extension !== null && $filename !== null ? '/' . $filename . '.' . $extension : ''));
|
||||
}
|
||||
|
||||
/**
|
||||
* creates the directory for the example.
|
||||
*
|
||||
* the script die()'s if mkdir() fails.
|
||||
*
|
||||
* @param string $directory
|
||||
* @access public
|
||||
*/
|
||||
function createDirectory($directory)
|
||||
{
|
||||
if (!@mkdir(buildPath($directory))) {
|
||||
die("FAILED to create directory\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* create a file for the example with the given $content.
|
||||
*
|
||||
* the script die()'s if fopen() fails.
|
||||
*
|
||||
* @param string $directory directory without / at the end
|
||||
* @param string $filename filename without path and extension
|
||||
* @param string $extension extension of the file without "."
|
||||
* @param string $content the content of the file
|
||||
* @access public
|
||||
*/
|
||||
function createFile($directory, $filename, $extension, $content = '')
|
||||
{
|
||||
$handle = @fopen(buildPath($directory, $filename, $extension), 'w');
|
||||
if ($handle) {
|
||||
fwrite($handle, $content);
|
||||
fclose($handle);
|
||||
} else {
|
||||
die("FAILED to create file\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* routine to create the example directory and 3 files.
|
||||
*
|
||||
* if the $example_name is "SomeThing" the following files will be created
|
||||
* examples/some_thing
|
||||
* examples/some_thing/some_thing.mustache
|
||||
* examples/some_thing/some_thing.txt
|
||||
* examples/some_thing/SomeThing.php
|
||||
*
|
||||
* @param mixed $example_name
|
||||
* @access public
|
||||
*/
|
||||
function main($example_name)
|
||||
{
|
||||
$lowercase = getLowerCaseName($example_name);
|
||||
$uppercase = getUpperCaseName($example_name);
|
||||
createDirectory($lowercase);
|
||||
createFile($lowercase, $lowercase, 'mustache');
|
||||
createFile($lowercase, $lowercase, 'txt');
|
||||
createFile($lowercase, $uppercase, 'php', <<<CONTENT
|
||||
<?php
|
||||
|
||||
class {$uppercase} {
|
||||
|
||||
}
|
||||
|
||||
CONTENT
|
||||
);
|
||||
}
|
||||
|
||||
// check if enougth arguments are given
|
||||
if (count($argv) > 1) {
|
||||
// get the name of the example
|
||||
$example_name = $argv[1];
|
||||
|
||||
main($example_name);
|
||||
} else {
|
||||
echo USAGE;
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
+54
-18
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -19,6 +19,7 @@ class Mustache_Compiler
|
||||
private $pragmas;
|
||||
private $defaultPragmas = array();
|
||||
private $sections;
|
||||
private $blocks;
|
||||
private $source;
|
||||
private $indentNextLine;
|
||||
private $customEscape;
|
||||
@@ -43,6 +44,7 @@ class Mustache_Compiler
|
||||
{
|
||||
$this->pragmas = $this->defaultPragmas;
|
||||
$this->sections = array();
|
||||
$this->blocks = array();
|
||||
$this->source = $source;
|
||||
$this->indentNextLine = true;
|
||||
$this->customEscape = $customEscape;
|
||||
@@ -195,6 +197,7 @@ class Mustache_Compiler
|
||||
return $buffer;
|
||||
}
|
||||
%s
|
||||
%s
|
||||
}';
|
||||
|
||||
const KLASS_NO_LAMBDAS = '<?php
|
||||
@@ -225,19 +228,19 @@ class Mustache_Compiler
|
||||
{
|
||||
$code = $this->walk($tree);
|
||||
$sections = implode("\n", $this->sections);
|
||||
$klass = empty($this->sections) ? self::KLASS_NO_LAMBDAS : self::KLASS;
|
||||
$blocks = implode("\n", $this->blocks);
|
||||
$klass = empty($this->sections) && empty($this->blocks) ? self::KLASS_NO_LAMBDAS : self::KLASS;
|
||||
|
||||
$callable = $this->strictCallables ? $this->prepare(self::STRICT_CALLABLE) : '';
|
||||
|
||||
return sprintf($this->prepare($klass, 0, false, true), $name, $callable, $code, $sections);
|
||||
return sprintf($this->prepare($klass, 0, false, true), $name, $callable, $code, $sections, $blocks);
|
||||
}
|
||||
|
||||
const BLOCK_VAR = '
|
||||
$value = $this->resolveValue($context->findInBlock(%s), $context, $indent);
|
||||
if ($value && !is_array($value) && !is_object($value)) {
|
||||
$buffer .= $value;
|
||||
} else {
|
||||
%s
|
||||
$blockFunction = $context->findInBlock(%s);
|
||||
if (is_callable($blockFunction)) {
|
||||
$buffer .= call_user_func($blockFunction, $context);
|
||||
} else {%s
|
||||
}
|
||||
';
|
||||
|
||||
@@ -258,14 +261,10 @@ class Mustache_Compiler
|
||||
{
|
||||
$id = var_export($id, true);
|
||||
|
||||
return sprintf($this->prepare(self::BLOCK_VAR, $level), $id, $this->walk($nodes, 2));
|
||||
return sprintf($this->prepare(self::BLOCK_VAR, $level), $id, $this->walk($nodes, $level));
|
||||
}
|
||||
|
||||
const BLOCK_ARG = '
|
||||
// %s block_arg
|
||||
$value = $this->section%s($context, \'\', true);
|
||||
$newContext[%s] = %s$value;
|
||||
';
|
||||
const BLOCK_ARG = '$newContext[%s] = array($this, \'block%s\');';
|
||||
|
||||
/**
|
||||
* Generate Mustache Template inheritance block argument PHP source.
|
||||
@@ -282,10 +281,39 @@ class Mustache_Compiler
|
||||
*/
|
||||
private function blockArg($nodes, $id, $start, $end, $otag, $ctag, $level)
|
||||
{
|
||||
$key = $this->section($nodes, $id, array(), $start, $end, $otag, $ctag, $level, true);
|
||||
$key = $this->block($nodes);
|
||||
$keystr = var_export($key, true);
|
||||
$id = var_export($id, true);
|
||||
|
||||
return sprintf($this->prepare(self::BLOCK_ARG, $level), $id, $key, $id, $this->flushIndent());
|
||||
return sprintf($this->prepare(self::BLOCK_ARG, 1), $id, $key);
|
||||
}
|
||||
|
||||
const BLOCK_FUNCTION = '
|
||||
public function block%s($context)
|
||||
{
|
||||
$indent = $buffer = \'\';%s
|
||||
|
||||
return $buffer;
|
||||
}
|
||||
';
|
||||
|
||||
/**
|
||||
* Generate Mustache Template inheritance block function PHP source.
|
||||
*
|
||||
* @param array $nodes Array of child tokens
|
||||
*
|
||||
* @return string key of new block function
|
||||
*/
|
||||
private function block($nodes)
|
||||
{
|
||||
$code = $this->walk($nodes, 0);
|
||||
$key = ucfirst(md5($code));
|
||||
|
||||
if (!isset($this->blocks[$key])) {
|
||||
$this->blocks[$key] = sprintf($this->prepare(self::BLOCK_FUNCTION, 0), $key, $code);
|
||||
}
|
||||
|
||||
return $key;
|
||||
}
|
||||
|
||||
const SECTION_CALL = '
|
||||
@@ -318,7 +346,8 @@ class Mustache_Compiler
|
||||
}
|
||||
|
||||
return $buffer;
|
||||
}';
|
||||
}
|
||||
';
|
||||
|
||||
/**
|
||||
* Generate Mustache Template section PHP source.
|
||||
@@ -368,7 +397,8 @@ class Mustache_Compiler
|
||||
$value = $context->%s(%s);%s
|
||||
if (empty($value)) {
|
||||
%s
|
||||
}';
|
||||
}
|
||||
';
|
||||
|
||||
/**
|
||||
* Generate Mustache Template inverted section PHP source.
|
||||
@@ -601,6 +631,12 @@ class Mustache_Compiler
|
||||
return 'last';
|
||||
}
|
||||
|
||||
if (isset($this->pragmas[Mustache_Engine::PRAGMA_ANCHORED_DOT]) && $this->pragmas[Mustache_Engine::PRAGMA_ANCHORED_DOT]) {
|
||||
if (substr($id, 0, 1) === '.') {
|
||||
return 'findAnchoredDot';
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($id, '.') === false) {
|
||||
return 'find';
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -141,6 +141,42 @@ class Mustache_Context
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find an 'anchored dot notation' variable in the Context stack.
|
||||
*
|
||||
* This is the same as findDot(), except it looks in the top of the context
|
||||
* stack for the first value, rather than searching the whole context stack
|
||||
* and starting from there.
|
||||
*
|
||||
* @see Mustache_Context::findDot
|
||||
*
|
||||
* @throws Mustache_Exception_InvalidArgumentException if given an invalid anchored dot $id.
|
||||
*
|
||||
* @param string $id Dotted variable selector
|
||||
*
|
||||
* @return mixed Variable value, or '' if not found
|
||||
*/
|
||||
public function findAnchoredDot($id)
|
||||
{
|
||||
$chunks = explode('.', $id);
|
||||
$first = array_shift($chunks);
|
||||
if ($first !== '') {
|
||||
throw new Mustache_Exception_InvalidArgumentException(sprintf('Unexpected id for findAnchoredDot: %s', $id));
|
||||
}
|
||||
|
||||
$value = $this->last();
|
||||
|
||||
foreach ($chunks as $chunk) {
|
||||
if ($value === '') {
|
||||
return $value;
|
||||
}
|
||||
|
||||
$value = $this->findVariableInStack($chunk, array($value));
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find an argument in the block context stack.
|
||||
*
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -23,16 +23,18 @@
|
||||
*/
|
||||
class Mustache_Engine
|
||||
{
|
||||
const VERSION = '2.8.0';
|
||||
const VERSION = '2.9.0';
|
||||
const SPEC_VERSION = '1.1.2';
|
||||
|
||||
const PRAGMA_FILTERS = 'FILTERS';
|
||||
const PRAGMA_BLOCKS = 'BLOCKS';
|
||||
const PRAGMA_ANCHORED_DOT = 'ANCHORED-DOT';
|
||||
|
||||
// Known pragmas
|
||||
private static $knownPragmas = array(
|
||||
self::PRAGMA_FILTERS => true,
|
||||
self::PRAGMA_BLOCKS => true,
|
||||
self::PRAGMA_ANCHORED_DOT => true,
|
||||
);
|
||||
|
||||
// Template cache
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -119,6 +119,67 @@ class Mustache_Test_ContextTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('win', $context->find('baz'), 'ArrayAccess stands alone');
|
||||
$this->assertEquals('win', $context->find('qux'), 'ArrayAccess beats private property');
|
||||
}
|
||||
|
||||
public function testAnchoredDotNotation()
|
||||
{
|
||||
$context = new Mustache_Context();
|
||||
|
||||
$a = array(
|
||||
'name' => 'a',
|
||||
'number' => 1,
|
||||
);
|
||||
|
||||
$b = array(
|
||||
'number' => 2,
|
||||
'child' => array(
|
||||
'name' => 'baby bee',
|
||||
),
|
||||
);
|
||||
|
||||
$c = array(
|
||||
'name' => 'cee',
|
||||
);
|
||||
|
||||
$context->push($a);
|
||||
$this->assertEquals('a', $context->find('name'));
|
||||
$this->assertEquals('', $context->findDot('.name'));
|
||||
$this->assertEquals('a', $context->findAnchoredDot('.name'));
|
||||
$this->assertEquals(1, $context->find('number'));
|
||||
$this->assertEquals('', $context->findDot('.number'));
|
||||
$this->assertEquals(1, $context->findAnchoredDot('.number'));
|
||||
|
||||
$context->push($b);
|
||||
$this->assertEquals('a', $context->find('name'));
|
||||
$this->assertEquals(2, $context->find('number'));
|
||||
$this->assertEquals('', $context->findDot('.name'));
|
||||
$this->assertEquals('', $context->findDot('.number'));
|
||||
$this->assertEquals('', $context->findAnchoredDot('.name'));
|
||||
$this->assertEquals(2, $context->findAnchoredDot('.number'));
|
||||
$this->assertEquals('baby bee', $context->findDot('child.name'));
|
||||
$this->assertEquals('', $context->findDot('.child.name'));
|
||||
$this->assertEquals('baby bee', $context->findAnchoredDot('.child.name'));
|
||||
|
||||
$context->push($c);
|
||||
$this->assertEquals('cee', $context->find('name'));
|
||||
$this->assertEquals('', $context->findDot('.name'));
|
||||
$this->assertEquals('cee', $context->findAnchoredDot('.name'));
|
||||
$this->assertEquals(2, $context->find('number'));
|
||||
$this->assertEquals('', $context->findDot('.number'));
|
||||
$this->assertEquals('', $context->findAnchoredDot('.number'));
|
||||
$this->assertEquals('baby bee', $context->findDot('child.name'));
|
||||
$this->assertEquals('', $context->findDot('.child.name'));
|
||||
$this->assertEquals('', $context->findAnchoredDot('.child.name'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Mustache_Exception_InvalidArgumentException
|
||||
*/
|
||||
public function testAnchoredDotNotationThrowsExceptions()
|
||||
{
|
||||
$context = new Mustache_Context();
|
||||
$context->push(array('a' => 1));
|
||||
$context->findAnchoredDot('a');
|
||||
}
|
||||
}
|
||||
|
||||
class Mustache_Test_TestDummy
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -318,7 +318,7 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
|
||||
$mustache->render('{{ foo }}{{> bar }}', array('foo' => 'FOO'));
|
||||
$log = file_get_contents($name);
|
||||
$this->assertContains('DEBUG: Instantiating template: ', $log);
|
||||
$this->assertContains("WARNING: Partial not found: \"bar\"", $log);
|
||||
$this->assertContains('WARNING: Partial not found: "bar"', $log);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -433,6 +433,57 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
$this->assertEquals('default content', $tpl->render($data));
|
||||
}
|
||||
|
||||
public function testInheritanceWithLazyEvaluation()
|
||||
{
|
||||
$partials = array(
|
||||
'parent' => '{{#items}}{{$value}}ignored{{/value}}{{/items}}',
|
||||
);
|
||||
|
||||
$this->mustache->setPartials($partials);
|
||||
|
||||
$tpl = $this->mustache->loadTemplate(
|
||||
'{{<parent}}{{$value}}<{{ . }}>{{/value}}{{/parent}}'
|
||||
);
|
||||
|
||||
$data = array('items' => array(1, 2, 3));
|
||||
|
||||
$this->assertEquals('<1><2><3>', $tpl->render($data));
|
||||
}
|
||||
|
||||
public function testInheritanceWithLazyEvaluationWhitespaceIgnored()
|
||||
{
|
||||
$partials = array(
|
||||
'parent' => '{{#items}}{{$value}}\n\nignored\n\n{{/value}}{{/items}}',
|
||||
);
|
||||
|
||||
$this->mustache->setPartials($partials);
|
||||
|
||||
$tpl = $this->mustache->loadTemplate(
|
||||
'{{<parent}}\n\n\n{{$value}}<{{ . }}>{{/value}}\n\n{{/parent}}'
|
||||
);
|
||||
|
||||
$data = array('items' => array(1, 2, 3));
|
||||
|
||||
$this->assertEquals('<1><2><3>', $tpl->render($data));
|
||||
}
|
||||
|
||||
public function testInheritanceWithLazyEvaluationAndSections()
|
||||
{
|
||||
$partials = array(
|
||||
'parent' => '{{#items}}{{$value}}\n\nignored {{.}} {{#more}} there is more {{/more}}\n\n{{/value}}{{/items}}',
|
||||
);
|
||||
|
||||
$this->mustache->setPartials($partials);
|
||||
|
||||
$tpl = $this->mustache->loadTemplate(
|
||||
'{{<parent}}\n\n\n{{$value}}<{{ . }}>{{#more}} there is less {{/more}}{{/value}}\n\n{{/parent}}'
|
||||
);
|
||||
|
||||
$data = array('items' => array(1, 2, 3), 'more' => 'stuff');
|
||||
|
||||
$this->assertEquals('<1> there is less <2> there is less <3> there is less ', $tpl->render($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getIllegalInheritanceExamples
|
||||
* @expectedException Mustache_Exception_SyntaxException
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Mustache.php.
|
||||
*
|
||||
* (c) 2010-2014 Justin Hileman
|
||||
* (c) 2010-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
class Blocks
|
||||
{
|
||||
public $items = array(1, 2, 3);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{{% BLOCKS }}
|
||||
{{< parent }}
|
||||
{{$ value }}[{{ . }}]{{/ value }}
|
||||
{{/ parent }}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
[1]
|
||||
[2]
|
||||
[3]
|
||||
@@ -0,0 +1,4 @@
|
||||
{{% BLOCKS }}
|
||||
{{# items }}
|
||||
{{$ value }}ignored{{/ value }}
|
||||
{{/ items }}
|
||||
Reference in New Issue
Block a user