mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 04:23:01 +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))
|
if(preg_match("/\{\{\{([^}]+)\}\}\}/", $fragment["text"], $matches))
|
||||||
{
|
{
|
||||||
$variableKey = trim($matches[1]);
|
$variableKey = trim($matches[1]);
|
||||||
|
|
||||||
|
$variableValue = false;
|
||||||
if(isset(array_slice($this->paramStack, -1)[0][$variableKey]))
|
if(isset(array_slice($this->paramStack, -1)[0][$variableKey]))
|
||||||
|
$variableValue = array_slice($this->paramStack, -1)[0][$variableKey];
|
||||||
|
|
||||||
|
if($variableValue)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
"extent" => strlen($matches[0]),
|
"extent" => strlen($matches[0]),
|
||||||
"markup" => array_slice($this->paramStack, -1)[0][$variableKey]
|
"markup" => $variableValue
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@
|
||||||
"author": "Emanuil Rusev & Starbeamrainbowlabs",
|
"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.",
|
"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",
|
"id": "parser-parsedown",
|
||||||
"lastupdate": 1458490248,
|
"lastupdate": 1458491883,
|
||||||
"optional": false
|
"optional": false
|
||||||
}
|
}
|
||||||
]
|
]
|
|
@ -85,11 +85,16 @@ class PeppermintParsedown extends ParsedownExtra
|
||||||
if(preg_match("/\{\{\{([^}]+)\}\}\}/", $fragment["text"], $matches))
|
if(preg_match("/\{\{\{([^}]+)\}\}\}/", $fragment["text"], $matches))
|
||||||
{
|
{
|
||||||
$variableKey = trim($matches[1]);
|
$variableKey = trim($matches[1]);
|
||||||
|
|
||||||
|
$variableValue = false;
|
||||||
if(isset(array_slice($this->paramStack, -1)[0][$variableKey]))
|
if(isset(array_slice($this->paramStack, -1)[0][$variableKey]))
|
||||||
|
$variableValue = array_slice($this->paramStack, -1)[0][$variableKey];
|
||||||
|
|
||||||
|
if($variableValue)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
"extent" => strlen($matches[0]),
|
"extent" => strlen($matches[0]),
|
||||||
"markup" => array_slice($this->paramStack, -1)[0][$variableKey]
|
"markup" => $variableValue
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue