Extension:External Data/Inline
As of version 3.2, you can use External Data to get data from a structured piece of text (in a format like CSV, JSON, XML, etc.) contained directly within the relevant parser function or Lua function.
The recommended way to do this is to use one of the display functions (#external_value, #for_external_table, etc.), passing in the necessary parameters for the data retrieval. You can also retrieve inline data by calling either #get_inline_data or #get_external_data.
For any of these parser functions, you can also call its corresponding Lua function.
Usage
editThe following examples show inline data being retrieved via #get_inline_text and #get_external_data. To retrieve it instead using one of the display functions like #external_value, you should pass in the main text via the "text=" parameter, then add any other of the other necessary parameters to the same call.
Wikitext | Result |
---|---|
{{#get_inline_data: text = { "title": "JSON", "description": "An example of JSON" } | format = json with jsonpath | data = title = $.title, description = $.description }} * Title: {{#external_value:title}}. * Description: {{#external_value:description}}. |
|
{{#get_external_data: text = title,description CSV,An example of comma-separated values }} * Format: {{#external_value:__format}} * Title: {{#external_value:title}}. * Description: {{#external_value:description}}. |
|
{{#get_inline_data: title: YAML description: An example of YAML }} * Title: {{#external_value:title}}. * Description: {{#external_value:description}}. |
|