diff -r 2529833a7731 -r 27377179fe58 includes/render.php
--- a/includes/render.php Mon Jun 30 17:22:29 2008 -0400
+++ b/includes/render.php Wed Jul 02 19:36:44 2008 -0400
@@ -217,6 +217,9 @@
global $db, $session, $paths, $template, $plugins; // Common objects
global $lang;
+ require_once(ENANO_ROOT.'/includes/wikiformat.php');
+ require_once(ENANO_ROOT.'/includes/wikiengine/Tables.php');
+
profiler_log("RenderMan: starting wikitext render");
$random_id = md5( time() . mt_rand() );
@@ -474,13 +477,19 @@
/**
* Parses internal links (wikilinks) in a block of text.
* @param string Text to process
+ * @param string Optional. If included will be used as a template instead of using the default syntax.
* @return string
*/
- public static function parse_internal_links($text)
+ public static function parse_internal_links($text, $tplcode = false)
{
global $db, $session, $paths, $template, $plugins; // Common objects
+ if ( is_string($tplcode) )
+ {
+ $parser = $template->makeParserText($tplcode);
+ }
+
// stage 1 - links with alternate text
preg_match_all('/\[\[([^\[\]<>\{\}\|]+)\|(.+?)\]\]/', $text, $matches);
foreach ( $matches[0] as $i => $match )
@@ -493,7 +502,19 @@
$quot = '"';
$exists = ( isPage($pid_clean) ) ? '' : ' class="wikilink-nonexistent"';
- $link = "{$inner_text}";
+ if ( $tplcode )
+ {
+ $parser->assign_vars(array(
+ 'HREF' => $url,
+ 'FLAGS' => $exists,
+ 'TEXT' => $inner_text
+ ));
+ $link = $parser->run();
+ }
+ else
+ {
+ $link = "{$inner_text}";
+ }
$text = str_replace($match, $link, $text);
}
@@ -510,7 +531,19 @@
$quot = '"';
$exists = ( isPage($pid_clean) ) ? '' : ' class="wikilink-nonexistent"';
- $link = "{$inner_text}";
+ if ( $tplcode )
+ {
+ $parser->assign_vars(array(
+ 'HREF' => $url,
+ 'FLAGS' => $exists,
+ 'TEXT' => $inner_text
+ ));
+ $link = $parser->run();
+ }
+ else
+ {
+ $link = "{$inner_text}";
+ }
$text = str_replace($match, $link, $text);
}
@@ -845,6 +878,7 @@
public static function diff($str1, $str2)
{
global $db, $session, $paths, $template, $plugins; // Common objects
+ require_once(ENANO_ROOT.'/includes/diff.php');
$str1 = explode("\n", $str1);
$str2 = explode("\n", $str2);
$diff = new Diff($str1, $str2);