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

Content deleted Content added
Undid revision 1194215761 by SleepTrain456 (talk)
 
(29 intermediate revisions by 5 users not shown)
Line 1:
{{High-use}}
This module holds the data for [[Module:RailGauge]]. Please see the comments in the module text for instructions on how to add new gauges. For instructions on how to use the module itself, please see the corresponding template page, {{tl|RailGauge}}.
[[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).
 
==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 19 ⟶ 22:
},
</pre>
;Overall structure
A RailGauge/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 50 ⟶ 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)==
This can be done in [[module:RailGauge/extra]].<br>
{{#ifeq:{{FULLPAGENAME}}|Module:RailGauge/extra|
New gauges can be added through [[module:RailGauge/extra]]. Once added, its tracking category (mentionings) can be created by writing
:<code><nowiki>{{#invoke:RailGauge/autodocument|createCatMentions|&lt;your new alias goes here>}}</nowiki></code><br> on a page. That will a [create] link to click.
Note: only add categories for gauges that are without doubt.}}
 
== ErrorsDevelopment ==
* Data "history" = {date begin, date end} -- to denote the era of existance
:{{#invoke:RailGauge/autodocument|checkData|module:RailGauge/data}}
* Data "unique" = "yes" -- to denote single network
:{{#invoke:RailGauge/autodocument|checkData|module:RailGauge/extra}}
::See {{track gauge |14 1/4 in|lk=on}}
 
==See also==
* {{tl|RailGaugeTrack gauge/doc/input options}} -- Overview