hello!

in ask queries with template, parser functions and further transclusions inside
the template did not work. only the arguments and magic variables were
successfuly replaced. but this turned out to be quite easy to fix.

attached is a patch that changes the way template format in ask queries uses the parser. two changes: it now uses the global mediawiki parser and it uses the recursiveTagParse
function instead of parse()->getText()

hope someone can test this and apply it. thanks for developing this very useful extension!

LF

Index: SemanticMediaWiki/includes/SMW_QP_Template.php
===================================================================
--- SemanticMediaWiki/includes/SMW_QP_Template.php	(revision 26641)
+++ SemanticMediaWiki/includes/SMW_QP_Template.php	(working copy)
@@ -26,7 +26,7 @@
 
 	public function getHTML($res) {
 		// handle factbox
-		global $smwgStoreActive, $wgTitle;
+	        global $smwgStoreActive, $wgTitle, $wgParser;
 
 		// print all result rows
 		if ($this->m_template == false) {
@@ -38,9 +38,6 @@
 
 		$parserinput = $this->mIntro;
 
-		$parser_options = new ParserOptions();
-		$parser_options->setEditSection(false);  // embedded sections should not have edit links
-		$parser = new Parser();
 		while ( $row = $res->getNext() ) {
 			$wikitext = '';
 			$firstcol = true;
@@ -59,8 +56,7 @@
 			}
 			$parserinput .= '{{' . $this->m_template .  $wikitext . '}}';
 		}
-		$parserOutput = $parser->parse($parserinput, $wgTitle, $parser_options);
-		$result = $parserOutput->getText();
+		$result = $wgParser->recursiveTagParse($parserinput);
 		// show link to more results
 		if ($this->mInline && $res->hasFurtherResults()) {
 			$label = $this->mSearchlabel;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to