Special casing for elements with no name

This commit is contained in:
Aidan Woods 2018-03-18 22:36:30 +00:00
parent 1a47e74be1
commit 65d7bc5013
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9
1 changed files with 14 additions and 2 deletions

View File

@ -1489,12 +1489,18 @@ class Parsedown
{
$markup = '';
$autoBreak = true;
foreach ($Elements as $Element)
{
$markup .= "\n" . $this->element($Element);
// (autobreak === false) covers both sides of an element
$autoBreak = !$autoBreak ? $autoBreak : isset($Element['name']);
$markup .= ($autoBreak ? "\n" : '') . $this->element($Element);
$autoBreak = isset($Element['name']);
}
$markup .= "\n";
$markup .= $autoBreak ? "\n" : '';
return $markup;
}
@ -1539,6 +1545,12 @@ class Parsedown
'img' => 'src',
);
if ( ! isset($Element['name']))
{
unset($Element['attributes']);
return $Element;
}
if (isset($safeUrlNameToAtt[$Element['name']]))
{
$Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]);