Fixed autolinking breaking MarkDown links.

dev
Loic d'Anterroches 2008-11-23 14:58:43 +01:00
parent 39916d46f0
commit 7f88056bd9
2 changed files with 7 additions and 5 deletions

View File

@ -32,16 +32,18 @@ class IDF_Template_IssueComment extends Pluf_Template_Tag
private $request = null;
private $scm = null;
function start($text, $request, $echo=true, $wordwrap=true, $esc=true)
function start($text, $request, $echo=true, $wordwrap=true, $esc=true, $autolink=true)
{
$this->project = $request->project;
$this->request = $request;
$this->scm = IDF_Scm::get($request);
if ($wordwrap) $text = wordwrap($text, 69, "\n", true);
if ($esc) $text = Pluf_esc($text);
$text = ereg_replace('[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]',
'<a href="\\0" rel="nofollow">\\0</a>',
$text);
if ($autolink) {
$text = ereg_replace('[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]',
'<a href="\\0" rel="nofollow">\\0</a>',
$text);
}
if ($request->rights['hasIssuesAccess']) {
$text = preg_replace_callback('#(issues?|bugs?|tickets?)\s+(\d+)((\s+and|\s+or|,)\s+(\d+)){0,}#im',
array($this, 'callbackIssues'), $text);

View File

@ -51,7 +51,7 @@ class IDF_Template_Markdown extends Pluf_Template_Tag
$text = implode("\n", $tmp);
// Replace like in the issue text
$tag = new IDF_Template_IssueComment();
$text = $tag->start($text, $request, false, false, false);
$text = $tag->start($text, $request, false, false, false, false);
// Replace [[PageName]] with corresponding link to the page.
// if not the right to see the
$text = preg_replace_callback('#\[\[([A-Za-z0-9\-]+)\]\]#im',