From c74c41c3b88669802c96c565f04b2682a54d43e9 Mon Sep 17 00:00:00 2001 From: BattleMage Date: Thu, 27 Feb 2020 11:44:51 +0100 Subject: Allow wiki link titles Allow linking to wiki pages with alternating titles by separating the title from the link with a pipe, like regular wiki markup does. --- Zotlabs/Lib/NativeWikiPage.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php index dddd26af3..d84cc50a8 100644 --- a/Zotlabs/Lib/NativeWikiPage.php +++ b/Zotlabs/Lib/NativeWikiPage.php @@ -530,8 +530,11 @@ class NativeWikiPage { foreach ($match[1] as $m) { // TODO: Why do we need to double urlencode for this to work? //$pageURLs[] = urlencode(urlencode(escape_tags($m))); - $pageURLs[] = Zlib\NativeWiki::name_encode(escape_tags($m)); - $pages[] = $m; + $titleUri = explode('|',$m); + $page = $titleUri[0] ?? ''; + $title = $titleUri[1] ?? $page; + $pageURLs[] = Zlib\NativeWiki::name_encode(escape_tags($page)); + $pages[] = $title; } $idx = 0; while(strpos($s,'[[') !== false) { -- cgit v1.2.3