<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://linguifex.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3Arootsee</id>
	<title>Module:rootsee - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://linguifex.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3Arootsee"/>
	<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:rootsee&amp;action=history"/>
	<updated>2026-05-24T06:30:17Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://linguifex.com/w/index.php?title=Module:rootsee&amp;diff=508695&amp;oldid=prev</id>
		<title>Sware: Created page with &quot;local export = {}  local m_languages = require(&quot;Module:languages&quot;) local scripts_module = &quot;Module:scripts&quot;  local rsplit = mw.text.split   local function categorize(lang, source, root, id) 	local categories = {}  	local root_suffix = &quot; root &quot; .. root .. (id and &quot; (&quot; .. id .. &quot;)&quot; or &quot;&quot;) 	if source then 		root_suffix = &quot;the &quot; .. source:getCanonicalName() .. root_suffix 	else 		root_suffix = &quot;the&quot; .. root_suffix 	end  	if not lang then 		return &quot;Terms derived from &quot; .. root...&quot;</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:rootsee&amp;diff=508695&amp;oldid=prev"/>
		<updated>2026-05-06T18:05:28Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local export = {}  local m_languages = require(&amp;quot;Module:languages&amp;quot;) local scripts_module = &amp;quot;Module:scripts&amp;quot;  local rsplit = mw.text.split   local function categorize(lang, source, root, id) 	local categories = {}  	local root_suffix = &amp;quot; root &amp;quot; .. root .. (id and &amp;quot; (&amp;quot; .. id .. &amp;quot;)&amp;quot; or &amp;quot;&amp;quot;) 	if source then 		root_suffix = &amp;quot;the &amp;quot; .. source:getCanonicalName() .. root_suffix 	else 		root_suffix = &amp;quot;the&amp;quot; .. root_suffix 	end  	if not lang then 		return &amp;quot;Terms derived from &amp;quot; .. root...&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;
local m_languages = require(&amp;quot;Module:languages&amp;quot;)&lt;br /&gt;
local scripts_module = &amp;quot;Module:scripts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
local rsplit = mw.text.split&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function categorize(lang, source, root, id)&lt;br /&gt;
	local categories = {}&lt;br /&gt;
