No edit summary |
No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 2: | Line 2: | ||
The following example shows the values of a wiki page with csv extension. | The following example shows the values of a wiki page with csv extension. | ||
# Create the page. In this wiki, we created Manual:Extension/External Data/example components.csv. It contains comma-separated values:<syntaxhighlight lang="text"> | # Create the page. In this wiki, we created the page [[Manual:Extension/External Data/example components.csv]]. It contains comma-separated values:<syntaxhighlight lang="text"> | ||
component,type,weight | component,type,weight | ||
Valve,mechanical,1.2 | Valve,mechanical,1.2 | ||
Sensor,electronic,0.3 | Sensor,electronic,0.3 | ||
Pump,mechanical,4.5</syntaxhighlight> | Pump,mechanical,4.5</syntaxhighlight> | ||
# On another wiki page, insert this parser function <code>#for_external_table</code> | # On another wiki page, insert this parser function <code>#for_external_table</code><syntaxhighlight lang="wikitext"> | ||
<syntaxhighlight lang="wikitext"> | |||
{{#for_external_table:<nowiki/> | {{#for_external_table:<nowiki/> | ||
* {{{component}}} – {{{type}}}, {{{weight}}} kg | * {{{component}}} – {{{type}}}, {{{weight}}} kg | ||
| Line 16: | Line 14: | ||
| format=csv | | format=csv | ||
| data=component=component, type=type, weight=weight | | data=component=component, type=type, weight=weight | ||
}} | }}</syntaxhighlight> | ||
</syntaxhighlight>The output is:{{#for_external_table:<nowiki/> | |||
The output is:{{#for_external_table:<nowiki/> | |||
* {{{component}}} – {{{type}}}, {{{weight}}} kg | * {{{component}}} – {{{type}}}, {{{weight}}} kg | ||
| source=web | | source=web | ||
Latest revision as of 15:36, 29 April 2026
Values in a wiki page
The following example shows the values of a wiki page with csv extension.
- Create the page. In this wiki, we created the page Manual:Extension/External Data/example components.csv. It contains comma-separated values:
component,type,weight Valve,mechanical,1.2 Sensor,electronic,0.3 Pump,mechanical,4.5
- On another wiki page, insert this parser function
#for_external_table{{#for_external_table:<nowiki/> * {{{component}}} – {{{type}}}, {{{weight}}} kg | source=web | url={{fullurl:Manual:Extension/External Data/example components.csv|action=raw}} | format=csv | data=component=component, type=type, weight=weight }}
The output is:
- Valve – mechanical, 1.2 kg
- Sensor – electronic, 0.3 kg
- Pump – mechanical, 4.5 kg