From semanticweb.org
Jump to: navigation, search

A simple template to test the template parameter of inline queries.

Possible test query:

{{#ask: [[Category:Country]] |

Status as of Sept 11 2007:

  • plain parameters: OK
  • parser functions: OK (since SMW 1.0, there is a manual fix for older SMW versions below)
  • magic templates: OK
  • embedded tempaltes: OK
  • inline queries: OK
  • inline queries + local params: OK (using the new #ask-syntax in SMW 1.0 or later), fails for <ask> (known MediaWiki parser problem, no fix available)
  • inline queries + templates: OK

The problem with parser functions that showed before SMW 1.0 was due to the ParserFunction-Bug 7051. A workaround (besides upgrading SMW) is to insert the following code into LocalSettings.php:

global $wgHooks;
$wgHooks['ParserClearState'][] = 'initParserFunctionFix';

function initParserFunctionFix(&$parser) {
	global $wgExtParserFunctions;
	$parser->setFunctionHook( 'expr', array( &$wgExtParserFunctions, 'expr' ) );
	$parser->setFunctionHook( 'if', array( &$wgExtParserFunctions, 'ifHook' ) );
	$parser->setFunctionHook( 'ifeq', array( &$wgExtParserFunctions, 'ifeq' ) );
	$parser->setFunctionHook( 'ifexpr', array( &$wgExtParserFunctions, 'ifexpr' ) );
	$parser->setFunctionHook( 'switch', array( &$wgExtParserFunctions, 'switchHook' ) );
	$parser->setFunctionHook( 'ifexist', array( &$wgExtParserFunctions, 'ifexist' ) );
	$parser->setFunctionHook( 'time', array( &$wgExtParserFunctions, 'time' ) );
	$parser->setFunctionHook( 'timel', array( &$wgExtParserFunctions, 'localTime' ) );
	$parser->setFunctionHook( 'rel2abs', array( &$wgExtParserFunctions, 'rel2abs' ) );
	$parser->setFunctionHook( 'titleparts', array( &$wgExtParserFunctions, 'titleparts' ) );
	// ... and any other functions possibly added to ParserFunctions.php in the meantime
	return true;

Note: depending on your version of ParserFunctions, some of the above might not exist, which wil cause some warning message. Try removing all lines with functions that you do not intend to use.

Page: {{{1}}} (plain parameter)
Second column: empty (parser function)
Current month: 07 (magic template)
Parameter 1: {{{1}}} (embedded template)
Events: AAAI1998 … further results (inline query)
Neighbours: Alberta … further results"{{{1}}}" cannot be used as a page name in this wiki. (inline query + local params)
Local neighbours: (inline query + templates)

Personal tools