Jump to content

Module:ru-link

From Wiktionary, the free dictionary
local export = {}

local full_link = require 'Module:links'.full_link
local ru = require 'Module:languages'.getByCode 'ru'

-- Just guessing at some of these!
local abbreviations = {
	a = 'adjective', advpro = 'adverbial pronoun', anum = 'adjectival numeral',
	apro = 'adjectival pronoun', conj = 'conjunction', init = 'initialism',
	intj = 'interjection', num = 'numeral', part = 'particle',
	pr = 'preposition', s = 'substantive', spro = 'substantival pronoun',
	v = 'verb',
}

function export.link_list(frame)
	local list = frame.args[1]
	
	list = list:gsub(
		'# ([^,]+), ([^\n]+)',
		function (word, POS)
			return '# ' .. full_link { lang = ru, term = word,
				pos = abbreviations[POS] or POS }
		end)
	
	return list
end

return export