Skip to content
Permalink
Browse files

externallinks: minor adjustments

  • Loading branch information...
LarsGit223 committed Jun 26, 2018
1 parent 605005e commit 36d2cd76caa147b5457474ed8a4b8ace9ce8f831
Showing with 17 additions and 2 deletions.
  1. +15 −0 _test/tests/inc/parser/parser_links.test.php
  2. +2 −2 inc/parser/parser.php
@@ -158,6 +158,21 @@ function testExternalWWWLinkStartOfLine() {
$this->assertEquals(array_map('stripByteIndex',$instructions),$calls);
}
function testExternalWWWLinkInRoundBrackets() {
$this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink());
$this->P->parse("Foo (www.google.com) Bar");
$calls = array (
array('document_start',array()),
array('p_open',array()),
array('cdata',array("\n".'Foo (')),
array('externallink',array('http://www.google.com', 'www.google.com')),
array('cdata',array(') Bar')),
array('p_close',array()),
array('document_end',array()),
);
$this->assertEquals(array_map('stripByteIndex',$this->H->calls),$calls);
}
function testExternalWWWLinkInPath() {
$this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink());
// See issue #936. Should NOT generate a link!
@@ -955,8 +955,8 @@ function preConnect() {
$this->patterns[] = '\b(?i)'.$scheme.'(?-i)://['.$any.']+?(?=['.$punc.']*[^'.$any.'])';
}
$this->patterns[] = '(?<!/)\b(?i)www?(?-i)\.['.$host.']+?\.['.$host.']+?['.$any.']+?(?=['.$punc.']*[^'.$any.'])';
$this->patterns[] = '(?<!/)\b(?i)ftp?(?-i)\.['.$host.']+?\.['.$host.']+?['.$any.']+?(?=['.$punc.']*[^'.$any.'])';
$this->patterns[] = '(?<![/\\\\])\b(?i)www?(?-i)\.['.$host.']+?\.['.$host.']+?['.$any.']+?(?=['.$punc.']*[^'.$any.'])';
$this->patterns[] = '(?<![/\\\\])\b(?i)ftp?(?-i)\.['.$host.']+?\.['.$host.']+?['.$any.']+?(?=['.$punc.']*[^'.$any.'])';
}
function connectTo($mode) {

0 comments on commit 36d2cd7

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.