Editing
Module:Infobox body of water tracking
From Thetacola Wiki
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} function p.tracking(frame) local function isblank( val ) return (val == nil) or val:match('^[%s]*$') end local function hasnoconvert( val ) local res = nil val = mw.text.killMarkers(val) if val:match('[0-9]') then res = 1 if val:match('[%(][β0-9%.]') and val:match('[%)]') then res = nil end end return res end local cats = '' local maincats = '' local args = frame:getParent().args local AZ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' local warnmsg = {} if isblank(args['image']) then maincats = maincats .. '[[Category:Articles using infobox body of water without image]]' elseif isblank(args['alt']) then maincats = maincats .. '[[Category:Articles using infobox body of water without alt]]' end if isblank(args['coords']) and isblank(args['coordinates']) then maincats = maincats .. '[[Category:Articles using infobox body of water without coordinates]]' end if (isblank(args['pushpin_map']) ) then maincats = maincats .. '[[Category:Articles using infobox body of water without pushpin_map]]' elseif isblank(args['pushpin_map_alt']) then maincats = maincats .. '[[Category:Articles using infobox body of water without pushpin_map_alt]]' end if (isblank(args['image_bathymetry']) ) then maincats = maincats .. '[[Category:Articles using infobox body of water without image_bathymetry]]' elseif isblank(args['alt_bathymetry']) then maincats = maincats .. '[[Category:Articles using infobox body of water without alt_bathymetry]]' end local duplicate_parameters = 0 local duplicate_list = { {'child', 'embed'}, {'name', 'lake_name'}, {'image', 'image_lake'}, {'alt', 'alt_lake'}, {'caption', 'caption_lake'}, {'coordinates', 'coords'}, {'lake_type', 'type'}, {'ocean_type', 'type'}, {'lake_type', 'ocean_type'}, {'part_of', 'parent'}, {'basin_countries', 'countries'}, {'catchment_km2', 'catchment'}, {'length_km', 'length'}, {'width_km', 'width'}, {'area_km2', 'area'}, {'depth_m', 'depth'}, {'max-depth_m', 'max-depth'}, {'volume_km3', 'volume'}, {'shore_km', 'shore'}, {'elevation_m', 'elevation'}, {'settlements', 'cities'}, {'extra', 'nrhp'}, {'extra', 'embedded'}, {'embedded', 'nrhp'} } for i, params in ipairs(duplicate_list) do if args[params[1]] and args[params[2]] then duplicate_parameters = duplicate_parameters + 1 table.insert(warnmsg, 'Cannot use <code>' .. params[1] .. '</code> and <code>' .. params[2] .. '</code> at the same time.') end end if (duplicate_parameters > 0) then cats = cats .. '[[Category:Pages using infobox body of water with ' .. 'duplicate parameters|' .. string.sub(AZ, duplicate_parameters, duplicate_parameters+1) .. ']]' end local no_convert_parameters = 0 local dim_list = { 'catchment', 'length', 'width', 'area', 'depth', 'max-depth', 'volume', 'shore', 'elevation', 'temperature_low', 'temperature_high'} for i, param in ipairs(dim_list) do if hasnoconvert(args[param] or '') then no_convert_parameters = no_convert_parameters + 1 table.insert(warnmsg, 'Unconverted dimensions in <code>' .. param .. '</code>') end end if (no_convert_parameters > 0) then maincats = maincats .. '[[Category:Pages using infobox body of water with a non-automatically converted dimension|' .. string.sub(AZ,no_convert_parameters, no_convert_parameters+1) .. ']]' end if #warnmsg > 0 then cats = require('Module:If preview')._warning({ table.concat(warnmsg, '<br>') .. '<br>(Infobox body of water).' }) .. cats end if maincats ~= '' and mw.title.getCurrentTitle().namespace == 0 then cats = cats .. maincats end return cats end return p
Summary:
Please note that all contributions to Thetacola Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Project:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Category link with count
(
edit
)
Template:Clc
(
edit
)
Template:Module other
(
edit
)
Template:Module rating
(
edit
)
Template:Ombox
(
edit
)
Module:Arguments
(
edit
)
Module:Effective protection level
(
edit
)
Module:Infobox body of water tracking/doc
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:String
(
edit
)
Module:Yesno
(
edit
)
Navigation menu
Page actions
Module
Discussion
Read
Edit source
History
Page actions
Module
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Search
Tools
What links here
Related changes
Special pages
Page information