1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

"src" and "alt" attributes should come first

This commit is contained in:
Emanuil Rusev 2015-01-12 02:58:08 +02:00
parent 859b1b10c1
commit 3eb6d349f0

View File

@ -1247,22 +1247,28 @@ class Parsedown
$excerpt = substr($excerpt, 1); $excerpt = substr($excerpt, 1);
$Inline = $this->inlineLink($excerpt); $InlineLink = $this->inlineLink($excerpt);
if ($Inline === null) if ($InlineLink === null)
{ {
return; return;
} }
$Inline['extent'] ++; $Inline = array(
'extent' => $InlineLink['extent'] + 1,
'element' => array(
'name' => 'img',
'attributes' => array(
'src' => $InlineLink['element']['attributes']['href'],
'alt' => $InlineLink['element']['text'],
),
),
);
$Inline['element']['attributes'] += $InlineLink['element']['attributes'];
$Inline['element']['name'] = 'img';
$Inline['element']['attributes']['src'] = $Inline['element']['attributes']['href'];
unset($Inline['element']['attributes']['href']); unset($Inline['element']['attributes']['href']);
$Inline['element']['attributes']['alt'] = $Inline['element']['text'];
unset($Inline['element']['text']);
return $Inline; return $Inline;
} }