<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2FJohnuniq%2FWiktionary</id>
	<title>Module:Sandbox/Johnuniq/Wiktionary - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2FJohnuniq%2FWiktionary"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Johnuniq/Wiktionary&amp;action=history"/>
	<updated>2026-04-21T02:08:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Sandbox/Johnuniq/Wiktionary&amp;diff=145626&amp;oldid=prev</id>
		<title>imported&gt;Johnuniq: Johnuniq moved page Module:Wiktionary to Module:Sandbox/Johnuniq/Wiktionary without leaving a redirect: per request at User talk:Johnuniq#Module:Wiktionary</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Johnuniq/Wiktionary&amp;diff=145626&amp;oldid=prev"/>
		<updated>2020-08-30T09:24:59Z</updated>

		<summary type="html">&lt;p&gt;Johnuniq moved page &lt;a href=&quot;/index.php?title=Module:Wiktionary&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Module:Wiktionary (page does not exist)&quot;&gt;Module:Wiktionary&lt;/a&gt; to &lt;a href=&quot;/research/Module:Sandbox/Johnuniq/Wiktionary&quot; title=&quot;Module:Sandbox/Johnuniq/Wiktionary&quot;&gt;Module:Sandbox/Johnuniq/Wiktionary&lt;/a&gt; without leaving a redirect: per request at &lt;a href=&quot;/index.php?title=User_talk:Johnuniq&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User talk:Johnuniq (page does not exist)&quot;&gt;User talk:Johnuniq#Module:Wiktionary&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Implement Template:Wiktionary.&lt;br /&gt;
&lt;br /&gt;
local function sideBox(args, items)&lt;br /&gt;
	-- Return simulated {{side box}} with parameters for {{wiktionary}}.&lt;br /&gt;
	local links = {}&lt;br /&gt;
	for i, item in ipairs(items) do&lt;br /&gt;
		local title = item.text&lt;br /&gt;
		if item.anchor then&lt;br /&gt;
			title = title .. &amp;#039;#&amp;#039; .. item.anchor&lt;br /&gt;
		end&lt;br /&gt;
		links[i] =&lt;br /&gt;
