1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-26 05:32:59 +00:00

Tweak variable parsing to allow for special variables later.

This commit is contained in:
Starbeamrainbowlabs 2016-03-20 16:38:36 +00:00
parent 4adf02a549
commit f4ffa86394
3 changed files with 13 additions and 3 deletions

View file

@ -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
]; ];
} }
} }

View file

@ -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
} }
] ]

View file

@ -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
]; ];
} }
} }