Module:Track gauge/data/doc: Difference between revisions

Content deleted Content added
Undid revision 1194215761 by SleepTrain456 (talk)
 
(21 intermediate revisions by 5 users not shown)
Line 1:
{{High-use}}
The two modules [[Module:Track gauge/data]] and [[Module:Track gauge/extra]] hold the data for [[Module:Track gauge]] and template {{tl|Track gauge}}. Both have the same data structure. Comments in the module text for instructions on how to add new gauges.
[[Module:Track gauge/data]] holds the data for [[Module:Track gauge]] and template {{tlt|Track gauge}}. It contains some 250 track gauge definitions (widths), often by different units (defined metric and/or imperial).
 
:[[Module:Track gauge/data]] has the stable data (currently over 200 track gauge definitions).
:[[Module:Track gauge/extra]] is available to quickly add and test newly discovered gauge definitions (without invoking much [[JQ|job queus]] for the cache). Once stable, these can be added to the main /data list.
==Entry data structure==
A single entry is a subtable (withinby <code>{...}</code>) in the data page. The full entry is approached by an alias (normalised input). The subtable has the following structure:
<pre>
{
["full-id"] = "1435-met", -- Gauge-id including unit
["id"] = "1000", -- Gauge identification in mm.
["aliases"] = {[[1000mm]], [[1m]]}, -- Aliases for the gauge (input options; input spaces, commas and capitals are re-formatted by the module).
["def1"] = "met", -- The defining measurement, either "met" (metric) or "imp" (imperial).
["name"] = "metre gauge", -- Name for the gauge (alternative).
["link"] = "[[metreMetre gauge railway]]", -- Link to named gauge article (alternative, linked).
["pagename"] = "standard gauge", -- Link to sourcing Wikipedia article.
["contentcat"] = "Iberian gauge railways" -- Non-default category name (don't add 'Category:').
Line 22:
},
</pre>
;Overall structure
A module:Track gauge/data page has the following structure:
<pre>
return
{
{
["id"] = "1000",
["aliases"] = {[[1000mm]], [[1m]]},
["def1"] = "met",
-- ...,
["den"] = "8"
},
{
["id"] = "1067",
["aliases"] = {[[1067mm]]},
["def1"] = "met",
-- ...,
["in"] = "6"
}
}
</pre>
:Note: the last data of an entry ("den" and "in" examples) do ''not'' have a comma.
:Note: the last entry ("{id=1067, ...}" example) does ''not'' have a final comma after its closing "}"
 
==About aliases and identifiers==
Line 53 ⟶ 30:
The "id", "aliases", and "def1" fields are required. Also, some size in metric and in imperial must be present. That is: at least one metric size field (mm or m) and one imperial size field (ft, inch, or num+den) must exist. All other fields are optional.
 
:'''id''': An id stands for the physical size, a length. It can be reused in multiple entries., Usuallyfor used twiceexample when a gauge is defined in both metric and in imperial. Even a third gauge name (by another alias) can beuse ths addedsize-id.
:'''alias''' (input option): An Alias''alias'' must be unique over all data. Alias names here should not contain any spaces; spaces are trimmed from the input when it is processed, so alias names containing spaces will not be matched.
 
==Adding a new track gauge (entry)==
New gauge definitions can be added in [[module:Track gauge/extra]].
{{#ifeq:{{FULLPAGENAME}}|Module:Track gauge/extra|
<br>New gauges can be added through [[module:Track gauge/extra]].}}
 
Articles with input not recognised (alias is not in the data pages) are listed in [[:Category:Articles using template 'Track gauge' with unrecognized input]].
 
== ErrorsDevelopment ==
* Data "history" = {date begin, date end} -- to denote the era of existance
:{{#invoke:Track gauge/autodocument|checkData|module:Track gauge/data}}
* Data "unique" = "yes" -- to denote single network
:{{#invoke:Track gauge/autodocument|checkData|module:Track gauge/extra}}
::See {{track gauge |14 1/4 in|lk=on}}
 
==See also==