mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
Fix tabulation
Add 'macro' namespace in import support
This commit is contained in:
parent
b3480e820b
commit
7631e3508d
@ -634,6 +634,11 @@ class Compiler {
|
|||||||
return "echo ".$scope["filter"].";";
|
return "echo ".$scope["filter"].";";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Tokenizer $tokens
|
||||||
|
* @param Scope $scope
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public static function captureOpen(Tokenizer $tokens, Scope $scope) {
|
public static function captureOpen(Tokenizer $tokens, Scope $scope) {
|
||||||
if($tokens->is("|")) {
|
if($tokens->is("|")) {
|
||||||
$scope["value"] = $scope->tpl->parseModifier($tokens, "ob_get_clean()");
|
$scope["value"] = $scope->tpl->parseModifier($tokens, "ob_get_clean()");
|
||||||
@ -650,6 +655,14 @@ class Compiler {
|
|||||||
return $scope["var"]." = ".$scope["value"].";";
|
return $scope["var"]." = ".$scope["value"].";";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tag {cycle}
|
||||||
|
*
|
||||||
|
* @param Tokenizer $tokens
|
||||||
|
* @param Template $tpl
|
||||||
|
* @return string
|
||||||
|
* @throws ImproperUseException
|
||||||
|
*/
|
||||||
public static function tagCycle(Tokenizer $tokens, Template $tpl) {
|
public static function tagCycle(Tokenizer $tokens, Template $tpl) {
|
||||||
$exp = $tpl->parseExp($tokens, true);
|
$exp = $tpl->parseExp($tokens, true);
|
||||||
if($tokens->valid()) {
|
if($tokens->valid()) {
|
||||||
@ -679,6 +692,9 @@ class Compiler {
|
|||||||
}
|
}
|
||||||
if($tokens->is(T_AS)) {
|
if($tokens->is(T_AS)) {
|
||||||
$alias = $tokens->next()->get(Tokenizer::MACRO_STRING);
|
$alias = $tokens->next()->get(Tokenizer::MACRO_STRING);
|
||||||
|
if($alias === "macro") {
|
||||||
|
$alias = "";
|
||||||
|
}
|
||||||
$tokens->next();
|
$tokens->next();
|
||||||
} else {
|
} else {
|
||||||
$alias = "";
|
$alias = "";
|
||||||
@ -697,10 +713,11 @@ class Compiler {
|
|||||||
$tpl->addDepend($donor);
|
$tpl->addDepend($donor);
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Declare or invoke macros
|
* Define macro
|
||||||
*
|
*
|
||||||
* @param Tokenizer $tokens
|
* @param Tokenizer $tokens
|
||||||
* @param Scope $scope
|
* @param Scope $scope
|
||||||
|
Loading…
Reference in New Issue
Block a user