mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Special casing for elements with no name
This commit is contained in:
parent
1a47e74be1
commit
65d7bc5013
@ -1489,12 +1489,18 @@ class Parsedown
|
|||||||
{
|
{
|
||||||
$markup = '';
|
$markup = '';
|
||||||
|
|
||||||
|
$autoBreak = true;
|
||||||
|
|
||||||
foreach ($Elements as $Element)
|
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;
|
return $markup;
|
||||||
}
|
}
|
||||||
@ -1539,6 +1545,12 @@ class Parsedown
|
|||||||
'img' => 'src',
|
'img' => 'src',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ( ! isset($Element['name']))
|
||||||
|
{
|
||||||
|
unset($Element['attributes']);
|
||||||
|
return $Element;
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($safeUrlNameToAtt[$Element['name']]))
|
if (isset($safeUrlNameToAtt[$Element['name']]))
|
||||||
{
|
{
|
||||||
$Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]);
|
$Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user