--			&amp;quot;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;[[wiktionary:&amp;quot; ..&lt;br /&gt;
			&amp;quot;&amp;#039;&amp;#039;&amp;#039;[[wiktionary:&amp;quot; ..												-- let {{lang}} control italics&lt;br /&gt;
			(item.isSearch and &amp;quot;Special:Search/&amp;quot; or &amp;quot;&amp;quot;) ..&lt;br /&gt;
			title ..&lt;br /&gt;
			&amp;quot;|&amp;quot; ..&lt;br /&gt;
			item.langText ..&lt;br /&gt;
--			&amp;quot;]]&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;quot;&lt;br /&gt;
			&amp;quot;]]&amp;#039;&amp;#039;&amp;#039;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	local join1 = &amp;#039;, &amp;#039;&lt;br /&gt;
	local join2 = #items &amp;gt; 2 and &amp;#039;,&amp;amp;nbsp;or &amp;#039; or &amp;#039;&amp;amp;nbsp;or &amp;#039;&lt;br /&gt;
	local box = require(&amp;#039;Module:Side box&amp;#039;)._main&lt;br /&gt;
	return box({&lt;br /&gt;
		metadata = &amp;#039;no&amp;#039;,&lt;br /&gt;
		position = args.position,&lt;br /&gt;
		image = (args.image or &amp;#039;&amp;#039;) ~= &amp;#039;none&amp;#039; and&lt;br /&gt;
			&amp;#039;[[File:Wiktionary-logo-en-v2.svg|40x40px|class=noviewer|alt=|link=]]&amp;#039; or&lt;br /&gt;
			nil,&lt;br /&gt;
		text =&lt;br /&gt;
			&amp;#039;Look up &amp;#039; ..&lt;br /&gt;
			mw.text.listToText(links, join1, join2) ..&lt;br /&gt;
			&amp;#039; in Wiktionary, the free dictionary.&amp;#039;,&lt;br /&gt;
		below = args.below,&lt;br /&gt;
		imageright = args.imageright,&lt;br /&gt;
		class = &amp;#039;plainlinks sistersitebox&amp;#039;,&lt;br /&gt;
	})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local languageData&lt;br /&gt;
local function setAnchor(item)&lt;br /&gt;
	if not item.anchor then&lt;br /&gt;
		languageData = languageData or require(&amp;#039;Module:Language/data&amp;#039;).languages&lt;br /&gt;
		local data = languageData[item.lang]&lt;br /&gt;
		if data then&lt;br /&gt;
			if data.name then&lt;br /&gt;
				item.anchor = data.name&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if item.anchor then&lt;br /&gt;
		if item.anchor == &amp;#039;&amp;#039; then&lt;br /&gt;
			item.anchor = nil&lt;br /&gt;
		else&lt;br /&gt;
			item.anchor = item.anchor:gsub(&amp;#039; &amp;#039;, &amp;#039;_&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function _main(args, frame)&lt;br /&gt;
	-- Process given args; can be called from another module.&lt;br /&gt;
	frame = frame or mw.getCurrentFrame()&lt;br /&gt;
--	local langDefault = mw.language.getContentLanguage().code  -- &amp;quot;en&amp;quot; at enwiki&lt;br /&gt;
	local langLocalWiki = mw.language.getContentLanguage().code  -- &amp;quot;en&amp;quot; at enwiki&lt;br /&gt;
--	local langCurrent = langDefault&lt;br /&gt;
	local langCurrent = &amp;#039;und&amp;#039;													-- until specified, we don&amp;#039;t know the language&lt;br /&gt;
	local lastWasSpecial, nextAnchor&lt;br /&gt;
	local items = {}&lt;br /&gt;
	local lang_mod = require (&amp;#039;Module:lang&amp;#039;)									-- for direct access to the functions in Module:Lang&lt;br /&gt;
	local langText																-- text and markup returned from Module:Lang.lang&lt;br /&gt;
	&lt;br /&gt;
	for _, arg in ipairs(args) do&lt;br /&gt;
		arg = mw.text.trim(arg)&lt;br /&gt;
		if arg ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			if arg:sub(1, 1) == &amp;#039;_&amp;#039; then&lt;br /&gt;
				local special = mw.text.trim(arg:sub(2))&lt;br /&gt;
				if lastWasSpecial then&lt;br /&gt;
					nextAnchor = special&lt;br /&gt;
				else&lt;br /&gt;
					if special == &amp;#039;&amp;#039; then&lt;br /&gt;
--						langCurrent = langDefault&lt;br /&gt;
						langCurrent = langLocalWiki								-- local wiki language only when specified; in effect until changed to another language or reset (how to reset?)&lt;br /&gt;
					else&lt;br /&gt;
						langCurrent = special&lt;br /&gt;
					end&lt;br /&gt;
					lastWasSpecial = true&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				table.insert(items, { lang = langCurrent, text = arg, anchor = nextAnchor })&lt;br /&gt;
				lastWasSpecial = nil&lt;br /&gt;
				nextAnchor = nil&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if items[1] then&lt;br /&gt;
		for _, item in ipairs(items) do&lt;br /&gt;
--			local langText = frame:expandTemplate({title = &amp;#039;lang&amp;#039;, args = {item.lang, item.text, nocat = &amp;#039;yes&amp;#039;, italic = item.lang == &amp;#039;en&amp;#039; and &amp;#039;yes&amp;#039; or nil}})&lt;br /&gt;
			langText = lang_mod._lang ({item.lang, item.text, cat = &amp;#039;no&amp;#039;, italic = item.lang == &amp;#039;en&amp;#039; and &amp;#039;yes&amp;#039; or nil })	-- let {{lang}} control italics&lt;br /&gt;
			if langText:match(&amp;#039;class=&amp;quot;error&amp;quot;&amp;#039;) then&lt;br /&gt;
				error(&amp;#039;Wiktionary error: language code &amp;quot;&amp;#039; .. item.lang .. &amp;#039;&amp;quot; is unknown&amp;#039; , 0)&lt;br /&gt;
			end&lt;br /&gt;
			item.langText = langText&lt;br /&gt;
			setAnchor(item)&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		local title = mw.ustring.lower(mw.title.getCurrentTitle().subpageText)&lt;br /&gt;
		langText = lang_mod._lang ({langLocalWiki, title, cat = &amp;#039;no&amp;#039;})			-- for consistency use {{lang}} for article title&lt;br /&gt;
--		items[1] = { text = title, langText = title, isSearch = true }&lt;br /&gt;
		items[1] = { text = title, langText = langText, isSearch = true }		-- don&amp;#039;t break side box&lt;br /&gt;
	end&lt;br /&gt;
	return sideBox(args, items)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function main(frame)&lt;br /&gt;
	-- Return wikitext to display {{wiktionary}} box.&lt;br /&gt;
	return _main(frame:getParent().args, frame)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	main = main,&lt;br /&gt;
	_main = _main,&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>imported&gt;Johnuniq</name></author>
	</entry>
</feed>