Jump to content

Module:User:SuggestBot/WikiProjects

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Nettrom (talk | contribs) at 21:46, 10 August 2015 (add variable for order of task categories). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local wp = {}

-- BTW: Lua allows literal strings declarations [[ ]], but the syntax
-- highlighter doesn't support them properly, fails if the string contains
-- another set of square brackets...

-- List start example, showing what we're aiming to do...
-- Note that the intro-parameter always ends with a '<br />'
local list_start = "{{WPX list start|color={{{2|#086}}}<includeonly>|constrained=yes</includeonly>" ..
	"|title=Add sources|intro=See [[Wikipedia:Citing sources]] for more information.<br />" ..
	"{{WPX last updated|Wikipedia:WikiProject_Ghana/Tasks/SuggestBot}}}}"

-- Mapping of SuggestBot's task categories (see [[User:SuggestBot/Documentation/Task categories]])
-- to section titles and descriptions, and the order in which they will be presented
local taskcat_order = {'source', 'cleanup', 'expand', 'unenc',
	'merge', 'wikify', 'orphan', 'stub'}
local taskcat_map = {
	source={
		title='Add sources',
		descr='See [[Wikipedia:Citing sources]] for more information.<br />'
	},
	cleanup={
		title='Cleanup',
		descr='Improve the presentation of content.'
	},
	expand={
		title='Expand',
		descr='Add more information to these articles.'
	},
	unenc={
		title='Unencyclopaedic',
		descr='Remove content that is not relevant for an encyclopaedia.'
	},
	merge={
		title='Merge',
		descr='Should this article be merged with another article?'
	},
	wikify={
		title='Wikify',
		descr='Improve the wiki-formatting on this article.'
	},
	orphan={
		title='Orphan',
		descr='Few or no articles link to this article.'
	},
	stub={
		title='Stub',
		descr='Expand on this brief article.'
	}
}

local function has_key(tbl, key)
	return tbl[key] ~= nil	
end

function wp.hello(frame)
	return "Hello World!"	
end

function wp.test_args(frame)
	result = "The method got the following arguments:"
	if has_key(frame, 'is_included') then
		result = result .. "\n* is_included" .. frame.args['is_included']
	end
	for k, v in pairs(frame.args) do
		result = result .. "\n* " .. k .. "=" .. v				
	end
	return result
end

return wp