Differential D25082 Diff 367 src/infrastructure/markup/markuprule/PhutilRemarkupDocumentLinkRule.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/markup/markuprule/PhutilRemarkupDocumentLinkRule.php
Show All 39 Lines | public function apply($text) { | ||||
return $text; | return $text; | ||||
} | } | ||||
protected function renderHyperlink($link, $name) { | protected function renderHyperlink($link, $name) { | ||||
$engine = $this->getEngine(); | $engine = $this->getEngine(); | ||||
$is_anchor = false; | $is_anchor = false; | ||||
if (strncmp($link, '/', 1) == 0) { | if ($this->isURIRelativePath($link)) { | ||||
$base = phutil_string_cast($engine->getConfig('uri.base')); | $base = phutil_string_cast($engine->getConfig('uri.base')); | ||||
$base = rtrim($base, '/'); | $base = rtrim($base, '/'); | ||||
$link = $base.$link; | $link = $base.$link; | ||||
} else if (strncmp($link, '#', 1) == 0) { | } else if ($this->isURIAnchor($link)) { | ||||
$here = $engine->getConfig('uri.here'); | $here = $engine->getConfig('uri.here'); | ||||
$link = $here.$link; | $link = $here.$link; | ||||
$is_anchor = true; | $is_anchor = true; | ||||
} | } | ||||
if ($engine->isTextMode()) { | if ($engine->isTextMode()) { | ||||
// If present, strip off "mailto:" or "tel:". | // If present, strip off "mailto:" or "tel:". | ||||
▲ Show 20 Lines • Show All 123 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0