1
0

update Parsedown + ParsedownExtra

This commit is contained in:
2020-01-17 00:21:41 +01:00
parent f5a9552dbd
commit c5bc008db1
2 changed files with 201 additions and 25 deletions

View File

@@ -17,13 +17,13 @@ class ParsedownExtra extends Parsedown
{
# ~
const version = '0.7.0';
const version = '0.8.1';
# ~
function __construct()
{
if (parent::version < '1.5.0')
if (version_compare(parent::version, '1.7.4') < 0)
{
throw new Exception('ParsedownExtra requires a later version of Parsedown');
}
@@ -206,6 +206,10 @@ class ParsedownExtra extends Parsedown
{
$Block = parent::blockHeader($Line);
if (! isset($Block)) {
return null;
}
if (preg_match('/[ #]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE))
{
$attributeString = $matches[1][0];
@@ -238,6 +242,10 @@ class ParsedownExtra extends Parsedown
{
$Block = parent::blockSetextHeader($Line, $Block);
if (! isset($Block)) {
return null;
}
if (preg_match('/[ ]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE))
{
$attributeString = $matches[1][0];
@@ -302,6 +310,10 @@ class ParsedownExtra extends Parsedown
{
$Link = parent::inlineLink($Excerpt);
if (! isset($Link)) {
return null;
}
$remainder = substr($Excerpt['text'], $Link['extent']);
if (preg_match('/^[ ]*{('.$this->regexAttribute.'+)}/', $remainder, $matches))
@@ -420,7 +432,7 @@ class ParsedownExtra extends Parsedown
$Element['text'][1]['text'] []= array(
'name' => 'li',
'attributes' => array('id' => 'fn:'.$definitionId),
'text' => "\n".$text."\n",
'rawHtml' => "\n".$text."\n",
);
}