1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

Fix Phriction link syntax a little more

Summary: This still wasn't quite right -- a link like `[[ Porcupine Facts ]]` with a space would not lookup correctly, and would render as `porcupine_facts`.

Test Plan: Verified that `[[ Porcupine Facts ]]` now works correctly.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D15780
This commit is contained in:
epriestley 2016-04-21 10:27:12 -07:00
parent c986caebb2
commit fb2b88a4a8

View file

@ -85,6 +85,9 @@ final class PhrictionRemarkupRule extends PhutilRemarkupRule {
}
$slugs = ipull($metadata, 'link');
foreach ($slugs as $key => $slug) {
$slugs[$key] = PhabricatorSlug::normalize($slug);
}
// We have to make two queries here to distinguish between
// documents the user can't see, and documents that don't
@ -115,14 +118,14 @@ final class PhrictionRemarkupRule extends PhutilRemarkupRule {
if (idx($existant_documents, $slug) === null) {
// The target document doesn't exist.
if ($name === null) {
$name = explode('/', trim($slug, '/'));
$name = explode('/', trim($link, '/'));
$name = end($name);
}
$class = 'phriction-link-missing';
} else if (idx($visible_documents, $slug) === null) {
// The document exists, but the user can't see it.
if ($name === null) {
$name = explode('/', trim($slug, '/'));
$name = explode('/', trim($link, '/'));
$name = end($name);
}
$class = 'phriction-link-lock';