forked from houshuang/folders2web
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
plugin for dokuwiki, new form of links [#link], which doesn't cause b…
…acklinks
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
base neutrallinks | ||
author Stian Haklev | ||
email [email protected] | ||
date 2011-06-14 | ||
name Neutral Links | ||
desc Provide optional link format [#], does not cause backlinks | ||
url http://reganmian.net/wiki/researchr:start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
/** | ||
* Plugin Now: Inserts a timestamp. | ||
* | ||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html) | ||
* @author Christopher Smith <[email protected]> | ||
*/ | ||
|
||
// must be run within DokuWiki | ||
if(!defined('DOKU_INC')) die(); | ||
|
||
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); | ||
require_once DOKU_PLUGIN.'syntax.php'; | ||
|
||
/** | ||
* All DokuWiki plugins to extend the parser/rendering mechanism | ||
* need to inherit from this class | ||
*/ | ||
class syntax_plugin_neutrallinks extends DokuWiki_Syntax_Plugin { | ||
|
||
|
||
function getType() { return 'substition'; } | ||
function getSort() { return 2; } | ||
function getAllowedTypes() { return array();} | ||
function connectTo($mode) { | ||
$this->Lexer->addSpecialPattern('\[#.+?\]',$mode,'plugin_neutrallinks'); | ||
// $this->Lexer->addSpecialPattern('NOW',$mode,'plugin_neutrallinks'); | ||
} | ||
|
||
function handle($match, $state, $pos, &$handler) { | ||
return array($match, $state, $pos); | ||
} | ||
|
||
function render($mode, &$renderer, $data) { | ||
if($mode == 'xhtml'){ | ||
$text = substr($data[0],1,-1); | ||
$split = preg_split('/\|/', $text); | ||
// if preg_match('/\|/',$text){ | ||
$renderer->doc .= $renderer->internallink($split[0], $split[1]); | ||
// } else{ | ||
// $renderer->doc .= $renderer->internallink($split[0]);}; | ||
return true; | ||
} | ||
return false; | ||
} | ||
} |