<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://www.digitalcellulose.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AEtymology</id>
	<title>Module:Etymology - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://www.digitalcellulose.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AEtymology"/>
	<link rel="alternate" type="text/html" href="http://www.digitalcellulose.com/wiki/index.php?title=Module:Etymology&amp;action=history"/>
	<updated>2026-05-14T22:03:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>http://www.digitalcellulose.com/wiki/index.php?title=Module:Etymology&amp;diff=98996&amp;oldid=prev</id>
		<title>Adminsuzy: Created page with &quot;local export = {}   --	If language is an etymology language, iterates through parent languages 		until it finds a non-etymology language.  function export.getNonEtymologic...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.digitalcellulose.com/wiki/index.php?title=Module:Etymology&amp;diff=98996&amp;oldid=prev"/>
		<updated>2018-09-09T15:29:22Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local export = {}   --[[	If language is an etymology language, iterates through parent languages 		until it finds a non-etymology language. ]] function export.getNonEtymologic...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local export = {}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[	If language is an etymology language, iterates through parent languages&lt;br /&gt;
		until it finds a non-etymology language. ]]&lt;br /&gt;
function export.getNonEtymological(lang)&lt;br /&gt;
	while lang:getType() == &amp;quot;etymology language&amp;quot; do&lt;br /&gt;
		local parentCode = lang:getParentCode()&lt;br /&gt;
		local parent = require(&amp;quot;Module:languages&amp;quot;).getByCode(parentCode)&lt;br /&gt;
			or require(&amp;quot;Module:etymology languages&amp;quot;).getByCode(parentCode)&lt;br /&gt;
			or require(&amp;quot;Module:families&amp;quot;).getByCode(parentCode)&lt;br /&gt;
		&lt;br /&gt;
		lang = parent&lt;br /&gt;
--		mw.log(terminfo.lang:getCode() .. &amp;quot; &amp;quot; .. terminfo.lang:getType())&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return lang&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function termError(terminfo)&lt;br /&gt;
	if terminfo.lang:getType() == &amp;quot;family&amp;quot; then&lt;br /&gt;
		if terminfo.term and terminfo.term ~= &amp;quot;-&amp;quot; then&lt;br /&gt;
			require(&amp;quot;Module:debug&amp;quot;).track(&amp;quot;etymology/family/has-term&amp;quot;)&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		terminfo.term = &amp;quot;-&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	return terminfo&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function createLink(terminfo, templateName)&lt;br /&gt;
	local link = &amp;quot;&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	if terminfo.term == &amp;quot;-&amp;quot; then&lt;br /&gt;
		--[=[&lt;br /&gt;
		[[Special:WhatLinksHere/Template:tracking/cognate/no-term]]&lt;br /&gt;
		[[Special:WhatLinksHere/Template:tracking/derived/no-term]]&lt;br /&gt;
		[[Special:WhatLinksHere/Template:tracking/borrowed/no-term]]&lt;br /&gt;
		[[Special:WhatLinksHere/Template:tracking/calque/no-term]]&lt;br /&gt;
		]=]&lt;br /&gt;
		require(&amp;quot;Module:debug&amp;quot;).track(templateName .. &amp;quot;/no-term&amp;quot;)&lt;br /&gt;
	else&lt;br /&gt;
