Indefero

Indefero Commit Details


Date:2010-09-01 07:50:04 (14 years 3 months ago)
Author:Matthew Dawson
Branch:develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, master, release-1.1, release-1.2, release-1.3
Commit:c5c7ebff04aef21ce8952e259b49c7448e0242bd
Parents: 14d07a22e2a4688d4cd88229aa55ccbeefd61aef
Message:Improved the wiki links to have better descripting links.

Changes:

File differences

src/IDF/Template/Markdown.php
4646
4747
4848
49
50
51
52
4953
5054
51
55
5256
5357
5458
5559
5660
61
62
63
64
65
66
5767
5868
5969
60
70
6171
62
63
64
6572
6673
67
74
6875
6976
7077
array($this, 'callbackEmbeddedDoc'),
$text);
}
// Replace [Page]([[PageName]]) with corresponding link to the page, with link text being Page.
$text = preg_replace_callback('#\[([^\]]+)\]\(\[\[([A-Za-z0-9\-]+)\]\]\)#im',
array($this, 'callbackWikiPage'),
$text);
// Replace [[PageName]] with corresponding link to the page.
$text = preg_replace_callback('#\[\[([A-Za-z0-9\-]+)\]\]#im',
array($this, 'callbackWikiPage'),
array($this, 'callbackWikiPageNoName'),
$text);
$filter = new IDF_Template_MarkdownPrefilter();
echo $filter->go(Pluf_Text_MarkDown_parse($text));
}
function callbackWikiPageNoName($m)
{
$m[2] = $m[1]; //Set the link text to be the same as the page name.
return $this->callbackWikiPage($m);
}
function callbackWikiPage($m)
{
$sql = new Pluf_SQL('project=%s AND title=%s',
array($this->project->id, $m[1]));
array($this->project->id, $m[2]));
$pages = Pluf::factory('IDF_WikiPage')->getList(array('filter'=>$sql->gen()));
if ($pages->count() != 1 and !$this->request->rights['hasWikiAccess']) {
return $m[0];
}
if ($pages->count() != 1 and $this->request->rights['hasWikiAccess']
and !$this->request->user->isAnonymous()) {
return '<img style="vertical-align: text-bottom;" alt=" " src="'.Pluf::f('url_media').'/idf/img/add.png" /><a href="'.Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::create', array($this->project->shortname), array('name'=>$m[1])).'" title="'.__('Create this documentation page').'">'.$m[1].'</a>';
return '<img style="vertical-align: text-bottom;" alt=" " src="'.Pluf::f('url_media').'/idf/img/add.png" /><a href="'.Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::create', array($this->project->shortname), array('name'=>$m[2])).'" title="'.__('Create this documentation page').'">'.$m[1].'</a>';
}
if (!$this->request->rights['hasWikiAccess'] or $pages->count() == 0) {
return $m[1];

Archive Download the corresponding diff file

Page rendered in 0.08215s using 13 queries.