Модул:category tree/requests

Документација модула[прикажи] [уреди] [историја] [освежи]

To do: make this use a Category object.

Lua грешка на линији 515: Име категорије није препозната..

local m_languages = require("Модул:languages")

local export = {}

local function show_pagelist()
	
	local recent = mw.getCurrentFrame():callParserFunction{
		name = "#tag",
		args = {
			"DynamicPageList",
			"category=" .. mw.title.getCurrentTitle().text .. "\n" ..
			"count=10\n" ..
			"mode=ordered\n" ..
			"ordermethod=categoryadd\n" ..
			"order=descending"
		}
	}
	
	local oldest = mw.getCurrentFrame():callParserFunction{
		name = "#tag",
		args = {
			"DynamicPageList",
			"category=" .. mw.title.getCurrentTitle().text .. "\n" ..
			"count=10\n" ..
			"mode=ordered\n" ..
			"ordermethod=lastedit\n" ..
			"order=ascending"
		}
	}
	
	return [=[
{| id="newest-and-oldest-pages" class="wikitable" style="float: right; clear: both; margin: 0 0 .5em 1em;"
! Недавно додато у категорију
|-
| id="recent-additions" style="font-size:0.9em;" | ]=] .. recent .. [=[

|-
! Најстарије странице по задњој измени
|-
| id="oldest-pages" style="font-size:0.9em;" | ]=] .. oldest .. [=[

|}]=]
end

local function replace_template_refs(result, items, frame)
	--[[	Replaces pseudo-template code {{{ }}} with the corresponding member
			of the "items" table. Has to be done at least twice,
			since some of the items are nested:
			
			{{{template_syntax_with_language_code}}}

			{{{{{template_name}}}|{{{language_code}}}}}

			{{attention|en}}							]]
	
	while result:find("{{{") do
		result = mw.ustring.gsub(
			result,
			"{{{([^%}%{]+)}}}",
			function(item)
				if items[item] then
					if type(items[item]) == "string" or type(items[item]) == "number" then
						return items[item]
					else
						error('The item "{{{' .. item .. '}}}" is a ' .. type(item) .. ' and can\'t be concatenated. (Pagename: ' .. items.pagename .. '.)')
					end
				else
					error('The item "' .. item .. '" was not found in the "items" table. (Pagename: ' .. items.pagename .. '.)')
				end
			end
		)
	end
	
	-- Preprocess template code surrounded by << >>. In some cases we have a
	-- << >> template call nested inside of another one (this happens e.g. with
	-- "Requests for SCRIPT script for LANGUAGE terms"), so process them
	-- repeatedly from inside out.
	while result:find("<<") do
		result = mw.ustring.gsub(
			result,
			"<<([^><]+)>>",
			function (template_code)
				return frame:preprocess(template_code)
			end
		)
	end

	return result
end
	
