<?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%3Aanchors</id>
	<title>Module:anchors - 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%3Aanchors"/>
	<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:anchors&amp;action=history"/>
	<updated>2026-04-06T04:57:51Z</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:anchors&amp;diff=491420&amp;oldid=prev</id>
		<title>Sware: Created page with &quot;local export = {}  local string_utilities_module = &quot;Module:string utilities&quot;  local anchor_encode = mw.uri.anchorEncode local concat = table.concat local insert = table.insert local language_anchor -- Defined below.  local function decode_entities(...) 	decode_entities = require(string_utilities_module).decode_entities 	return decode_entities(...) end  local function encode_entities(...) 	encode_entities = require(string_utilities_module).encode_entities 	return encode_e...&quot;</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:anchors&amp;diff=491420&amp;oldid=prev"/>
		<updated>2026-03-24T23:43:03Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local export = {}  local string_utilities_module = &amp;quot;Module:string utilities&amp;quot;  local anchor_encode = mw.uri.anchorEncode local concat = table.concat local insert = table.insert local language_anchor -- Defined below.  local function decode_entities(...) 	decode_entities = require(string_utilities_module).decode_entities 	return decode_entities(...) end  local function encode_entities(...) 	encode_entities = require(string_utilities_module).encode_entities 	return encode_e...&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 string_utilities_module = &amp;quot;Module:string utilities&amp;quot;&lt;br /&gt;
&lt;br /&gt;
local anchor_encode = mw.uri.anchorEncode&lt;br /&gt;
local concat = table.concat&lt;br /&gt;
local insert = table.insert&lt;br /&gt;
local language_anchor -- Defined below.&lt;br /&gt;
&lt;br /&gt;
local function decode_entities(...)&lt;br /&gt;
	decode_entities = require(string_utilities_module).decode_entities&lt;br /&gt;
	return decode_entities(...)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function encode_entities(...)&lt;br /&gt;
	encode_entities = require(string_utilities_module).encode_entities&lt;br /&gt;
	return encode_entities(...)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Returns the anchor text to be used as the fragment of a link to a language section.&lt;br /&gt;
function export.language_anchor(lang, id)&lt;br /&gt;
	return anchor_encode(lang:getFullName() .. &amp;quot;: &amp;quot; .. id)&lt;br /&gt;
end&lt;br /&gt;
language_anchor = export.language_anchor&lt;br /&gt;
&lt;br /&gt;
-- Normalizes input text (removes formatting etc.), which can then be used as an anchor in an `id=` field.&lt;br /&gt;
function export.normalize_anchor(str)&lt;br /&gt;
	return decode_entities(anchor_encode(str))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.make_anchors(ids)&lt;br /&gt;
	local anchors = {}&lt;br /&gt;
	for i = 1, #ids do&lt;br /&gt;
		local id = ids[i]&lt;br /&gt;
		local el = mw.html.create(&amp;quot;span&amp;quot;)&lt;br /&gt;
			:addClass(&amp;quot;template-anchor&amp;quot;)&lt;br /&gt;
			:attr(&amp;quot;id&amp;quot;, anchor_encode(id))&lt;br /&gt;
			:attr(&amp;quot;data-id&amp;quot;, id)&lt;br /&gt;
		insert(anchors, tostring(el))&lt;br /&gt;
	end&lt;br /&gt;
	return concat(anchors)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.senseid(lang, id, tag_name)&lt;br /&gt;
	-- The following tag is opened but never closed, where is it supposed to be closed?&lt;br /&gt;
	--         with &amp;lt;li&amp;gt; it doesn&amp;#039;t matter, as it is closed automatically.&lt;br /&gt;
	--         with &amp;lt;p&amp;gt; it is a problem&lt;br /&gt;
	-- Cannot use mw.html here as it always closes tags&lt;br /&gt;
	return &amp;quot;&amp;lt;&amp;quot; .. tag_name .. &amp;quot; class=\&amp;quot;senseid\&amp;quot; id=\&amp;quot;&amp;quot; .. language_anchor(lang, id) .. &amp;quot;\&amp;quot; data-lang=\&amp;quot;&amp;quot; .. lang:getCode() .. &amp;quot;\&amp;quot; data-id=\&amp;quot;&amp;quot; .. encode_entities(id) .. &amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.etymid(lang, id)&lt;br /&gt;
	-- Use a &amp;lt;ul&amp;gt; tag to ensure spacing doesn&amp;#039;t get messed up.&lt;br /&gt;
	local el = mw.html.create(&amp;quot;ul&amp;quot;)&lt;br /&gt;
		:addClass(&amp;quot;etymid&amp;quot;)&lt;br /&gt;
		:attr(&amp;quot;id&amp;quot;, language_anchor(lang, id))&lt;br /&gt;
		:attr(&amp;quot;data-lang&amp;quot;, lang:getCode())&lt;br /&gt;
		:attr(&amp;quot;data-id&amp;quot;, id)&lt;br /&gt;
	return tostring(el)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.etymonid(lang, id, opts)&lt;br /&gt;
	opts = opts or {}&lt;br /&gt;
	-- Use a &amp;lt;ul&amp;gt; tag to ensure spacing doesn&amp;#039;t get messed up.&lt;br /&gt;
	local el = mw.html.create(&amp;quot;ul&amp;quot;)&lt;br /&gt;
		:addClass(&amp;quot;etymonid&amp;quot;)&lt;br /&gt;
		:attr(&amp;quot;data-lang&amp;quot;, lang:getCode())&lt;br /&gt;
	&lt;br /&gt;
	if id then&lt;br /&gt;
		el:attr(&amp;quot;id&amp;quot;, language_anchor(lang, id))&lt;br /&gt;
		el:attr(&amp;quot;data-id&amp;quot;, id)&lt;br /&gt;
	end&lt;br /&gt;
	if opts.no_tree then&lt;br /&gt;
		el:attr(&amp;quot;data-no-tree&amp;quot;, &amp;quot;1&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	if opts.title then&lt;br /&gt;
		el:attr(&amp;quot;data-title&amp;quot;, opts.title)&lt;br /&gt;
	end&lt;br /&gt;
	if opts.empty_tree then&lt;br /&gt;
		el:attr(&amp;quot;data-empty-tree&amp;quot;, &amp;quot;1&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return tostring(el)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return export&lt;/div&gt;</summary>
		<author><name>Sware</name></author>
	</entry>
</feed>