Knowledge

Module:CountryData/doc

Source 📝

294:{{ {{{1}}} | altlink = | flag alias-naval-1790 = Flag of French-Navy-Revolution.svg | link alias-coast guard = French Maritime Gendarmerie | border-coast guard = | flag alias-1848 = Drapeau france 1848.svg | flag alias = Flag of France.svg | variant = | flag alias-1814 = Flag of the Kingdom of France (1814-1830).svg | flag alias-1830 = Flag of France (1794–1815, 1830–1958).svg | alias = France | flag alias-1794 = Flag of France (1794–1815, 1830–1958).svg | flag alias-army = Flag of France.svg | flag alias-naval = Civil and Naval Ensign of France.svg | flag alias-navy = Civil and Naval Ensign of France.svg | flag alias-1848b = Flag of France (1794–1815, 1830–1958).svg | name = | size = | flag alias-1848a = Drapeau france 1848.svg | link alias-naval = French Navy | flag alias-1974 = Flag of France (lighter variant).svg | link alias-air force = French Air and Space Force | link alias-army = French Army | flag alias-coast guard = French Maritime Gendarmerie racing stripe.svg | flag alias-1790 = Flag of France (1790–1794).svg | flag alias-air force = Flag of France.svg | link alias-navy = French Navy }} 291:{{ {{{1}}} | alias = France | flag alias = Flag of France.svg | flag alias-1790 = Flag of France (1790–1794).svg | flag alias-1794 = Flag of France (1794–1815, 1830–1958).svg | flag alias-1814 = Flag of the Kingdom of France (1814-1830).svg | flag alias-1830 = Flag of France (1794–1815, 1830–1958).svg | flag alias-1848 = Drapeau france 1848.svg | flag alias-1848a = Drapeau france 1848.svg | flag alias-1848b = Flag of France (1794–1815, 1830–1958).svg | flag alias-1974 = Flag of France (lighter variant).svg | flag alias-naval = Civil and Naval Ensign of France.svg | flag alias-naval-1790 = Flag of French-Navy-Revolution.svg | flag alias-air force = Flag of France.svg | link alias-air force = French Air and Space Force | flag alias-coast guard = French Maritime Gendarmerie racing stripe.svg | border-coast guard = | link alias-coast guard = French Maritime Gendarmerie | flag alias-army = Flag of France.svg | link alias-army = French Army | link alias-naval = French Navy | flag alias-navy = Civil and Naval Ensign of France.svg | link alias-navy = French Navy | size = | name = | altlink = | variant = }} 68: 31: 261:, because it transcludes the data template from Lua and converts it to a Lua table using the above function, picks the wanted parameter name, and returns it to wikicode, whereas other templates perform two simple non-Lua transclusions to get, in most cases, the same result. The Lua version does have the advantage that using it with a non-existing country data template returns "nil" (or the value of 281:
This function concatenates the fields of a data template into a string similar to what you get when transcluding it directly. It can be compared with a direct transclusion to test if a template is being converted to Lua correctly:
225:
If used from wikicode, this function returns the value of a single field in a data template. The first parameter is the country or other entity whose data to return; the second is the name of the field. For example,
134:
of the invoking module; the second is the country or other entity to get the data of. The optional third parameter is a table of parameters to pass into the data template; this may, for example, include
86: 94: 119:
Extracts all parameters from a data template and returns them as a Lua table. This function is only usable from other Lua modules; invoke it using
238:
for the fallback output if the wanted data template or field does not exist, the default for which is a literal "nil".
75: 214: 38: 266: 104: 234:
to return a variant parameter value, with fallback to the main field value if the variant does not exist, and
297:
Note that, like with all Lua tables, the order of entries is not preserved, so the parameters are mixed up.
82: 93:. The tested changes can be added to this page in a single edit. Consider discussing changes on the 52: 213:
The function returns an empty table if a data template does not exist or does not conform to the
285:{{#tag:pre|{{Country data France}}}} {{#tag:pre|{{#invoke:CountryData|gettemplate|France}}}} 8: 81:
To avoid major disruption and server load, any changes should be tested in the module's
255: 46: 41: 17: 245: 108: 90: 265:) rather than a redlink to the data template. See a comparison of the four at 241:
Note: This is likely not quicker than wikicode-only alternatives such as
143:, which are used in the values of some sports alias parameters. E.g., 76:
approximately 416,000 pages, or roughly 1% of all pages
55:
and other content that is not part of the original module page.
230:→ Flag of France.svg. The other parameters are 103:
This module has three functions to extract data from
228:{{#invoke:CountryData|getalias|France|flag alias}} 121:require('Module:CountryData').gettable( 14: 62: 25: 23: 61: 51:It may contain usage information, 306: 66: 29: 271:/Flagg tests#Lua-based getalias 276: 13: 1: 163:'Module:CountryData' 7: 220: 130:The first parameter is the 114: 74:This Lua module is used on 10: 311: 107:(which are used for most 97:before implementing them. 89:subpages, or in your own 145: 105:country data templates 205:"men's" 232:|variant= 215:standard structure 181:"France" 47:Module:CountryData 44: 18:Module:CountryData 101: 100: 59: 58: 36: 302: 264: 260: 254: 250: 244: 237: 233: 229: 209: 206: 203: 200: 197: 194: 191: 188: 185: 182: 179: 176: 173: 170: 167: 164: 161: 158: 155: 152: 149: 142: 138: 133: 126: 70: 69: 63: 33: 32: 26: 310: 309: 305: 304: 303: 301: 300: 299: 295: 292: 286: 279: 270: 262: 258: 252: 248: 242: 235: 231: 227: 223: 211: 210: 207: 204: 201: 198: 195: 192: 189: 186: 183: 180: 177: 174: 171: 168: 165: 162: 159: 156: 153: 150: 147: 140: 136: 131: 120: 117: 80: 67: 60: 50: 30: 22: 21: 20: 12: 11: 5: 308: 293: 290: 284: 278: 275: 268: 263:|def= 236:|def= 222: 219: 193:"20" 146: 137:|age= 116: 113: 109:flag templates 99: 98: 91:module sandbox 71: 57: 56: 34: 24: 15: 9: 6: 4: 3: 2: 307: 298: 289: 283: 274: 272: 257: 247: 239: 218: 216: 144: 141:|mw= 128: 124: 112: 110: 106: 96: 92: 88: 84: 78: 77: 72: 65: 64: 54: 48: 43: 40: 39:documentation 35: 28: 27: 19: 296: 287: 280: 259:}} 253:{{ 249:}} 243:{{ 240: 224: 212: 129: 122: 118: 102: 73: 277:gettemplate 123:parameters 87:/testcases 53:categories 37:This is a 267:User:SiBr 256:getalias2 95:talk page 246:getalias 221:getalias 169:gettable 115:gettable 83:/sandbox 157:require 42:subpage 288:gives 175:frame 148:local 132:frame 16:< 251:and 151:data 45:for 187:age 139:or 111:). 85:or 273:. 217:. 208:}) 199:mw 184:,{ 166:). 127:. 269:4 202:= 196:, 190:= 178:, 172:( 160:( 154:= 125:) 79:. 49:.

Index

Module:CountryData
documentation
subpage
Module:CountryData
categories
approximately 416,000 pages, or roughly 1% of all pages
/sandbox
/testcases
module sandbox
talk page
country data templates
flag templates
standard structure
getalias
getalias2
User:SiBr4/Flagg tests#Lua-based getalias

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.