- Token name and options are now passed through parse() method

This commit is contained in:
mcndave committed 2023-02-02 19:38:40 +00:00
1 parent e9b2f0ece3
commit b3a8e3aca2
29 files changed
+70 -59

No files matched your search

+4 -3
View File
@@ -50,14 +50,15 @@ class Compiler
list($token, $arguments) = array_pad(array_filter(explode(' ', $matches[2], 2), 'strlen'), 2, null);
$token = strtolower(trim($token));
$tokenName = explode('.', $token, 2)[0];
$tokenName = $context->tokenName($token);
$tokenOptions = $context->tokenOptions($token);
# @TODO Refractor this parts to allows registration to the tag's name
if ( $this->tagList[$tokenName] ?? false ) {
return $this->tagList[$tokenName]->parse($context, $arguments, $token);
return $this->tagList[$tokenName]->parse($context, $arguments, $tokenName, $tokenOptions);
}
elseif ( $this->extensionList[$tokenName] ?? false ) {
return $this->extensionList[$tokenName]->parse($context, $arguments, $token);
return $this->extensionList[$tokenName]->parse($context, $arguments, $tokenName, $tokenOptions);
}
else {
throw new \LogicException("Impossible to find token `$tokenName` declared in `{$matches[2]}`. Perhapse you forgot to add a custom token to Picea's engine ?");