Module:Mountain table cell: Difference between revisions
Appearance
Content deleted Content added
No edit summary |
duplicate reference bug has been fixed, so see if we can remove this |
||
Line 12: | Line 12: | ||
local refs = {} |
local refs = {} |
||
local needtemplatestyles = nil |
|||
if args['hp'] then |
if args['hp'] then |
||
table.insert(refs, {'A', 'The summit of ' .. n .. ' is the highest point of ' .. args['hp'] .. '.'}) |
table.insert(refs, {'A', 'The summit of ' .. n .. ' is the highest point of ' .. args['hp'] .. '.'}) |
||
Line 29: | Line 28: | ||
publisher = '[[United States National Geodetic Survey]]', |
publisher = '[[United States National Geodetic Survey]]', |
||
accessdate = args['date']} } |
accessdate = args['date']} } |
||
table.insert(refs, {'D', |
table.insert(refs, {'D', r}) |
||
needtemplatestyles = 1 |
|||
end |
end |
||
if args['gnis'] then |
if args['gnis'] then |
||
local r = frame:expandTemplate{ title = 'cite gnis', |
local r = frame:expandTemplate{ title = 'cite gnis', |
||
args = {name = args['name'] or args[1], id = args['gnis']} } |
args = {name = args['name'] or args[1], id = args['gnis']} } |
||
table.insert(refs, {'E', |
table.insert(refs, {'E', r}) |
||
needtemplatestyles = 1 |
|||
end |
end |
||
if args['nrc'] then |
if args['nrc'] then |
||
Line 45: | Line 42: | ||
publisher = '[[Natural Resources Canada]]', |
publisher = '[[Natural Resources Canada]]', |
||
accessdate = args['date']} } |
accessdate = args['date']} } |
||
table.insert(refs, {'F', |
table.insert(refs, {'F', r}) |
||
needtemplatestyles = 1 |
|||
end |
end |
||
if args['vo'] then |
if args['vo'] then |
||
Line 66: | Line 62: | ||
publisher = 'Peakbagger.com', |
publisher = 'Peakbagger.com', |
||
accessdate = args['date'] } } |
accessdate = args['date'] } } |
||
table.insert(refs, {'I', |
table.insert(refs, {'I', r}) |
||
needtemplatestyles = 1 |
|||
end |
end |
||
if args['cme'] and args['nor'] == nil then |
if args['cme'] and args['nor'] == nil then |
||
Line 75: | Line 70: | ||
publisher = 'Bivouac.com', |
publisher = 'Bivouac.com', |
||
accessdate = args['date'] } } |
accessdate = args['date'] } } |
||
table.insert(refs, {'J', |
table.insert(refs, {'J', r}) |
||
needtemplatestyles = 1 |
|||
end |
end |
||
if args['pw'] and args['nor'] == nil then |
if args['pw'] and args['nor'] == nil then |
||
Line 84: | Line 78: | ||
publisher = 'Peakware.com', |
publisher = 'Peakware.com', |
||
accessdate = args['date'] } } |
accessdate = args['date'] } } |
||
table.insert(refs, {'K', |
table.insert(refs, {'K', r}) |
||
needtemplatestyles = 1 |
|||
end |
end |
||
for i, r in ipairs(refs) do |
for i, r in ipairs(refs) do |
||
res = res .. frame:extensionTag ('ref', r[2], {name=r[1] .. '_' .. args[1]}) |
res = res .. frame:extensionTag ('ref', r[2], {name=r[1] .. '_' .. args[1]}) |
||
end |
|||
if needtemplatestyles then |
|||
res = res .. frame:extensionTag ('templatestyles', '', {src='Module:Citation/CS1/styles.css'}) |
|||
end |
end |
||
if args['alt'] then |
if args['alt'] then |
Revision as of 23:42, 18 October 2018
Implements {{Mountain table cell}}
-- This module implements [[Template:Cmt]]
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 = {}
if args['hp'] then
table.insert(refs, {'A', 'The summit of ' .. n .. ' is the highest point of ' .. args['hp'] .. '.'})
end
if args['peak'] then
table.insert(refs, {'B', n .. ' ' .. args['peak'] .. '.'})
end
if args['note'] then
table.insert(refs, {'C', 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 = '[[United States 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(refs, {'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(refs, {'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'],
publisher = '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'],
publisher = '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'],
publisher = '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
if args['alt'] then
res = res .. '<br/>' .. '([[' .. args[1] .. '|' .. args['alt'] .. ']])'
end
end
return res
end
return p