Jump to content

Module:DYK checklist

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mr. Stradivarius (talk | contribs) at 10:29, 5 November 2016 (some more progress). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

-- This module implements {{DYK checklist}}.

local yesno = require('Module:Yesno')

local params = {
	newness = true,
	length = true,
	eligibilityother = true,
	sourced = true,
	neutral = true,
	plagiarismfree = true,
	policyother = true,
	hookcited = true,
	hookother = true,
	hookcited = true,
	picfree = true,
	picused = true,
	picclear = true,
}

-- The template for making collapsed sections.
local COLLAPSE_TEMPLATE = [[
{| class="collapsible collapsed" border="1" style="border-collapse:collapse;"
|-
! style="font-weight:normal; " | %s
|-
| %s
|}]]

local p = {}

-- If a value is not present for a canonical key in the args table, check if
-- there is a value for an alias key, and write that value to the canonical
-- key. Then delete the alias key, whether or not a canonical value is present.
-- Called like this: consolidateAliases(args, {
--   canonicalKey1 = {'alias1', 'alias2'},
--   canonicalKey2 = {'anotherAlias1', 'anotherAlias2'},
-- })
-- The args table is altered in place; the function returns nil.
local function consolidateAliases(args, aliases)
	for argName, aliases in pairs(aliases) do
		for i, alias in ipairs(aliases) do
			if not args[argName] and args[alias] then
				args[argName] = args[alias]
			end
			args[alias] = nil
		end
	end
	return nil
end

-- Make a collapsed wikitable with the given header and content. 
local function makeCollapsedWikitable(header, content)
	return string.format(COLLAPSE_TEMPLATE, header, content)
end

local function buildBulletedList()
end

local function determineGeneralEligibility()
end

local function determinePolicyCompliance()
end

local function determineHookEligibility()
end

local function determineImageEligibility()
end

local function determineQPQ()
end

function p._main(args)
	consolidateAliases(args, {plagiarismfree = {'plagarismfree'}})
end

function p.main(frame)
	local args = require('Module:Arguments').getArgs(frame, {
		wrappers = 'Template:DYK checklist',
	})
	return p._main(args)
end

return p