Page MenuHomePhabricator

D16083.diff
No OneTemporary

D16083.diff

diff --git a/src/applications/phriction/markup/PhrictionRemarkupRule.php b/src/applications/phriction/markup/PhrictionRemarkupRule.php
--- a/src/applications/phriction/markup/PhrictionRemarkupRule.php
+++ b/src/applications/phriction/markup/PhrictionRemarkupRule.php
@@ -16,7 +16,15 @@
}
public function markupDocumentLink(array $matches) {
- $link = trim($matches[1]);
+ // If the link contains an anchor, separate that off first.
+ $parts = explode('#', trim($matches[1]), 2);
+ if (count($parts) == 2) {
+ $link = $parts[0];
+ $anchor = $parts[1];
+ } else {
+ $link = $parts[0];
+ $anchor = null;
+ }
// Handle relative links.
if ((substr($link, 0, 2) === './') || (substr($link, 0, 3) === '../')) {
@@ -67,6 +75,7 @@
$metadata[] = array(
'token' => $token,
'link' => $link,
+ 'anchor' => $anchor,
'explicitName' => $name,
);
$engine->setTextMetadata(self::KEY_RULE_PHRICTION_LINK, $metadata);
@@ -140,12 +149,13 @@
}
}
- $uri = new PhutilURI($link);
- $slug = $uri->getPath();
- $fragment = $uri->getFragment();
- $slug = PhabricatorSlug::normalize($slug);
- $slug = PhrictionDocument::getSlugURI($slug);
- $href = (string)id(new PhutilURI($slug))->setFragment($fragment);
+ $uri = new PhutilURI($link);
+ $slug = $uri->getPath();
+ $slug = PhabricatorSlug::normalize($slug);
+ $slug = PhrictionDocument::getSlugURI($slug);
+
+ $anchor = idx($spec, 'anchor');
+ $href = (string)id(new PhutilURI($slug))->setFragment($anchor);
$text_mode = $this->getEngine()->isTextMode();
$mail_mode = $this->getEngine()->isHTMLMailMode();
diff --git a/src/infrastructure/markup/PhabricatorMarkupEngine.php b/src/infrastructure/markup/PhabricatorMarkupEngine.php
--- a/src/infrastructure/markup/PhabricatorMarkupEngine.php
+++ b/src/infrastructure/markup/PhabricatorMarkupEngine.php
@@ -42,7 +42,7 @@
private $objects = array();
private $viewer;
private $contextObject;
- private $version = 15;
+ private $version = 16;
private $engineCaches = array();
private $auxiliaryConfig = array();

File Metadata

Mime Type
text/plain
Expires
Sat, May 11, 11:31 AM (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6285521
Default Alt Text
D16083.diff (2 KB)

Event Timeline