From bfdeb23f1844dffca054cb9c17c31a2151d3d9ea Mon Sep 17 00:00:00 2001 From: lupo49 Date: Wed, 7 Mar 2012 19:58:33 +0100 Subject: Parser: Allow parser to fully recognize windows share links with a hyphen character in it (Currently, the clickable link stops before a hyphen character) --- inc/parser/parser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/parser/parser.php b/inc/parser/parser.php index 68d4e4569..cf132ce97 100644 --- a/inc/parser/parser.php +++ b/inc/parser/parser.php @@ -929,7 +929,7 @@ class Doku_Parser_Mode_windowssharelink extends Doku_Parser_Mode { var $pattern; function preConnect() { - $this->pattern = "\\\\\\\\\w+?(?:\\\\[\w$]+)+"; + $this->pattern = "\\\\\\\\\w+?(?:\\\\[\w-$]+)+"; } function connectTo($mode) { -- cgit v1.2.3 From 0b9869484e3052d68e5939bf626fbd3a840d3062 Mon Sep 17 00:00:00 2001 From: lupo49 Date: Sat, 10 Mar 2012 20:16:28 +0100 Subject: Unit Test: Adding test to check windows share link with hyphen character --- _test/cases/inc/parser/parser_links.test.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/_test/cases/inc/parser/parser_links.test.php b/_test/cases/inc/parser/parser_links.test.php index 53871e110..d0fb19570 100644 --- a/_test/cases/inc/parser/parser_links.test.php +++ b/_test/cases/inc/parser/parser_links.test.php @@ -400,6 +400,21 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { ); $this->assertEqual(array_map('stripByteIndex',$this->H->calls),$calls); } + + function testWindowsShareLinkHyphen() { + $this->P->addMode('windowssharelink',new Doku_Parser_Mode_WindowsShareLink()); + $this->P->parse('Foo \\\server\share-hyphen Bar'); + $calls = array ( + array('document_start',array()), + array('p_open',array()), + array('cdata',array("\n".'Foo ')), + array('windowssharelink',array('\\\server\share-hyphen',NULL)), + array('cdata',array(' Bar')), + array('p_close',array()), + array('document_end',array()), + ); + $this->assertEqual(array_map('stripByteIndex',$this->H->calls),$calls); + } function testWindowsShareLinkInternal() { $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); -- cgit v1.2.3