From b889410502632ffb3e3fd2b3b1fd7234393f077f Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 1 Feb 2024 09:16:10 +0200 Subject: [PATCH] add extra space filter --- src/Dokuwiki/Reader.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Dokuwiki/Reader.php b/src/Dokuwiki/Reader.php index a10ee78..b51bb27 100644 --- a/src/Dokuwiki/Reader.php +++ b/src/Dokuwiki/Reader.php @@ -32,6 +32,13 @@ class Reader // Links + /// Remove extra spaces + '/\[\[\s?([^\|]+)\s?\|\s?([^\]]+)\s?\]\]/' => '[[$1|$2]]', + '/\[\[\s?([^\]]+)\s?\]\]/' => '[[$1]]', + + '/\{\{\s?([^\|]+)\s?\|\s?([^\}]+)\s?\}\}/' => '{{$1|$2}}', + '/\{\{\s?([^\}]+)\s?\}\}/' => '{{$1}}', + /// Wikipedia '/\[\[wp([A-z]{2,})>([^\|]+)\|([^\]]+)\]\]/i' => PHP_EOL . '=> https://$1.wikipedia.org/wiki/$2 $3' . PHP_EOL, '/\[\[wp>([^\|]+)\|([^\]]+)\]\]/i' => PHP_EOL . '=> https://en.wikipedia.org/wiki/$1 $2' . PHP_EOL, @@ -43,13 +50,13 @@ class Reader '/\{\{indexmenu>:([^\}]+)\}\}/i' => PHP_EOL . '=> $1' . PHP_EOL, // @TODO '/\{\{indexmenu_n>[\d]+\}\}/i' => '', // @TODO + // Related + '/\[\[this>([^\|]+)\|([^\]]+)\]\]/i' => '$2', + /// Relative '/\[\[(?!https?:|gemini:|this>|doku>|wp[A-z]{0,2}>)([^\|]+)\|([^\]]+)\]\]/i' => PHP_EOL . '=> /$1 $2$3' . PHP_EOL, '/\[\[(?!https?:|gemini:|this>|doku>|wp[A-z]{0,2}>)([^\]]+)\]\]/i' => PHP_EOL . '=> /$1 $2' . PHP_EOL, - // Related - '/\[\[this>([^\|]+)\|([^\]]+)\]\]/i' => '$2', - /// Absolute '/\[\[(https?:|gemini:)([^\|]+)\|([^\]]+)\]\]/i' => PHP_EOL . '=> $1$2 $3' . PHP_EOL,