Extension:SMW InlineQueryParserFunction
From MediaWiki.org
Please note: This extension is obsolete. Version 1.0 of the Semantic MediaWiki extension provides a proper {{#ask:}} parser function.
|
SMW_InlineQueryParserFunction Release status: beta |
|
|---|---|
| Implementation | Parser function |
| Description | Adds a parser function called {{#ask}} which is the logical equivalent to Semantic MediaWiki's inline query extension tag called <ask> |
| Author(s) | Jim R. Wilson (Jimbojw) |
| Version | 0.1 |
| MediaWiki | 1.10.x or higher |
| Download | SMW_InlineQueryParserFunction.php |
SMW_InlineQueryParserFunction adds a parser function called {{#ask}} which is the logical equivalent to Semantic MediaWiki's inline query extension tag called <ask>
- Project Homepage
- SMW_InlineQueryParserFunction Extension - Jimbojw.com
- Source Code
- SMW_InlineQueryParserFunction.php
- Licensing
- SMW_InlineQueryParserFunction is tentatively released under The MIT License.
[edit] Installation
- Download SMW_InlineQueryParserFunction, and be sure to rename the downloaded file to SMW_InlineQueryParserFunction.php.
- Drop this script in $IP/extensions
- Note: $IP is your MediaWiki install dir.
- Enable the extension by adding this line to your LocalSettings.php:
require_once('extensions/SMW_InlineQueryParserFunction.php');- Note: Make sure this appears later in LocalSettings than the include_once() call which enables Semantic MediaWiki itself!
[edit] Usage
Once installed, you (or editors of your wiki) may perform Semantic inline queries in parser function form.
[edit] Example
To query for an unordered list of results in extension tag form, you might do this:
<ask format="ul">[[some relation to::Some Page]]</ask>
The equivalent parser function form is this:
{{#ask:format=ul|[[some relation to::Some Page]]}}
-or-
{{#ask:[[some relation to::Some Page]]|format=ul}}
If the text of the query would contain an '=' sign, then the text portion should be prepended with 'query='.
For example, this extension tag query:
<ask format="ol"> [[Category:Country]] [[located in::Africa]] [[Population:=*]] </ask>
Would fail due to the '=' sign in the Population clause if it were to be specified like this:
{{#ask:format=ol|
[[Category:Country]]
[[located in::Africa]]
[[Population:=*]]
}}
However, it should work just fine if specified like this:
{{#ask:format=ol|query=
[[Category:Country]]
[[located in::Africa]]
[[Population:=*]]
}}
[edit] Technical Details
A sizable chunk of the Semantic MediaWiki code surrounding the processing of Inline Queries was duplicated to create this extension to avoid modifying the SMW core.
Ideally, these changes would be integrated directly into a future release of the extension since they're passive regarding existing functionality.

