From 7f88056bd9457110c8bb65326bef2dbd8483d74a Mon Sep 17 00:00:00 2001 From: Loic d'Anterroches Date: Sun, 23 Nov 2008 14:58:43 +0100 Subject: [PATCH] Fixed autolinking breaking MarkDown links. --- src/IDF/Template/IssueComment.php | 10 ++++++---- src/IDF/Template/Markdown.php | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/IDF/Template/IssueComment.php b/src/IDF/Template/IssueComment.php index 6c2c85e..d814799 100644 --- a/src/IDF/Template/IssueComment.php +++ b/src/IDF/Template/IssueComment.php @@ -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:]/]', - '\\0', - $text); + if ($autolink) { + $text = ereg_replace('[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]', + '\\0', + $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); diff --git a/src/IDF/Template/Markdown.php b/src/IDF/Template/Markdown.php index 6c0cc7e..8363014 100644 --- a/src/IDF/Template/Markdown.php +++ b/src/IDF/Template/Markdown.php @@ -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',