&lt;br /&gt;
	local root_suffix = &amp;quot; root &amp;quot; .. root .. (id and &amp;quot; (&amp;quot; .. id .. &amp;quot;)&amp;quot; or &amp;quot;&amp;quot;)&lt;br /&gt;
	if source then&lt;br /&gt;
		root_suffix = &amp;quot;the &amp;quot; .. source:getCanonicalName() .. root_suffix&lt;br /&gt;
	else&lt;br /&gt;
		root_suffix = &amp;quot;the&amp;quot; .. root_suffix&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not lang then&lt;br /&gt;
		return &amp;quot;Terms derived from &amp;quot; .. root_suffix&lt;br /&gt;
	elseif source then&lt;br /&gt;
		return lang:getCanonicalName() .. &amp;quot; terms derived from &amp;quot; .. root_suffix&lt;br /&gt;
	else&lt;br /&gt;
		return lang:getCanonicalName() .. &amp;quot; terms belonging to &amp;quot; .. root_suffix&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function export.rootsee(frame)&lt;br /&gt;
	local params = {&lt;br /&gt;
		[1] = {template_default = &amp;quot;en&amp;quot;},&lt;br /&gt;
		[2] = {template_default = &amp;quot;ine&amp;quot;},&lt;br /&gt;
		[3] = {template_default = &amp;quot;gʷem&amp;quot;},&lt;br /&gt;
		[&amp;quot;id&amp;quot;] = {},&lt;br /&gt;
		[&amp;quot;mode&amp;quot;] = {}, -- one of &amp;quot;categories&amp;quot;, &amp;quot;pages&amp;quot;, &amp;quot;all&amp;quot; or &amp;quot;parents&amp;quot;; defaults to &amp;quot;all&amp;quot;; see [[mw:Extension:CategoryTree]].&lt;br /&gt;
		[&amp;quot;pagename&amp;quot;] = {}, -- for testing and documentation pages&lt;br /&gt;
		[&amp;quot;hyphen&amp;quot;] = {}, -- override the presence of a hyphen in Latin-script roots&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	local args = require(&amp;quot;Module:parameters&amp;quot;).process(frame:getParent().args, params)&lt;br /&gt;
	local title&lt;br /&gt;
&lt;br /&gt;
	if args.pagename then -- for testing, doc pages, etc.&lt;br /&gt;
		title = mw.title.new(args.pagename)&lt;br /&gt;
		if not title then&lt;br /&gt;
			error((&amp;quot;Bad value for pagename=: &amp;#039;%s&amp;#039;&amp;quot;):format(args.pagename))&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		title = mw.title.getCurrentTitle()&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local function convert_plus(val)&lt;br /&gt;
		if val == &amp;quot;+&amp;quot; then&lt;br /&gt;
			return nil&lt;br /&gt;
		else&lt;br /&gt;
			return val&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local lang = convert_plus(args[1])&lt;br /&gt;
	if lang then&lt;br /&gt;
		lang = m_languages.getByCode(lang, 1)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local source = convert_plus(args[2])&lt;br /&gt;
	local orig_source = source&lt;br /&gt;
	if source then&lt;br /&gt;
		source = m_languages.getByCode(source, 2, nil, &amp;quot;allow family&amp;quot;)&lt;br /&gt;
		if source:hasType(&amp;quot;family&amp;quot;) then&lt;br /&gt;
			source = source:getProtoLanguage()&lt;br /&gt;
			if not source then&lt;br /&gt;
				error((&amp;quot;Family &amp;#039;%s&amp;#039; has no proto-language&amp;quot;):format(args[2]))&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	elseif lang then&lt;br /&gt;
		source = lang&lt;br /&gt;
	elseif title:inNamespace(&amp;quot;Reconstruction&amp;quot;) or title:inNamespace(&amp;quot;Appendix&amp;quot;) then&lt;br /&gt;
		local langname = title.text:match(&amp;quot;^(.-)/&amp;quot;)&lt;br /&gt;
		if not langname then&lt;br /&gt;
			error((&amp;quot;Unable to infer source from pagename &amp;#039;%s&amp;#039; as it isn&amp;#039;t doesn&amp;#039;t have a current language in it (no slash)&amp;quot;)&lt;br /&gt;
				:format(title.fullText))&lt;br /&gt;
		end&lt;br /&gt;
		source = m_languages.getByCanonicalName(langname)&lt;br /&gt;
		if not source then&lt;br /&gt;
			error((&amp;quot;Unable to infer source from pagename &amp;#039;%s&amp;#039; as current language &amp;#039;%s&amp;#039; isn&amp;#039;t recognized as a language name&amp;quot;)&lt;br /&gt;
				:format(title.fullText, langname))&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		error((&amp;quot;Unable to infer source from pagename &amp;#039;%s&amp;#039; as it isn&amp;#039;t a Reconstruction or Appendix page&amp;quot;):format(&lt;br /&gt;
			title.fullText))&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local sourcecode = source:getCode()&lt;br /&gt;
&lt;br /&gt;
	local root = convert_plus(args[3])&lt;br /&gt;
	if not root then&lt;br /&gt;
		root = title.subpageText&lt;br /&gt;
		-- If none of dest lang, source lang and root were given, we&amp;#039;re being asked to display a category of the form&lt;br /&gt;
		-- [[:Category:Terms derived from the Source root *root-]] where `root` comes from the current page. If this&lt;br /&gt;
		-- page is a Reconstruction page, make the root reconstructed even if the source language isn&amp;#039;t&lt;br /&gt;
		-- reconstruction-only. This is definitely an edge case but is parallel to the derivsee() code in&lt;br /&gt;
		-- [[Module:affix/templates]].&lt;br /&gt;
		if not lang and not orig_source and title:inNamespace(&amp;quot;Reconstruction&amp;quot;) and not root:find(&amp;quot;^%*&amp;quot;) then&lt;br /&gt;
			root = &amp;quot;*&amp;quot; .. root&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local hyphpos = args.hyphen&lt;br /&gt;
	if hyphpos then&lt;br /&gt;
		if hyphpos ~= &amp;quot;before&amp;quot; and hyphpos ~= &amp;quot;after&amp;quot; and hyphpos ~= &amp;quot;both&amp;quot; and hyphpos ~= &amp;quot;none&amp;quot; and hyphpos ~= &amp;quot;no&amp;quot; then&lt;br /&gt;
			error((&amp;quot;|hyphen=%s should be &amp;#039;before&amp;#039;, &amp;#039;after&amp;#039;, &amp;#039;both&amp;#039;, &amp;#039;none&amp;#039; or &amp;#039;no&amp;#039;&amp;quot;):format(hyphpos))&lt;br /&gt;
		end&lt;br /&gt;
		if hyphpos == &amp;quot;no&amp;quot; then&lt;br /&gt;
			hyphpos = &amp;quot;none&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if not hyphpos then&lt;br /&gt;
		if not root:find(&amp;quot; &amp;quot;) and not root:find(&amp;quot;%-&amp;quot;) then&lt;br /&gt;
			local is_latin = root:find(&amp;quot;^[ -~]$&amp;quot;)&lt;br /&gt;
			if not is_latin then&lt;br /&gt;
				local sc = require(scripts_module).findBestScriptWithoutLang(root)&lt;br /&gt;
				if sc and sc:getCode():find(&amp;quot;Lat&amp;quot;) then -- Latn, Latf, Latg, pjt-Latn&lt;br /&gt;
					is_latin = true&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			if is_latin then&lt;br /&gt;
				if sourcecode == &amp;quot;nv&amp;quot; then -- Navajo&lt;br /&gt;
					hyphpos = &amp;quot;before&amp;quot;&lt;br /&gt;
				elseif sourcecode == &amp;quot;pi&amp;quot; then -- Pali&lt;br /&gt;
					hyphpos = &amp;quot;none&amp;quot;&lt;br /&gt;
				else&lt;br /&gt;
					hyphpos = &amp;quot;after&amp;quot;&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local root_asterisk = not not root:find(&amp;quot;^%*&amp;quot;)&lt;br /&gt;
	if hyphpos == &amp;quot;before&amp;quot; then&lt;br /&gt;
		root = &amp;quot;-&amp;quot; .. root&lt;br /&gt;
	elseif hyphpos == &amp;quot;after&amp;quot; then&lt;br /&gt;
		root = root .. &amp;quot;-&amp;quot;&lt;br /&gt;
	elseif hyphpos == &amp;quot;both&amp;quot; then&lt;br /&gt;
		root = &amp;quot;-&amp;quot; .. root .. &amp;quot;-&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	if source:hasType(&amp;quot;reconstructed&amp;quot;) and not root_asterisk then&lt;br /&gt;
		root = &amp;quot;*&amp;quot; .. root&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if lang and sourcecode == lang:getCode() then&lt;br /&gt;
		source = nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return frame:callParserFunction{&lt;br /&gt;
		name = &amp;quot;#categorytree&amp;quot;,&lt;br /&gt;
		args = {&lt;br /&gt;
			categorize(lang, source, root, args.id),&lt;br /&gt;
			depth = 0,&lt;br /&gt;
			class = &amp;#039;&amp;quot;columns-bg&amp;quot;&amp;#039;,&lt;br /&gt;
			mode = args.mode or &amp;quot;all&amp;quot;,&lt;br /&gt;
			hideprefix = &amp;quot;always&amp;quot;,&lt;br /&gt;
			showcount = &amp;quot;on&amp;quot;,&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return export&lt;/div&gt;</summary>
		<author><name>Sware</name></author>
	</entry>
</feed>