--		mw.log(terminfo.term)&lt;br /&gt;
		link = &amp;quot; &amp;quot; .. require(&amp;quot;Module:links&amp;quot;).full_link(terminfo, &amp;quot;term&amp;quot;, true)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return link&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function export.format_etyl(lang, source, sort_key, categories)&lt;br /&gt;
	local info = {}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	-- [[Special:WhatLinksHere/Template:tracking/etymology/sortkey]]&lt;br /&gt;
	if sort_key then&lt;br /&gt;
		require(&amp;quot;Module:debug&amp;quot;).track(&amp;quot;etymology/sortkey&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if not categories then&lt;br /&gt;
		categories = {}&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if source:getCode() == &amp;quot;und&amp;quot; then&lt;br /&gt;
		info = {&lt;br /&gt;
			display = &amp;quot;undetermined&amp;quot;,&lt;br /&gt;
			cat_name = &amp;quot;other languages&amp;quot;,&lt;br /&gt;
		}&lt;br /&gt;
	elseif source:getCode() == &amp;quot;mul-tax&amp;quot; then&lt;br /&gt;
		info = {&lt;br /&gt;
			display = &amp;quot;[[w:taxonomic name|taxonomic name]]&amp;quot;,&lt;br /&gt;
			cat_name = &amp;quot;taxonomic names&amp;quot;,&lt;br /&gt;
		}&lt;br /&gt;
	else&lt;br /&gt;
		info.display = source:makeWikipediaLink()&lt;br /&gt;
		&lt;br /&gt;
		if source:getType() == &amp;quot;family&amp;quot; then&lt;br /&gt;
			info.cat_name = source:getCategoryName()&lt;br /&gt;
		else&lt;br /&gt;
			info.cat_name = source:getCanonicalName()&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Add the categories, but only if there is a current language&lt;br /&gt;
	&lt;br /&gt;
	if lang then&lt;br /&gt;
		local m_utilities = require(&amp;quot;Module:utilities&amp;quot;)&lt;br /&gt;
		&lt;br /&gt;
		if lang:getCode() == source:getCode() then&lt;br /&gt;
			table.insert(categories, lang:getCanonicalName() .. &amp;quot; twice-borrowed terms&amp;quot;)&lt;br /&gt;
		else&lt;br /&gt;
			table.insert(categories, lang:getCanonicalName() .. &amp;quot; terms derived from &amp;quot; .. info.cat_name)&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		categories = m_utilities.format_categories(categories, lang, sort_key)&lt;br /&gt;
	else&lt;br /&gt;
		categories = &amp;quot;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return &amp;quot;&amp;lt;span class=\&amp;quot;etyl\&amp;quot;&amp;gt;&amp;quot; .. info.display .. categories .. &amp;quot;&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Internal implementation of {{cognate|...}} template&lt;br /&gt;
function export.format_cognate(terminfo, sort_key)&lt;br /&gt;
	return export.format_derived(nil, terminfo, sort_key, &amp;quot;cognate&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Internal implementation of {{derived|...}} template&lt;br /&gt;
function export.format_derived(lang, terminfo, sort_key, templateName)&lt;br /&gt;
	local source = terminfo.lang&lt;br /&gt;
	&lt;br /&gt;
	terminfo.lang = export.getNonEtymological(terminfo.lang)&lt;br /&gt;
&lt;br /&gt;
	terminfo = termError(terminfo)&lt;br /&gt;
	&lt;br /&gt;
	local link = createLink(terminfo, templateName or &amp;quot;derived&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	return export.format_etyl(lang, source, sort_key) .. link&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Internal implementation of {{inherited|...}} template&lt;br /&gt;
function export.format_inherited(lang, terminfo, sort_key)&lt;br /&gt;
	local source = terminfo.lang&lt;br /&gt;
&lt;br /&gt;
	terminfo = termError(terminfo)&lt;br /&gt;
	&lt;br /&gt;
	terminfo.lang = export.getNonEtymological(terminfo.lang)&lt;br /&gt;
&lt;br /&gt;
	if not lang:hasAncestor(terminfo.lang) and mw.title.getCurrentTitle().nsText ~= &amp;quot;Template&amp;quot; then&lt;br /&gt;
		local function showLanguage(lang)&lt;br /&gt;
			return (&amp;quot;[[:Category:%s|%s]] (%s)&amp;quot;)&lt;br /&gt;
				:format(lang:getCategoryName(), lang:getCanonicalName(), lang:getCode())&lt;br /&gt;
		end&lt;br /&gt;
		local postscript&lt;br /&gt;
		local ancestors = lang:getAncestors()&lt;br /&gt;
		local moduleLink = &amp;quot;[[Module:&amp;quot;&lt;br /&gt;
			.. require(&amp;quot;Module:languages&amp;quot;).getDataModuleName(lang:getCode())&lt;br /&gt;
			.. &amp;quot;]]&amp;quot;&lt;br /&gt;
		if not ancestors[1] then&lt;br /&gt;
			postscript = showLanguage(lang) .. &amp;quot; has no ancestors.&amp;quot;&lt;br /&gt;
		else&lt;br /&gt;
			local ancestorList = table.concat(&lt;br /&gt;
				require(&amp;quot;Module:fun&amp;quot;).map(&lt;br /&gt;
					showLanguage,&lt;br /&gt;
					ancestors),&lt;br /&gt;
				&amp;quot; and &amp;quot;)&lt;br /&gt;
			postscript = (&amp;quot;The ancestor%s of %s %s %s.&amp;quot;):format(&lt;br /&gt;
				ancestors[2] and &amp;quot;s&amp;quot; or &amp;quot;&amp;quot;, lang:getCanonicalName(),&lt;br /&gt;
				ancestors[2] and &amp;quot;are&amp;quot; or &amp;quot;is&amp;quot;, ancestorList)&lt;br /&gt;
		end&lt;br /&gt;
		error((&amp;quot;%s is not set as an ancestor of %s in %s. %s&amp;quot;)&lt;br /&gt;
			:format(showLanguage(terminfo.lang), showLanguage(lang), moduleLink, postscript))&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local categories = {}&lt;br /&gt;
	&lt;br /&gt;
	local link = createLink(terminfo, &amp;quot;inherited&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	table.insert(categories, lang:getCanonicalName() .. &amp;quot; terms inherited from &amp;quot; .. source:getCanonicalName())&lt;br /&gt;
	&lt;br /&gt;
	return export.format_etyl(lang, source, sort_key, categories) .. link&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Internal implementation of {{borrowed|...}} template&lt;br /&gt;
function export.format_borrowed(lang, terminfo, sort_key, nocap, notext, borrowing_type)&lt;br /&gt;
	local source = terminfo.lang&lt;br /&gt;
	&lt;br /&gt;
	terminfo.lang = export.getNonEtymological(terminfo.lang)&lt;br /&gt;
	&lt;br /&gt;
	terminfo = termError(terminfo)&lt;br /&gt;
	&lt;br /&gt;
	local text = &amp;quot;&amp;quot;&lt;br /&gt;
	local categories = {}&lt;br /&gt;
&lt;br /&gt;
	if lang:getCode() == source:getCode() then&lt;br /&gt;
		table.insert(categories, lang:getCanonicalName() .. &amp;quot; twice-borrowed terms&amp;quot;)&lt;br /&gt;
	elseif source:getType() == &amp;quot;family&amp;quot; then&lt;br /&gt;
		table.insert(categories, lang:getCanonicalName() .. &amp;quot; terms borrowed from &amp;quot; .. source:getCategoryName())&lt;br /&gt;
	else&lt;br /&gt;
		table.insert(categories, lang:getCanonicalName() .. &amp;quot; terms borrowed from &amp;quot; .. source:getCanonicalName())&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not notext then&lt;br /&gt;
		if borrowing_type == &amp;quot;learned&amp;quot; then&lt;br /&gt;
			text = &amp;quot;[[learned borrowing|&amp;quot; .. (nocap and &amp;quot;l&amp;quot; or &amp;quot;L&amp;quot;) .. &amp;quot;earned borrowing]] from &amp;quot;&lt;br /&gt;
		elseif borrowing_type == &amp;quot;orthographic&amp;quot; then&lt;br /&gt;
			text = &amp;quot;[[orthographic|&amp;quot; .. (nocap and &amp;quot;o&amp;quot; or &amp;quot;O&amp;quot;) .. &amp;quot;rthographic]] [[Appendix:Glossary#borrowing|borrowing]] from &amp;quot;&lt;br /&gt;
		elseif borrowing_type == &amp;quot;unadapted&amp;quot; then&lt;br /&gt;
			text = &amp;quot;[[Appendix:Glossary#unadapted borrowing|&amp;quot; .. (nocap and &amp;quot;u&amp;quot; or &amp;quot;U&amp;quot;) .. &amp;quot;nadapted borrowing]] from &amp;quot;&lt;br /&gt;
		else&lt;br /&gt;
			text = &amp;quot;[[Appendix:Glossary#loanword|Borrowing]] from &amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if borrowing_type == &amp;quot;learned&amp;quot; then&lt;br /&gt;
		table.insert(categories, lang:getCanonicalName() .. &amp;quot; learnedly borrowed terms&amp;quot;)&lt;br /&gt;
	elseif borrowing_type == &amp;quot;orthographic&amp;quot; then&lt;br /&gt;
		table.insert(categories, lang:getCanonicalName() .. &amp;quot; orthographically borrowed terms&amp;quot;)&lt;br /&gt;
	elseif borrowing_type == &amp;quot;unadapted&amp;quot; then&lt;br /&gt;
		if source:getType() == &amp;quot;family&amp;quot; then&lt;br /&gt;
			table.insert(categories, lang:getCanonicalName() .. &amp;quot; unadapted borrowings from &amp;quot; .. source:getCategoryName())&lt;br /&gt;
		else&lt;br /&gt;
			table.insert(categories, lang:getCanonicalName() .. &amp;quot; unadapted borrowings from &amp;quot; .. source:getCanonicalName())&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local link = createLink(terminfo, &amp;quot;borrowed&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	return text .. export.format_etyl(lang, source, sort_key, categories) .. link&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Internal implementation of {{calque|...}} template&lt;br /&gt;
function export.calque(lang, terminfo, sort_key, nocap, notext)&lt;br /&gt;
	local result = &amp;quot;&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	if not notext then&lt;br /&gt;
		result = result .. &amp;quot;[[Appendix:Glossary#calque|&amp;quot; .. (nocap and &amp;quot;c&amp;quot; or &amp;quot;C&amp;quot;) .. &amp;quot;alque]] of &amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local source = terminfo.lang&lt;br /&gt;
	&lt;br /&gt;
	terminfo.lang = export.getNonEtymological(terminfo.lang)&lt;br /&gt;
&lt;br /&gt;
	terminfo = termError(terminfo)&lt;br /&gt;
&lt;br /&gt;
	local categories = {}&lt;br /&gt;
&lt;br /&gt;
	if source:getType() == &amp;quot;family&amp;quot; then&lt;br /&gt;
		table.insert(categories, lang:getCanonicalName() .. &amp;quot; terms calqued from &amp;quot; .. source:getCategoryName())&lt;br /&gt;
	else&lt;br /&gt;
		table.insert(categories, lang:getCanonicalName() .. &amp;quot; terms calqued from &amp;quot; .. source:getCanonicalName())&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local link = createLink(terminfo, &amp;quot;calque&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	result = result .. &amp;quot; &amp;quot; ..  export.format_etyl(lang, source, sort_key, categories) .. link&lt;br /&gt;
	&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Internal implementation of {{semantic loan|...}} template&lt;br /&gt;
function export.format_semantic_loan(lang, terminfo, sort_key, nocap, notext)&lt;br /&gt;
	if nocap then&lt;br /&gt;
		require(&amp;quot;Module:debug&amp;quot;).track(&amp;quot;semantic_loan/nocap&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local source = terminfo.lang&lt;br /&gt;
	&lt;br /&gt;
	terminfo.lang = export.getNonEtymological(terminfo.lang)&lt;br /&gt;
&lt;br /&gt;
	terminfo = termError(terminfo)&lt;br /&gt;
&lt;br /&gt;
	local text = &amp;quot;&amp;quot;&lt;br /&gt;
	local categories = {}&lt;br /&gt;
&lt;br /&gt;
	if source:getType() == &amp;quot;family&amp;quot; then&lt;br /&gt;
		table.insert(categories, lang:getCanonicalName() .. &amp;quot; semantic loans from &amp;quot; .. source:getCategoryName())&lt;br /&gt;
	else&lt;br /&gt;
		table.insert(categories, lang:getCanonicalName() .. &amp;quot; semantic loans from &amp;quot; .. source:getCanonicalName())&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if not notext then&lt;br /&gt;
		text = &amp;quot;[[w:Semantic loan|&amp;quot; .. (nocap and &amp;quot;s&amp;quot; or &amp;quot;S&amp;quot;) .. &amp;quot;emantic loan]] from &amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local link = createLink(terminfo, &amp;quot;semantic_loan&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	return text .. export.format_etyl(lang, source, sort_key, categories) .. link&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Internal implementation of {{phono-semantic matching|...}} template&lt;br /&gt;
function export.psm(lang, terminfo, sort_key, nocap, notext)&lt;br /&gt;
	if nocap then&lt;br /&gt;
		require(&amp;quot;Module:debug&amp;quot;).track(&amp;quot;psm/nocap&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local source = terminfo.lang&lt;br /&gt;
	&lt;br /&gt;
	terminfo.lang = export.getNonEtymological(terminfo.lang)&lt;br /&gt;
&lt;br /&gt;
	terminfo = termError(terminfo)&lt;br /&gt;
&lt;br /&gt;
	local text = &amp;quot;&amp;quot;&lt;br /&gt;
	local categories = {}&lt;br /&gt;
&lt;br /&gt;
	if source:getType() == &amp;quot;family&amp;quot; then&lt;br /&gt;
		table.insert(categories, lang:getCanonicalName() .. &amp;quot; phono-semantic matchings &amp;quot;)&lt;br /&gt;
	else&lt;br /&gt;
		table.insert(categories, lang:getCanonicalName() .. &amp;quot; phono-semantic matchings &amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if not notext then&lt;br /&gt;
		text = &amp;quot;[[w:Phono-semantic matching|&amp;quot; .. (nocap and &amp;quot;p&amp;quot; or &amp;quot;P&amp;quot;) .. &amp;quot;hono-semantic matching]] of &amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local link = createLink(terminfo, &amp;quot;psm&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	return text .. export.format_etyl(lang, source, sort_key, categories) .. link&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return export&lt;/div&gt;</summary>
		<author><name>Adminsuzy</name></author>
		
	</entry>
</feed>