Difference between revisions of "Module:Lighthouse tracking"

From blackwiki
Jump to navigation Jump to search
blackwiki>Frietjes
blackwiki>Frietjes
Line 1: Line 1:
 
local p = {}
 
local p = {}
 
function p.tracking(frame)
 
function p.tracking(frame)
 +
local res = ''
 +
local isNRHP = false
 +
local heritage = frame.args.heritage or ''
 +
if heritage == '' then
 +
elseif (heritage:match('place listed on the National Register of Historic Places') or
 +
heritage:match('NRHP contributing property') ) then
 +
res = res .. '[[Category:Pages using infobox lighthouse with NRHP heritage]]'
 +
isNRHP = true
 +
else
 +
res = res .. '[[Category:Pages using infobox lighthouse with non-NRHP heritage]]'
 +
end
 +
 
for k, v in pairs( frame:getParent().args ) do
 
for k, v in pairs( frame:getParent().args ) do
 
if k and k == 'module' then
 
if k and k == 'module' then
 +
if v and v:match('<tr') then
 +
res = res .. '[[Category:Pages using infobox lighthouse with NRHP embedded]]'
 +
if isNRHP == false then
 +
res = res .. '[[Category:National Register of Historic Places articles needing infoboxes]]'
 +
end
 +
if v:match('<div style="position') then
 +
local pushpin_map = frame:getParent().args.pushpin_map
 +
if pushpin_map and pushpin_map ~= '' then
 +
res = res .. '[[Category:Pages using infobox lighthouse with two location maps]]'
 +
end
 +
end
 +
end
 
elseif type(k) == 'string' then
 
elseif type(k) == 'string' then
 
if v and v:match('<tr') then
 
if v and v:match('<tr') then
return '[[Category:Pages using infobox lighthouse with NRHP embedded outside the module parameter]]'
+
res = res .. '[[Category:Pages using infobox lighthouse with NRHP embedded outside the module parameter]]'
 
end
 
end
 
end
 
end
 
end
 
end
return ''
+
return res
 
end
 
end
 
return p
 
return p

Revision as of 23:55, 19 November 2018

This modules produces the tracking categories for Template:Infobox lighthouse


local p = {}
function p.tracking(frame)
	local res = ''
	local isNRHP = false
	local heritage = frame.args.heritage or ''
	if heritage == '' then
	elseif (heritage:match('place listed on the National Register of Historic Places') or
		heritage:match('NRHP contributing property') ) then
		res = res .. '[[Category:Pages using infobox lighthouse with NRHP heritage]]'
		isNRHP = true
	else
		res = res .. '[[Category:Pages using infobox lighthouse with non-NRHP heritage]]'
	end
	
	for k, v in pairs( frame:getParent().args ) do
		if k and k == 'module' then
			if v and v:match('<tr') then
				res = res .. '[[Category:Pages using infobox lighthouse with NRHP embedded]]'
				if isNRHP == false then
					res = res .. '[[Category:National Register of Historic Places articles needing infoboxes]]'
				end
				if v:match('<div style="position') then
					local pushpin_map = frame:getParent().args.pushpin_map
					if pushpin_map and pushpin_map ~= '' then
						res = res .. '[[Category:Pages using infobox lighthouse with two location maps]]'
					end
				end
			end
		elseif type(k) == 'string' then
			if v and v:match('<tr') then
				res = res .. '[[Category:Pages using infobox lighthouse with NRHP embedded outside the module parameter]]'
			end
		end
	end
	return res
end
return p