Countries of Africa: Difference between revisions

From Discourse DB
Jump to navigation Jump to search
No edit summary
(Turned into a full demo of the different approaches)
 
Line 1: Line 1:
Data about a few of the countries of Africa (retrieved from the URL https://discoursedb.org/AfricaCSV.txt, using the [https://mediawiki.org/wiki/Extension:External_Data External Data] extension):
Data about a few of the countries of Africa, retrieved and displayed in several different ways all defined by the [https://mediawiki.org/wiki/Extension:External_Data External Data] extension.


{{#get_external_data:url=https://discoursedb.org/AfricaCSV.txt|format=csv with header|data=name=Country,borders=Borders,population=Population,area=Area}}
In all cases, the source of this (probably not very accurate) information is the URL https://discoursedb.org/AfricaCSV.txt.
 
==#for_external_table==
'''Wikitext:'''
<pre>
{| class="wikitable"
! Name
! Borders
! Population
! Area {{#for_external_table:<nowiki/>
{{!}}-
{{!}} {{{name}}}
{{!}} {{{borders}}}
{{!}} {{{population}}}
{{!}} {{{area}}}
|source=https://discoursedb.org/AfricaCSV.txt|format=csv with header|data=name=Country,borders=Borders,population=Population,area=Area
}}
|}
</pre>
 
'''Output:'''
 
{| class="wikitable"
! Name
! Borders
! Population
! Area {{#for_external_table:<nowiki/>
{{!}}-
{{!}} {{{name}}}
{{!}} {{{borders}}}
{{!}} {{{population}}}
{{!}} {{{area}}}
|source=https://discoursedb.org/AfricaCSV.txt|format=csv with header|data=name=Country,borders=Borders,population=Population,area=Area
}}
|}
==#display_external_table==
Uses the [[Template:Country row|Country row]] template.
 
'''Wikitext:'''
<pre>
{| class="wikitable"
! Name
! Borders
! Population
! Area
{{#display_external_table:template=Country row|source=https://discoursedb.org/AfricaCSV.txt|format=csv with header
|data=name=Country,borders=Borders,population=Population,area=Area
}}
|}
</pre>
 
'''Output:'''
 
{| class="wikitable"
! Name
! Borders
! Population
! Area
{{#display_external_table:template=Country row|source=https://discoursedb.org/AfricaCSV.txt|format=csv with header
|data=name=Country,borders=Borders,population=Population,area=Area
}}
|}
 
==#format_external_table==
Requires the presence of the [https://www.mediawiki.org/wiki/Extension:Cargo Cargo] extension.
 
'''Wikitext:'''
<pre>
{{#format_external_table:source=https://discoursedb.org/AfricaCSV.txt|format=csv with header
|data=Name=Country,Borders=Borders,Population=Population,Area=Area|display format=table}}
</pre>
 
'''Output:'''
 
{{#format_external_table:source=https://discoursedb.org/AfricaCSV.txt|format=csv with header
|data=Name=Country,Borders=Borders,Population=Population,Area=Area|display format=table}}
 
==Legacy approach: #get_web_data + #for_external_table==
'''Wikitext:'''
<pre>
{{#get_web_data:url=https://discoursedb.org/AfricaCSV.txt|format=csv with header
|data=name=Country,borders=Borders,population=Population,area=Area}}
{| class="wikitable"
! Name
! Borders
! Population
! Area {{#for_external_table:<nowiki/>
{{!}}-
{{!}} {{{name}}}
{{!}} {{{borders}}}
{{!}} {{{population}}}
{{!}} {{{area}}}}}
|}
</pre>
 
'''Output:'''
{{#get_web_data:url=https://discoursedb.org/AfricaCSV.txt|format=csv with header
|data=name=Country,borders=Borders,population=Population,area=Area}}
{| class="wikitable"
{| class="wikitable"
! Name
! Name

Latest revision as of 20:46, October 13, 2022

Data about a few of the countries of Africa, retrieved and displayed in several different ways all defined by the External Data extension.

In all cases, the source of this (probably not very accurate) information is the URL https://discoursedb.org/AfricaCSV.txt.

#for_external_table

Wikitext:

{| class="wikitable"
! Name
! Borders
! Population
! Area {{#for_external_table:<nowiki/>
{{!}}-
{{!}} {{{name}}}
{{!}} {{{borders}}}
{{!}} {{{population}}}
 {{!}} {{{area}}}
|source=https://discoursedb.org/AfricaCSV.txt|format=csv with header|data=name=Country,borders=Borders,population=Population,area=Area
}}
|}

Output:

Name Borders Population Area
Algeria Libya,Mali,Mauritania,Niger,Tunisia 32,854,002 2,381,743 km²
Angola Democratic Republic of the Congo,Namibia,Zambia 24,383,301 1,246,700 km²
Benin Burkina Faso,Niger,Nigeria,Togo 8,439,000 112,620 km²

#display_external_table

Uses the Country row template.

Wikitext:

{| class="wikitable"
! Name
! Borders
! Population
! Area
{{#display_external_table:template=Country row|source=https://discoursedb.org/AfricaCSV.txt|format=csv with header
|data=name=Country,borders=Borders,population=Population,area=Area
}}
|}

Output:

Name Borders Population Area
Algeria Libya,Mali,Mauritania,Niger,Tunisia 32,854,002 2,381,743 km²
Angola Democratic Republic of the Congo,Namibia,Zambia 24,383,301 1,246,700 km²
Benin Burkina Faso,Niger,Nigeria,Togo 8,439,000 112,620 km²

#format_external_table

Requires the presence of the Cargo extension.

Wikitext:

{{#format_external_table:source=https://discoursedb.org/AfricaCSV.txt|format=csv with header
|data=Name=Country,Borders=Borders,Population=Population,Area=Area|display format=table}}

Output:

Name Borders Population Area
Algeria Libya,Mali,Mauritania,Niger,Tunisia 32,854,002 2,381,743 km²
Angola Democratic Republic of the Congo,Namibia,Zambia 24,383,301 1,246,700 km²
Benin Burkina Faso,Niger,Nigeria,Togo 8,439,000 112,620 km²

Legacy approach: #get_web_data + #for_external_table

Wikitext:

{{#get_web_data:url=https://discoursedb.org/AfricaCSV.txt|format=csv with header
|data=name=Country,borders=Borders,population=Population,area=Area}}
{| class="wikitable"
! Name
! Borders
! Population
! Area {{#for_external_table:<nowiki/>
{{!}}-
{{!}} {{{name}}}
{{!}} {{{borders}}}
{{!}} {{{population}}}
 {{!}} {{{area}}}}}
|}

Output:

Name Borders Population Area
Algeria Libya,Mali,Mauritania,Niger,Tunisia 32,854,002 2,381,743 km²
Angola Democratic Republic of the Congo,Namibia,Zambia 24,383,301 1,246,700 km²
Benin Burkina Faso,Niger,Nigeria,Togo 8,439,000 112,620 km²