From 27a2b0851e6b7273beab68070c1e639454918da7 Mon Sep 17 00:00:00 2001 From: andi <andi@splitbrain.org> Date: Tue, 26 Apr 2005 20:13:58 +0200 Subject: [PATCH] more interwiki fixes #273 darcs-hash:20050426181358-9977f-3b12ff92c5671e6703d67ad518379961042da0c3.gz --- inc/confutils.php | 12 ++++++++---- inc/parser/handler.php | 10 +++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/inc/confutils.php b/inc/confutils.php index c04d39896..4a38eeaac 100644 --- a/inc/confutils.php +++ b/inc/confutils.php @@ -88,10 +88,10 @@ function getEntities() { function getInterwiki() { static $wikis = NULL; if ( !$wikis ) { - $wikis = confToHash(DOKU_INC . 'conf/interwiki.conf'); + $wikis = confToHash(DOKU_INC . 'conf/interwiki.conf',true); } //add sepecial case 'this' - $wikis[] = 'this '.DOKU_URL.'{NAME}'; + $wikis['this'] = DOKU_URL.'{NAME}'; return $wikis; } @@ -100,7 +100,7 @@ function getInterwiki() { * * @author Harry Fuecks <hfuecks@gmail.com> */ -function confToHash($file) { +function confToHash($file,$lower=false) { $conf = array(); $lines = @file( $file ); if ( !$lines ) return $conf; @@ -112,7 +112,11 @@ function confToHash($file) { if(empty($line)) continue; $line = preg_split('/\s+/',$line,2); // Build the associative array - $conf[$line[0]] = $line[1]; + if($lower){ + $conf[strtolower($line[0])] = $line[1]; + }else{ + $conf[$line[0]] = $line[1]; + } } return $conf; diff --git a/inc/parser/handler.php b/inc/parser/handler.php index d69c2be22..b1334d946 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -362,22 +362,22 @@ class Doku_Handler { //decide which kind of link it is if ( preg_match('/^[a-zA-Z]+>{1}.+$/u',$link[0]) ) { - // Interwiki + // Interwiki $interwiki = preg_split('/>/u',$link[0]); $this->_addCall( 'interwikilink', array($link[0],$link[1],strtolower($interwiki[0]),$interwiki[1]), $pos ); - }elseif ( preg_match('/\\\\\\\\[\w.:?\-;,]+?\\\\/u',$link[0]) ) { - // Windows Share + }elseif ( preg_match('/\\\\\\\\[\w.:?\-;,]+?\\\\/u',$link[0]) ) { + // Windows Share $this->_addCall( 'windowssharelink', array($link[0],$link[1]), $pos ); - }elseif ( preg_match('#([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i',$link[0]) ) { - // E-Mail + }elseif ( preg_match('#([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i',$link[0]) ) { + // E-Mail $this->_addCall( 'emaillink', array($link[0],$link[1]), -- GitLab