Module:Dabs: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
(Created page with "--some functions related to processing page name's disambiguation terms local util_link = require('Module:LinkUtil') local util_text = require('Module:TextUtil') local p = {}...")
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
--some functions related to processing page name's disambiguation terms
--some functions related to processing page name's disambiguation terms
local util_link = require('Module:LinkUtil')
local util_link = require('Module:LinkUtil')
local util_text = require('Module:TextUtil')
local p = {} --p stands for package
local p = {} --p stands for package
local h = {} --h stands for helper


function p.italDab(frame)
function p.italDab(frame)
Line 11: Line 8:
local name = util_link.stripDab(page)
local name = util_link.stripDab(page)
local dab = util_link.getDab(page)
local dab = util_link.getDab(page)
local display = name .. "(''" .. dab .. "'')"
local display = name .. " (''" .. dab .. "'')"
if agrs[2] then
if args[2] then
local link = util_link.addLink(page, display)
local link = util_link.addLink(page, display)
return link
return link
Line 18: Line 15:
return display
return display
end
end
end
function p.getDab(frame)
local args = frame:getParent().args
local dab = util_link.getDab(args[1])
return dab
end
end


return p
return p

Latest revision as of 12:10, 24 June 2022

Documentation for this module may be created at Module:Dabs/doc

--some functions related to processing page name's disambiguation terms
local util_link = require('Module:LinkUtil')
local p = {} --p stands for package

function p.italDab(frame)
	local args = frame:getParent().args
	local page = util_link.stripLink(args[1])
	local name = util_link.stripDab(page)
	local dab = util_link.getDab(page)
	local display = name .. " (''" .. dab .. "'')"
	if args[2] then
		local link = util_link.addLink(page, display)
		return link
	else
		return display
	end
end

function p.getDab(frame)
	local args = frame:getParent().args
	local dab = util_link.getDab(args[1])
	return dab
end

return p