Extension:External Data/Local programs

As of version 3.0, you can use External Data to retrieve data returned by a program run server-side. There are two ways to do this: by calling one of the standard parser (or Lua functions), or by calling a custom tag, defined with the  field in the data source definition, which handles both the retrieval and display of the data (the tag emulation mode). One advantage of the latter approach is that it allows for outputting raw HTML (most importantly, SVG); see the "Tag emulation mode" below for how to do it.

For the former approach: starting with version 3.2, the recommended way to retrieve program data is to use one of the display functions (#external_value, #for_external_table, etc.), passing in the necessary parameters for the data retrieval, most notably "source=". You can also retrieve program data by calling either #get_program_data or #get_external_data. In all of these cases, you must specify the information for the program in the variable $wgExternalDataSources in LocalSettings.php.

For any of these parser functions, you can also call its corresponding Lua function.

Simple example
A simple example, involving only text processing, is below: and

Tag emulation mode
Below is a more complicated example using tag emulation mode:

Usage
After a program is configured, it can be invoked in tag emulation mode: pair.

This mode outputs raw unwikified data and is suitable for embedding SVG.

Parameters
All of the parsing-related parameters that #get_web_data supports (format, delimiter, use xpath, etc.) can be used for #get_program_data as well; see.

The caching-related parameters (cache seconds and use stale cache) and settings that #get_web_data supports can be used for #get_program_data as well; see.

So can be :  and.

Limitations
Due to the way that Shell framework quotes each component of a shell command, piping cannot be used. A shell script should be created to wrap a pipeline.

Caution
Although programs are run in a restricted environment by, wiki admins should exercise great caution while configuring programs to make them callable with #get_program_data.

A set of tested examples can be found here and (with working output) here.