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

Remove use of array

This commit is contained in:
Aidan Woods 2018-04-09 00:46:26 +01:00
parent c45e41950f
commit 3ea08140b6
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9

View File

@ -182,21 +182,17 @@ class Parsedown
continue; continue;
} }
if (strpos($line, "\t") !== false) for (
{ $beforeTab = strstr($line, "\t", true);
$parts = explode("\t", $line); $beforeTab !== false;
$beforeTab = strstr($line, "\t", true)
) {
$shortage = 4 - mb_strlen($beforeTab, 'utf-8') % 4;
$line = $parts[0]; $line = $beforeTab
. str_repeat(' ', $shortage)
unset($parts[0]); . substr($line, strlen($beforeTab) + 1)
;
foreach ($parts as $part)
{
$shortage = 4 - mb_strlen($line, 'utf-8') % 4;
$line .= str_repeat(' ', $shortage);
$line .= $part;
}
} }
$indent = strspn($line, ' '); $indent = strspn($line, ' ');