Module:Sandbox/mikeblas/Mountain table cell
Jump to navigation
Jump to search
![]() | This module depends on the following other modules: |
This template creates a table cell displaying an internal link to an article about a mountain summit and appropriate reference notes.
Use
The syntax of this template is:
{{User:Mikeblas/Mountain table cell|article|name=|alt=|hp=|peak=|note=|ngs=|stn=|gnis=|nrc=|vo=|va=|cme=|pb=|pw=|nor=|date=}}
where:
- article is the required title of the Wikipedia article about the summit.
- name= optional common name of the summit. (default=article).
- alt= optional alternate name of the summit.
- hp= optional region dominated by the summit. This parameter generates a note that says "The summit of name is the highest point of hp".
- peak= optional distinctive information about the summit. The information in this parameter is added as a note to the cell.
- note= optional note. The information in this parameter is added as a note to the cell.
- ngs= optional six-character point identifier for the U.S. National Geodetic Survey (NGS) station on the summit. The value given in this parameter is used to make a reference to the ngs.noaa.gov website.
- stn= optional name of the NGS station on the summit.
- gnis= optional numeric feature identifier for the United States Geological Survey Geographic Names Information System database. The value of this parameter is used to make a reference to the gnis website.
- nrc= optional five-letter feature identifier for the Natural Resources Canada (NRC) geographical name. This value generates a reference to the rncan.gc.ca website.
- vo= optional real number representing the vertical offset of the summit from the station benchmark in meters. This parameter generates a note which says "The summit elevation of name includes a vertical offset of vo from the station benchmark."
- va= optional real number representing the elevation adjustment in meters. This parameter generates a note which says "The elevation of name includes an adjustment of vo from NGVD 29 to NVAD 88."
- cme= optional integer summit identifier for a reference to the Bivouac.com website.
- pb= optional integer summit identifier for a reference to the Peakbagger.com website.
- pw= optional integer summit identifier for a reference to the Peakware.com website.
- nor= suppresses external references to the three websites above.
- date= optional date of the most recent data update.
Articles using this mechanism to add references must include a {{reflist}} template so the references are rendered in the article. If this template generates notes, the article must have a separate {{notelist}} template so the notes are displayed correctly.
Examples
Wikitext | Summit |
---|---|
{{User:Mikeblas/Mountain table cell|Denali|alt=Mount McKinley|hp=the [[Alaska Range]], the [[Alaska|State of Alaska]], the United States of America, and all of North America. Denali is the third most [[Topographic prominence|topographically prominent]] and third most [[Topographic isolation|topographically isolated]] summit on Earth after [[Mount Everest]] and [[Aconcagua]]|pb=271|cme=4368|pw=174|date=March 5, 2016}} | |
{{User:Mikeblas/Mountain table cell|Mount Logan|hp=the [[Saint Elias Mountains]], [[Yukon]], and all of Canada|pb=541|cme=14|pw=155|date=March 5, 2016}} | |
{{User:Mikeblas/Mountain table cell|Pico de Orizaba|alt=Citlaltépetl|hp=[[Puebla|Estado Libre y Soberano de Puebla]], [[Veracruz|Estado Libre y Soberano de Veracruz de Ignacio de la Llave]], and all of [[Mexico|México]]|pb=8049|cme=10655|pw=46|date=March 5, 2016}} | |
{{User:Mikeblas/Mountain table cell|Mount Saint Elias|name=Boundary Peak 186|pb=552|pw=223|cme=274|date=March 5, 2016}} |
Notes
References
See also
- This template invokes Template:Cite web.
- This template is a sibling of Template:Imt which creates a similar inline link and references.
- This template is compatible with Template:Cmtr, Template:Coord, and Template:Epi.
- See List of mountain peaks of North America for further examples.
-- This module implements [[Template:Mountain table cell]]
local p = {}
function p.row(frame)
local getArgs = require('Module:Arguments').getArgs
local args = getArgs(frame)
local res = '|'
if args[1] then
local n = args['name'] and '[[' .. args[1] .. '|' .. args['name'] .. ']]' or '[[' .. args[1] .. ']]'
res = res .. n
local refs = {}
local notes = {}
if args['hp'] then
table.insert(notes, {'X', 'The summit of ' .. n .. ' is the highest point of ' .. args['hp'] .. '.'})
end
if args['peak'] then
table.insert(notes, {'Y', n .. ' ' .. args['peak'] .. '.'})
end
if args['note'] then
table.insert(notes, {'Z', args['note'] .. '.'})
end
if args['ngs'] then
local r = frame:expandTemplate{ title = 'cite web', args = {
title = args['stn'] or args['name'] or args[1],
url = 'http://www.ngs.noaa.gov/cgi-bin/ds_mark.prl?PidBox=' .. args['ngs'],
work = 'Datasheet for NGS Station ' .. args['ngs'],
publisher = '[[U.S. National Geodetic Survey]]',
accessdate = args['date']} }
table.insert(refs, {'D', r})
end
if args['gnis'] then
local r = frame:expandTemplate{ title = 'cite gnis',
args = {name = args['name'] or args[1], id = args['gnis']} }
table.insert(refs, {'E', r})
end
if args['nrc'] then
local r = frame:expandTemplate{ title = 'cite web', args = {
title = args['name'] or args[1],
url = 'http://www4.rncan.gc.ca/search-place-names/unique?id=' .. args['nrc'],
work = 'Geographical Names of Canada',
publisher = '[[Natural Resources Canada]]',
accessdate = args['date']} }
table.insert(refs, {'F', r})
end
if args['vo'] then
local rnd = require('Module:Math')._round
local vo = tonumber(args['vo'])
vo = (vo > 0 and '+' or '') .. ' m (' .. rnd(vo / 0.3048, 1) .. ' ft)'
table.insert(notes, {'G', 'The summit elevation of ' .. n .. ' includes a vertical offset of ' .. vo .. ' from the station benchmark.'})
end
if args['va'] then
local rnd = require('Module:Math')._round
local va = tonumber(args['va'])
va = (va > 0 and '+' or '') .. ' m (' .. rnd(va / 0.3048, 2) .. ' ft)'
table.insert(notes, {'H', 'The elevation of ' .. n .. ' includes an adjustment of ' .. va .. ' from [[NGVD 29|NGVD 29]] to [[NAVD 88|NAVD 88]].'})
end
if args['pb'] and args['nor'] == nil then
local r = frame:expandTemplate{ title = 'cite web', args = {
title = args['name'] or args[1],
url = 'http://www.peakbagger.com/peak.aspx?pid=' .. args['pb'],
website = 'Peakbagger.com',
accessdate = args['date'] } }
table.insert(refs, {'I', r})
end
if args['cme'] and args['nor'] == nil then
local r = frame:expandTemplate{ title = 'cite web', args = {
title = args['name'] or args[1],
url = 'http://www.bivouac.com/MtnPg.asp?MtnId=' .. args['cme'],
website = 'Bivouac.com',
accessdate = args['date'] } }
table.insert(refs, {'J', r})
end
if args['pw'] and args['nor'] == nil then
local r = frame:expandTemplate{ title = 'cite web', args = {
title = args['name'] or args[1],
url = 'http://www.peakware.com/peaks.html?pk=' .. args['pw'],
website = 'Peakware.com',
accessdate = args['date'] } }
table.insert(refs, {'K', r})
end
for i, r in ipairs(refs) do
res = res .. frame:extensionTag ('ref', r[2], {name=r[1] .. '_' .. args[1]})
end
for i, r in ipairs(notes) do
res = res .. frame:extensionTag ('ref', r[2], {name=r[1] .. '_' .. args[1], group='lower-alpha'})
end
if args['alt'] then
res = res .. '<br/>' .. '([[' .. args[1] .. '|' .. args['alt'] .. ']])'
end
end
return res
end
return p