mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-12-22 13:45:02 +00:00
Tweak variable parsing to allow for special variables later.
This commit is contained in:
parent
4adf02a549
commit
f4ffa86394
3 changed files with 13 additions and 3 deletions
|
@ -3807,11 +3807,16 @@ class PeppermintParsedown extends ParsedownExtra
|
|||
if(preg_match("/\{\{\{([^}]+)\}\}\}/", $fragment["text"], $matches))
|
||||
{
|
||||
$variableKey = trim($matches[1]);
|
||||
|
||||
$variableValue = false;
|
||||
if(isset(array_slice($this->paramStack, -1)[0][$variableKey]))
|
||||
$variableValue = array_slice($this->paramStack, -1)[0][$variableKey];
|
||||
|
||||
if($variableValue)
|
||||
{
|
||||
return [
|
||||
"extent" => strlen($matches[0]),
|
||||
"markup" => array_slice($this->paramStack, -1)[0][$variableKey]
|
||||
"markup" => $variableValue
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
"author": "Emanuil Rusev & Starbeamrainbowlabs",
|
||||
"description": "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https:\/\/github.com\/erusev\/parsedown-extra), which is licensed MIT. Please be careful, as this module adds a some weight to your installation, and also *requires* write access to the disk on first load.",
|
||||
"id": "parser-parsedown",
|
||||
"lastupdate": 1458490248,
|
||||
"lastupdate": 1458491883,
|
||||
"optional": false
|
||||
}
|
||||
]
|
|
@ -85,11 +85,16 @@ class PeppermintParsedown extends ParsedownExtra
|
|||
if(preg_match("/\{\{\{([^}]+)\}\}\}/", $fragment["text"], $matches))
|
||||
{
|
||||
$variableKey = trim($matches[1]);
|
||||
|
||||
$variableValue = false;
|
||||
if(isset(array_slice($this->paramStack, -1)[0][$variableKey]))
|
||||
$variableValue = array_slice($this->paramStack, -1)[0][$variableKey];
|
||||
|
||||
if($variableValue)
|
||||
{
|
||||
return [
|
||||
"extent" => strlen($matches[0]),
|
||||
"markup" => array_slice($this->paramStack, -1)[0][$variableKey]
|
||||
"markup" => $variableValue
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue