Lua error in ਮੌਡਿਊਲ:Lua_banner at line 113: attempt to index field 'edit' (a nil value).

This module provides the logic for {{disambiguation}}.


require('strict')

local p = {}

local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')

function p._disambiguation(argsWithBlanks)
	local args = {}
	for k, v in pairs(argsWithBlanks) do
		if k == 'categories' or v ~= '' then
			args[k] = v
		end
	end
	
	local current_title = mw.title.getCurrentTitle()
	local namespace = args.namespace or current_title.nsText
	local title = args.title or current_title.text
	local shared = yesno(args.shared)
	
	args.title = nil
	args.shared = nil
	
	-- info text
	local infoword1 = 'works'
	local infoword2 = 'title'
	
	if namespace == 'Author' then
		infoword1 = 'authors'
		infoword2 = 'name'
	elseif namespace == 'Portal' then
		infoword1 = 'portals'
		infoword2 = 'topic name'
	end
	
	local info = tostring(mw.html.create('p'):css({['font-style'] = 'italic'}):wikitext(table.concat({
		'This is a [[WS:STYLE#Disambiguation, versions and translations pages|disambiguation page]]. It lists ',
		infoword1,
		' that share the same ',
		infoword2,
		'. If an [[Special:Whatlinkshere/',
		current_title.fullText,
		'|article link]] referred you here, please consider editing it to point directly to the intended page.'
	})))
	if args.notes then
		args.notes = info .. '<p>' .. args.notes .. '</p>'
	else
		args.notes = info
	end
	
	-- categories
	local categories = args.category or args.category
	local cat = namespace .. ' disambiguation pages'
	args.category = nil
	args.categories = nil
	
	-- header
	local disambig_text = ' <span style="font-weight:normal;">(disambiguation)</span>'
	
	local postheader = tostring(mw.html.create('div'):addClass('subNote'):css({['margin'] = '4px auto 4px auto'}):wikitext(
		tostring(mw.html.create('span'):attr('id', 'nofooter'):wikitext(
			args.intro
			or tostring(mw.html.create('span'):css({['font-weight'] = 'bold', ['font-style'] = 'italic'}):wikitext(title)) .. ' may refer to:'
		))
	))
	
	args.disambiguation = true
	
	local header
	if namespace == 'Author' then
		args.firstname = title .. disambig_text
		args.last_initial = '!NO_INITIALS'
		args.description = args.notes
		args.nocat = true
		header = require('Module:Author')._author(args)
	elseif namespace == 'Portal' then
		args.title = title .. disambig_text
		args.class = 'none'
		args.nocat = true
		args.reviewed = 'n/a'
		header = require('Module:Portal header')._portal_header(args)
	elseif namespace == '' or namespace == 'Template' then
		args.pretitle = 'Works'
		if shared then
			args.pretitle = 'Works and pages in other namespaces'
		end
		args.pretitle = args.pretitle .. ' entitled'
		
		args.title = title
		
		if shared and not current_title.isSubpage then
			-- should be redundant as attached to header
			args.notes = args.notes .. '[[Category:' .. 'Merged disambiguation pages' .. ']]'
		end
		
		args.header_class = 'ws-dynlayout-disable'
		
		header = require('Module:Header')._header(args)
		
		cat = 'Mainspace disambiguation pages'
	else
		header = require('Module:Error')['error']({'[[Module:Disambiguation]] error: {{[[Template:Disambiguation|disambiguation]]}} is only for use in the Main, Author and Portal [[Help:Namespace|namespaces]]'})
		postheader = ''
		cat = 'Disambiguation pages in inappropriate namespaces'
	end
	
	return header .. mw.getCurrentFrame():preprocess('__DISAMBIG__') .. postheader .. (categories or '[[Category:' .. cat .. ']]')
end

function p.disambiguation(frame)
	return p._disambiguation(getArgs(frame, {removeBlanks = false}))
end

return p