function export.contents(frame)
	local items = {}
	
	local no_catfix = false
	local valid_category = false
	
	if type(frame) == "table" then
		items.pagename = mw.title.getCurrentTitle().text
	elseif type(frame) == "string" then
		items.pagename = frame
		frame = mw.getCurrentFrame()
	end
	
	local en = m_languages.getByCode("en")
	
	-- This array consists of category match specs. Each spec contains
	-- one or more properties, whose values are strings that may contain
	-- references to other properties using the {{{PROPERTY}}} syntax.
	-- Each such spec should have a least a `regex` property that matches the
	-- name of the category. Capturing groups in this regex can be referenced
	-- in other properties using {{{1}}} for the first group, {{{2}}} for the
	-- second group, etc. Property expansion happens recursively if needed
	-- (i.e. a property can reference another property, which in turn
	-- references a third property).
	--
	-- If there is a `language_name` propery, it specifies the language name
	-- (and will typically be a reference to a capturing group from the `regex`
	-- property); if not specified, it defaults to "{{{1}}}" unless the `nolang`
	-- property is set, in which case there is no language name derivable from
	-- the category name. The language name must be the canonical name of a
	-- recognized language, or an error is thrown. Based on the language name,
	-- the `language_code` and `language_object` properties are automatically
	-- filled in. 
	--
	-- If the `regex` values of multiple category specs match, the first one
	-- takes precedence.
	--
	-- Recognized or predefined properties:
	--
	-- `pagename`: Current pagename.
	-- `regex`: See above.
	-- `1`, `2`, `3`, ...: See above.
	-- `language_name`, `language_code`, `language_object`: See above.
	-- `nolang`: See above.
	-- `template_name`: Name of template which generates this category.
	-- `template_syntax`: Syntax for calling the template. Defaults to
	--    "{{{template_name}}}|{{{language_code}}}". Used to display
	--    an example template call and the output of this call.
	-- `template_syntax_nocat`: Syntax for calling the template. Takes
	--    precedence over `template_syntax` when generating example template
	--    output (but not when displaying an example template call) and is
	--    intended for a template call that uses the |nocat=1 parameter.
	-- `template_example_output`: Override the text that displays example
	--    template output (see `template_syntax`).
	-- `additional_template_description`: Extra text to be displayed after
	--    the example template output.
	-- `this_request_in_all_languages`: Parent all-language category.
	--    Sort key is based on the language name.
	-- `one_level_above_in_the_same_language`: Parent category in the same
	--    language, if any. Sort key is based on `request_sortkey`.
	-- `request_sortkey`: Sort key for this category in the same-language
	--    category specified by `one_level_above_in_the_same_language`.
	-- `not_hidden_category`: Don't hide the category.
	-- `catfix_lang`: Language object to use for generating a "catfix" on
	--    the page to ensure that entries on the page are appropriately styled;
	--    see [[Module:utilities]] for more information. Defaults to
	--    `language_object`.
	-- `no_catfix`: Disable generation of a "catfix" on the page (see
	--    `catfix_lang`).
	--
	-- An actual template call can be inserted into a string using the syntax
	-- <<{{TEMPLATE|ARG1|ARG2|...}}>>. Currently this is used internally
	-- to display the example template output (see `template_syntax` above).
	local categories = {
		{
			regex = "^Захтеви се односе на (.+)$",
			request_sortkey = "requests",
			this_request_in_all_languages = "Захтеви по језику",
			not_hidden_category = true
		},
		{
			regex = "^Захтеви за етимологије у (.+)м ставкама$",
			request_sortkey = "etymologies",
			template_name = "rfe",
			this_request_in_all_languages = "Захтеви за етимологије по језику",
		},
		{
			regex = "^Захтеви за ширење етимологије у (.+) ставкама$",
			request_sortkey = "expansion of etymologyies",
			template_name = "etystub",
			this_request_in_all_languages = "Захтеви за ширење етимологије по језику",
		},
		{
			regex = "^Захтеви за изговор у (.+) ставкама$",
			request_sortkey = "pronunciation",
			template_name = "rfp",
			this_request_in_all_languages = "Захтеви за изговор по језику",
		},
		{
			regex = "^Захтеви за аудио изговор у (.+) ставкама$",
			request_sortkey = "audio pronunciation",
			template_name = "rfap",
			this_request_in_all_languages = "Requests for audio pronunciation by language",
		},
		{
			regex = "^Захтеви за дефиниције у (.+)м ставкама$",
			request_sortkey = "definitions",
			template_name = "rfdef",
			this_request_in_all_languages = "Захтеви за дефиниције по језику",
		},
		{
			regex = "^Requests for clarification of definitions in (.+) ставкама$",
			request_sortkey = "clarification of definitions",
			template_name = "rfclarify",
			this_request_in_all_languages = "Requests for clarification of definitions by language",
		},
		{
			-- This is for part-of-speech-specific categories such as
			-- "Requests for inflections in Northern Ndebele noun entries" or
			-- "Requests for accents in Ukrainian proper noun entries".
			-- Here and below, we assume that the part of speech is begins with
			-- a lowercase letter, while the preceding language name ends in a
			-- capitalized word. Note that this entry comes before the
			-- following one and takes precedence over it.
			regex = "^Requests for inflections in (.-) ([a-z]+[a-z ]*) entries$",
			request_sortkey = "{{{2}}}",
			template_name = "rfinfl",
			template_syntax = "{{rfinfl|{{{language_code}}}|{{{2}}}}}",
			one_level_above_in_the_same_language = "Requests for inflections in {{{language_name}}} entries",
			this_request_in_all_languages = "Requests for inflections of {{{2}}}s by language",
		},
		{
			regex = "^Requests for inflections in (.+) ставкама$",
			request_sortkey = "inflections",
			template_name = "rfinfl",
			this_request_in_all_languages = "Requests for inflections by language",
		},
		{
			regex = "^Requests for inflections of (.+) by language$",
			nolang = true,
			request_sortkey = "inflections of {{{1}}}",
		},
		{
			regex = "^Requests for tone in (.-) ([a-z]+[a-z ]*) ставкама$",
			request_sortkey = "{{{2}}}",
			template_name = "rftone",
			template_syntax = "{{rftone|{{{language_code}}}|{{{2}}}}}",
			one_level_above_in_the_same_language = "Requests for tone in {{{language_name}}} ставкама",
			this_request_in_all_languages = "Requests for tone of {{{2}}}s by language",
		},
		{
			regex = "^Requests for tone in (.+) ставкама$",
			request_sortkey = "tone",
			template_name = "rftone",
			this_request_in_all_languages = "Requests for tone by language",
		},
		{
			regex = "^Requests for tone of (.+) by language$",
			nolang = true,
			request_sortkey = "tone of {{{1}}}",
		},
		{
			regex = "^Requests for accents in (.-) ([a-z]+[a-z ]*) ставкама$",
			request_sortkey = "{{{2}}}",
			template_name = "rfaccents",
			template_syntax = "{{rfaccents|{{{language_code}}}|{{{2}}}}}",
			one_level_above_in_the_same_language = "Requests for accents in {{{language_name}}} ставкама",
			this_request_in_all_languages = "Requests for accents of {{{2}}}s by language",
		},
		{
			regex = "^Requests for accents in (.+) ставкама$",
			request_sortkey = "accents",
			template_name = "rfaccents",
			this_request_in_all_languages = "Requests for accents by language",
		},
		{
			regex = "^Requests for accents of (.+) by language$",
			nolang = true,
			request_sortkey = "accents of {{{1}}}",
		},
		{
			regex = "^Requests for aspect in (.-) ([a-z]+[a-z ]*) ставкама$",
			request_sortkey = "{{{2}}}",
			template_name = "rfaspect",
			template_syntax = "{{rfaspect|{{{language_code}}}|{{{2}}}}}",
			one_level_above_in_the_same_language = "Requests for aspect in {{{language_name}}} ставкама",
			this_request_in_all_languages = "Requests for aspect of {{{2}}}s by language",
		},
		{
			regex = "^Requests for aspect in (.+) ставкама$",
			request_sortkey = "aspect",
			template_name = "rfaspect",
			this_request_in_all_languages = "Requests for aspect by language",
		},
		{
			regex = "^Requests for aspect of (.+) by language$",
			nolang = true,
			request_sortkey = "aspect of {{{1}}}",
		},
		{
			regex = "^Захтеви за пол у (.-)м ([a-z]+[a-z ]*) ставкама$",
			request_sortkey = "{{{2}}}",
			template_name = "rfgender",
			template_syntax = "{{rfgender|{{{language_code}}}|{{{2}}}}}",
			one_level_above_in_the_same_language = "Захтеви за пол у {{{language_name}}} ставкама",
			this_request_in_all_languages = "Захтеви за пол од {{{2}}}s по језику",
		},
		{
			regex = "^Захтеви за пол у (.+)м ставкама$",
			request_sortkey = "gender",
			template_name = "rfgender",
			this_request_in_all_languages = "Захтеви за пол по језику",
		},
		{
			regex = "^Захтеви за пол од (.+) по језику$",
			nolang = true,
			request_sortkey = "gender of {{{1}}}",
		},
		{
			regex = "^Захтеви за пример реченице у (.+)$",
			request_sortkey = "example sentences",
			template_name = "rfex",
			this_request_in_all_languages = "Захтеви за пример реченице по језику",
		},
		{
			regex = "^Захтеви за наводе у (.+)$",
			request_sortkey = "quotations",
			template_name = "rfquote",
			this_request_in_all_languages = "Захтеви за наводе по језику",
		},
		{
			regex = "^Захтеви за превод у (.+)$",
			request_sortkey = "translations",
			template_name = "t-needed",
			this_request_in_all_languages = "Захтеви за преводе по језику",
			catfix_lang = en,
		},
		{
			regex = "^Захтеви за преводе од (.+) примера коришћења$",
			request_sortkey = "translations of usage examples",
			template_name = "t-needed",
			template_syntax = "{{t-needed|{{{language_code}}}|usex=1}}",
			template_syntax_nocat = "{{t-needed|{{{language_code}}}|usex=1|nocat=1}}",
			this_request_in_all_languages = "Захтеви за преводе од примера коришћења по језику",
			additional_template_description = "\n\nThe <<{{temp|ux}}>>, <<{{temp|uxi}}>>, <<{{temp|quote}}>>, <<{{temp|Q}}>>, <<{{temp|ja-usex}}>> and <<{{temp|zh-x}}>> template automatically add the page to this category if the example is in a foreign language and the translation is missing."
		},
		{
			regex = "^Захтеви за преиспитивање (.+) преводи$",
			request_sortkey = "review of translations",
			template_name = "t-check",
			template_syntax = "{{t-check|{{{language_code}}}|example}}",
			template_example_output = "",
			this_request_in_all_languages = "Захтеви за преглед превода по језику",
			catfix_lang = en,
		},
		{
			regex = "^Захтеви за транслитерацију од (.+) термина$",
			request_sortkey = "transliteration",
			template_name = "rftranslit",
			this_request_in_all_languages = "Захтеви за транслитерацију по језику",
		},
		{
			regex = "^Requests for native script for (.+) terms$",
			request_sortkey = "native script",
			template_name = "rfscript",
			template_syntax_nocat = "{{rfscript|{{{language_code}}}|nocat=1}}",
			this_request_in_all_languages = "Requests for native script by language",
			no_catfix = true,
			additional_template_description = "\n\nMany templates such as <<{{temp|l}}>>, <<{{temp|m}}>> and <<{{temp|t}}>> automatically place the page in this category when they are missing the term but have been provided with a transliteration."
		},
		{
			regex = "^Requests for native script in (.+) примера коришћења$",
			request_sortkey = "native script in usage examples",
			template_name = "rfscript",
			template_syntax = "{{rfscript|{{{language_code}}}|usex=1}}",
			template_syntax_nocat = "{{rfscript|{{{language_code}}}|usex=1|nocat=1}}",
			this_request_in_all_languages = "Requests for native script in usage examples by language",
			no_catfix = true,
			additional_template_description = "\n\nThe <<{{temp|ux}}>> and <<{{temp|uxi}}>> templates automatically add the page to this category if the example itself is missing but the translation is supplied."
		},
		{
			regex = "^Захтеви за (.+) текст од (.+) термина$",
			language_name = "{{{2}}}",
			request_sortkey = "{{{1}}} script",
			template_name = "rfscript",
			script_code = "<<{{#invoke:scripts/templates|getByCanonicalName|{{{1}}}}}>>",
			template_syntax = "{{rfscript|{{{language_code}}}|sc={{{script_code}}}}}",
			template_syntax_nocat = "{{rfscript|{{{language_code}}}|sc={{{script_code}}}|nocat=1}}",
			one_level_above_in_the_same_language = "Requests for native script for {{{language_name}}} terms",
			this_request_in_all_languages = "Requests for {{{1}}} script by language",
			no_catfix = true,
			additional_template_description = "\n\nMany templates such as <<{{temp|l}}>>, <<{{temp|m}}>> and <<{{temp|t}}>> automatically place the page in this category when they are missing the term but have been provided with a transliteration."
		},
		{
			regex = "^Захтеви за (.+) текст по језику$",
			nolang = true,
			request_sortkey = "{{{1}}} script",
		},
		{
			regex = "^Захеви за слике у (.+) ставкама$",
			request_sortkey = "images",
			template_name = "rfi",
			this_request_in_all_languages = "Захтеви за слике по језику",
		},
		{
			regex = "^Захтеви за референце за (.+) термине$",
			request_sortkey = "references",
			template_name = "rfref",
			this_request_in_all_languages = "Захтеви за референце по језику",
		},
		{
			regex = "^Захтеви за референце за етимологије у (.+) ставкама$",
			request_sortkey = "references for etymologies",
			template_name = "rfv-etym",
			one_level_above_in_the_same_language = "Захтеви за референце за {{{language_name}}} термине",
			this_request_in_all_languages = "Захтеви за референце за етимологије по језику",
		},
		{
			regex = "^Захтеви за референце за изговарање у (.+) ставкама$",
			request_sortkey = "references for pronunciations",
			template_name = "rfv-pron",
			one_level_above_in_the_same_language = "Requests for references for {{{language_name}}} terms",
			this_request_in_all_languages = "Захтеви за референце за изговор по језику",
		},
		{
			regex = "^Захтеви за пажњу у вези (.+)$",
			request_sortkey = "attention",
			template_name = "attention",
			template_example_output = "This template does not generate any text in ставкама.",
			this_request_in_all_languages = "Захтеви за пажњу по језику",
			no_catfix = true,
		},
		{
			regex = "^Requests for cleanup in (.+) ставкама$",
			request_sortkey = "cleanup",
			template_name = "rfc",
			template_syntax_nocat = "{{rfc|{{{language_code}}}|nocat=1}}",
			this_request_in_all_languages = "Requests for cleanup by language",
		},
		{
			regex = "^Requests for cleanup of Pronunciation N headers in (.+) ставкама$",
			request_sortkey = "cleanup of Pronunciation N headers",
			template_name = "rfc-pron-n",
			template_syntax_nocat = "{{rfc-pron-n|{{{language_code}}}|nocat=1}}",
			template_example_output = "This template does not generate any text in ставкама.",
			this_request_in_all_languages = "Requests for cleanup of Pronunciation N headers by language",
			additional_template_description = [=[

The purpose of this category is to tag entries that use headers with "Pronunciation" and a number.

While these headers and structure are sometimes used, they are not specifically prescribed by [[WT:ELE]]. No complete proposal has yet been made on how they should work, what the semantics are, or how they interact with multiple etymologies. As a result they should generally be avoided. Instead, merge the entries (possibly under multiple Etymology sections, if appropriate), and list all pronunciations, appropriately tagged, under a Pronunciation header.

[[User:KassadBot|KassadBot]] tags these entries (or used to tag these entries, when the bot was operational). At some point if a proposal is made and adopted as policy, these entries should be reviewed.

This category is hidden.]=],
		},
		{
			regex = "^Захтеви за брисање у (.+) ставкама$",
			request_sortkey = "deletion",
			template_name = "rfd",
			template_syntax_nocat = "{{rfd|{{{language_code}}}|nocat=1}}",
			this_request_in_all_languages = "Захтеви за брисање по језику",
		},
		{
			regex = "^Requests for verification in (.+) ставкама$",
			request_sortkey = "verification",
			template_name = "rfv",
			this_request_in_all_languages = "Requests for verification by language",
		},
		{
			regex = "^Захтеви за пажњу у етимологијама у (.+) ставкама$",
			request_sortkey = "attention in etymologies",
			this_request_in_all_languages = "Захтеви за пажњу у етимологијама по језику",
		},
		{
			regex = "^Захтеви за навод/(.+)$",
			request_sortkey = "{{{1}}}",
			nolang = true,
			template_name = "rfquotek",
			template_syntax = "{{rfquotek|LANGCODE|{{{1}}}}}",
			template_example_output = "\n(where LANGCODE is the language code of the entry)\n\nIt results in the message below:\n\n<<{{rfquotek|und|{{{1}}}}}>>",
			one_level_above_in_the_same_language = "Захтеви за наводе по извору",
		},
		{
			regex = "^Захтеви за датум/(.+)$",
			request_sortkey = "{{{1}}}",
			nolang = true,
			template_name = "rfdatek",
			template_syntax = "{{rfdatek|LANGCODE|{{{1}}}}}",
			template_example_output = "\n(where LANGCODE is the language code of the entry)\n\nIt results in the message below:\n\n<<{{rfdatek|und|{{{1}}}}}>>",
			one_level_above_in_the_same_language = "Захтеви за датум по извору",
		},
	}
	
	for i, category in ipairs(categories) do
		local matchvals = {mw.ustring.match(items.pagename, category.regex)}
		if #matchvals > 0 then
			valid_category = true
			
			for key, value in pairs(category) do
				items[key] = value
			end
			for key, value in ipairs(matchvals) do
				items["" .. key] = value
			end
			
			if not category.not_hidden_category then
				items.hidden_category = "__HIDDENCAT__"
			end
			break
		end
	end

	if not valid_category and mw.ustring.find(items.pagename, "^Захтеви .* по језику$") then
		for i, category in ipairs(categories) do	
			if items.pagename == category.this_request_in_all_languages then
				valid_category = true
				
				items.request_sortkey = category.request_sortkey
			end
		end
	end

	if not valid_category then
		error("Име категорије није препозната.")
	end
	
	if items.regex and not items.nolang then
		items.language_name = items.language_name or "{{{1}}}"
		items.language_name = replace_template_refs(items.language_name, items, frame)
		items.language_object = m_languages.getByCanonicalName(items.language_name) or error ('The category title contains an invalid language name, "' .. items.language_name .. '". Choose a canonical name from the data modules of Модул:languages.')
		items.language_code = items.language_object:getCode()
	end
	
	items.edit_link = "{| class='wikitable noprint plainlinks' style='float: right'\n| '''[https://sr.wiktionary.org/w/index.php?title=Модул:category_tree/requests&action=edit Унос категорије података]'''\n|}"
	
	items.description = ("\nОва категорија садржи '''{{{pagename}}}'''.")

	if items.template_name then
		if items.template_syntax then
			items.template_syntax_with_language_code = items.template_syntax
		else
			items.template_syntax_with_language_code = ("{{{{{template_name}}}|{{{language_code}}}}}")
		end

		items.full_text_about_the_template = "\n" .. ("To make this request, in this specific language, use this code in the entry (see also the documentation at [[Шаблон:{{{template_name}}}]]):\n\n<pre>{{{template_syntax_with_language_code}}}</pre>")

		if items.template_example_output then
			items.full_text_about_the_template = items.full_text_about_the_template .. " " .. items.template_example_output
		else
			if items.template_syntax_nocat then
				items.full_text_about_the_template = items.full_text_about_the_template .. "\nIt results in the message below:\n\n<<{{{template_syntax_nocat}}}>>"
			else
				items.full_text_about_the_template = items.full_text_about_the_template .. "\nIt results in the message below:\n\n<<{{{template_syntax_with_language_code}}}>>"
			end
		end
		if items.additional_template_description then
			items.full_text_about_the_template = items.full_text_about_the_template .. items.additional_template_description
		end
	end
	
	if not items.one_level_above_in_the_same_language then
		if mw.ustring.find(items.pagename, "^Захтеви .* по језику$") then
			items.one_level_above_in_the_same_language = "Захтеви подкатегорија по језику"
		elseif mw.ustring.find(items.pagename, "^Захтеви се односе на .*") then
			items.one_level_above_in_the_same_language = "{{{language_name}}} приступ сервисирању"
		else
			items.one_level_above_in_the_same_language = "Захтеви се односе на {{{language_name}}}"
		end
	end

	if items.one_level_above_in_the_same_language then
		items.one_level_above_in_the_same_language_text = "[[Категорија:{{{one_level_above_in_the_same_language}}}|{{{request_sortkey}}}]]"
	end
	
	if items.regex and not items.nolang then
		items.this_request_in_all_languages_text = ("[[Категорија:{{{this_request_in_all_languages}}}|{{{language_name}}}]]")
	end
	
	if items.catfix_lang or ( not items.no_catfix and items.language_object ) then
		items.catfix = require("Модул:utilities").catfix(items.catfix_lang or items.language_object)
	end
	
	items.pagename = mw.ustring.gsub(items.pagename, "Захтеви", "захтеви")
	
	result = require("Модул:table").compressSparseArray{ items.hidden_category, items.catfix, items.edit_link, show_pagelist(), items.description, items.full_text_about_the_template, items.one_level_above_in_the_same_language_text, items.this_request_in_all_languages_text }
	table.insert(result, "__EXPECTUNUSEDCATEGORY__")
	result = table.concat(result, "\n")

	result = replace_template_refs(result, items, frame)
	return result
end

function export.test(frame)
	if type(frame) ~= "table" then
		error('The function "' .. test '" requires a frame object as argument.')
	end
	
	local pagenames = {}
	local results = {}
	
	for i, item in pairs(frame.args) do
		mw.text.trim(item)
		table.insert(pagenames, item)
		item = export.contents(item)
		item = frame:extensionTag{ name = "syntaxhighlight", content = item, args = { lang = "html" } }
		table.insert(results, item)
	end
	
	local output = {}
	
	table.insert(output, '{| class="wikitable"')
	
	for i, result in pairs(results) do
		table.insert(output, '\n|-\n| [[:Категорија:' .. pagenames[i] .. '|' .. pagenames[i] .. ']] || ' .. result)
	end
	
	table.insert(output, '\n|}')
	
	return table.concat(output)
end

return export

-- For Vim, so we get 4-space tabs
-- vim: set ts=4 sw=4 noet: