Skip to content
Snippets Groups Projects
Commit 618f5bc0 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #1558 from greezybacon/issue/1307


html2text: Avoid long, wrapped URLs in a tags

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents d8bda92a 96832056
No related branches found
No related tags found
No related merge requests found
......@@ -448,6 +448,11 @@ class HtmlAElement extends HtmlInlineElement {
$href = substr($href, 7);
$output = (($href != $output) ? "$href " : '') . "<$output>";
} elseif (mb_strwidth($href) > $width / 2) {
if (mb_strwidth($output) > $width / 2) {
// Parse URL and use relative path part
if ($PU = parse_url($output))
$output = $PU['host'] . $PU['path'];
}
if ($href != $output)
$id = $this->getRoot()->addFootnote($output, $href);
$output = "[$output][$id]";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment