Difference between revisions 21306653 and 21306654 on frwiktionary

local export = {}
local langtemplates = require('Module:languages/templates')

-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
	if mw.title.getCurrentTitle().nsText == "Template" then
		return "(This template should be used on pages in the Category: namespace.)"
(contracted; show full)
	if info.template == "derivcatboiler" and not info.code and (not info.label or info.label == "ROOT") and mw.title.getCurrentTitle().text ~= "Terms derived from other languages" then
		pagename = mw.title.getCurrentTitle().text
		pagename = mw.text.split(pagename, ' derived from ')
		if pagename[1] == "Terms " then
			info.label = "ROOT"
			info.code = langtemplates.getByCanonicalName(pagename[2])
		else
			local source = mw.ustring.sub
s(pagename[1], 1, -7)
			if pagename[2] == "other languages" then
				local dest = "ROOT"
			else
				local dest = pagename[2]		
			end
			info.label = langtemplates.getByCanonicalName(dest)
			info.code = langtemplates.getByCanonicalName(source)
(contracted; show full)			return mw.getCurrentFrame():expandTemplate{title = TOC_template.text, args = {}}
		end
	end
	
	return nil
end

return export