summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-03-14 02:35:04 -0700
committerAndreas Gohr <andi@splitbrain.org>2012-03-14 02:35:04 -0700
commitd0caa5642f6e322a026bd5bdac4585ff1b2f40da (patch)
tree9a1b11adec83d05f3ba7f148d71ddc8a369e8b2d
parent7651b376ab78457d123e1c3513a6a4b8b0d5a7e7 (diff)
parent0b9869484e3052d68e5939bf626fbd3a840d3062 (diff)
downloadrpg-d0caa5642f6e322a026bd5bdac4585ff1b2f40da.tar.gz
rpg-d0caa5642f6e322a026bd5bdac4585ff1b2f40da.tar.bz2
Merge pull request #86 from lupo49/master
Parser: Allow parser to fully recognize windows share links with a hyphen character in it
-rw-r--r--_test/cases/inc/parser/parser_links.test.php15
-rw-r--r--inc/parser/parser.php2
2 files changed, 16 insertions, 1 deletions
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());
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) {