Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15282813
D10449.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D10449.diff
View Options
diff --git a/src/markup/__tests__/PhutilMarkupTestCase.php b/src/markup/__tests__/PhutilMarkupTestCase.php
--- a/src/markup/__tests__/PhutilMarkupTestCase.php
+++ b/src/markup/__tests__/PhutilMarkupTestCase.php
@@ -76,6 +76,7 @@
' http://www.example.org/' => true,
'ftp://filez.com' => true,
'mailto:santa@northpole.com' => true,
+ 'tel:18005555555' => true,
);
foreach ($map as $input => $expect) {
diff --git a/src/markup/engine/__tests__/PhutilRemarkupEngineTestCase.php b/src/markup/engine/__tests__/PhutilRemarkupEngineTestCase.php
--- a/src/markup/engine/__tests__/PhutilRemarkupEngineTestCase.php
+++ b/src/markup/engine/__tests__/PhutilRemarkupEngineTestCase.php
@@ -73,6 +73,7 @@
array(
'http' => true,
'mailto' => true,
+ 'tel' => true,
));
$rules = array();
diff --git a/src/markup/engine/__tests__/remarkup/link-tel.txt b/src/markup/engine/__tests__/remarkup/link-tel.txt
new file mode 100644
--- /dev/null
+++ b/src/markup/engine/__tests__/remarkup/link-tel.txt
@@ -0,0 +1,18 @@
+[[ tel:18005555555 | call me ]]
+
+[ call me ]( tel:18005555555 )
+
+[[tel:18005555555]]
+
+~~~~~~~~~~
+<p><a href="tel:18005555555" class="remarkup-link" target="_blank" rel="noreferrer">call me</a></p>
+
+<p><a href="tel:18005555555" class="remarkup-link" target="_blank" rel="noreferrer">call me</a></p>
+
+<p><a href="tel:18005555555" class="remarkup-link" target="_blank" rel="noreferrer">18005555555</a></p>
+~~~~~~~~~~
+call me <18005555555>
+
+call me <18005555555>
+
+18005555555
diff --git a/src/markup/engine/remarkup/markuprule/PhutilRemarkupDocumentLinkRule.php b/src/markup/engine/remarkup/markuprule/PhutilRemarkupDocumentLinkRule.php
--- a/src/markup/engine/remarkup/markuprule/PhutilRemarkupDocumentLinkRule.php
+++ b/src/markup/engine/remarkup/markuprule/PhutilRemarkupDocumentLinkRule.php
@@ -34,8 +34,8 @@
$text = $base.$text;
}
- // If present, strip off "mailto:".
- $text = preg_replace('/^mailto:/', '', $text);
+ // If present, strip off "mailto:" or "tel:".
+ $text = preg_replace('/^(?:mailto|tel):/', '', $text);
if ($link == $name) {
return $text;
@@ -50,7 +50,7 @@
$target = null;
}
- $name = preg_replace('/^mailto:/', '', $name);
+ $name = preg_replace('/^(?:mailto|tel):/', '', $name);
if ($this->getEngine()->getState('toc')) {
return $name;
@@ -82,7 +82,8 @@
}
if (strpos($uri, '/') === false &&
- strpos($uri, '@') === false) {
+ strpos($uri, '@') === false &&
+ strncmp($uri, 'tel:', 4)) {
return $matches[0];
}
@@ -99,8 +100,8 @@
$name = trim(idx($matches, 2, $uri));
// If whatever is being linked to begins with "/" or "#", or has "://",
- // or is "mailto:", treat it as a URI instead of a wiki page.
- $is_uri = preg_match('@(^/)|(://)|(^#)|(^mailto:)@', $uri);
+ // or is "mailto:" or "tel:", treat it as a URI instead of a wiki page.
+ $is_uri = preg_match('@(^/)|(://)|(^#)|(^(?:mailto|tel):)@', $uri);
if ($is_uri && strncmp('/', $uri, 1) && strncmp('#', $uri, 1)) {
$protocols = $this->getEngine()->getConfig(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 5, 2:43 AM (1 w, 2 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7223386
Default Alt Text
D10449.diff (3 KB)
Attached To
Mode
D10449: Support "tel:" protocol in Remarkup
Attached
Detach File
Event Timeline
Log In to Comment