Open main menu

Extension:SemanticMustacheFormat

MediaWiki extensions manual
OOjs UI icon advanced.svg
Semantic Mustache Format
Release status: unmaintained
Implementation ContentHandler, Data extraction
Description Mustache template integration into Semantic MediaWiki queries.
Author(s) Tony Crisci (Wikifoottalk)
Latest version 0.0.1 (2013-08-11)
MediaWiki 1.21+
PHP 5.4+
Database changes No
License GNU General Public License 2.0 or later
Download
README
Parameters
  • $srfmHelpers
  • $srfmDefaultHelperModule
Hooks used
ContentHandlerDefaultModelFor
Translate the SemanticMustacheFormat extension if it is available at translatewiki.net
Check usage and version matrix.

The SemanticMustacheFormat extension lets your users create views from semantic queries using Mustache templates. It adds the mustache result format to the ask parser function. Mustache templates are defined in the Mustache namespace of the wiki. The query creates the context for a template and the result is rendered to the page. If needed, a Scribunto Lua helper module can be added to the template context to add functions and variables to assist in formatting. After the template is rendered, it is parsed as WikiText along with the rest of the page.

See the README file for a detailed example and detailed usage description.

Contents

InstallationEdit

Using gitEdit

In your extensions directory install the extension and its dependency submodule, mustache.php.

git clone --recursive https://github.com/acrisci/SemanticMustacheFormat.git

Download tarballEdit

  • Download, extract and place the file(s) in a directory called SemanticMustacheFormat in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/SemanticMustacheFormat/SemanticMustacheFormat.php";
    
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration parametersEdit

In LocalSettings.phpEdit

$srfmHelpers: Array of PHP helper functions or variables that will be available in all templates. If the helper is a function, it must be a closure instance or an invokable class.

$srfmDefaultHelperModule: The title of a page in the Module namespace that will be included by default on all templates.

Parameters added to the ask parser functionEdit

format=mustache: Use Semantic Mustache Format extension to create the output of this parser function call.

template: Set to the title of a page in the Mustache namespace you would like to use.

helper module: Set to the title of a page in the Module namespace you would like to use for helper functions and variables (requires Scribunto).

formatting=none: Set this to format numbers and quantities to be plain values you can decode easily in helper functions.

has templates=true: Fully parse templates and parser functions after the template has been compiled. Note that the default Mustache tags will conflict with WikiText tags. You can use a different set of delimiters, like ERB style <% and %> by prepending {{=<% %>=}} to your Mustache template.

See alsoEdit