×
Create a new article
Write your page title here:
We currently have 69 articles on Super Shiritori Wiki. Type your article name above or click on one of the titles below and start writing!



Super Shiritori Wiki
Revision as of 01:40, 27 January 2026 by imported>BlankEntity (Created page with "local export = {} local string_utilities_module = "Module:string utilities" 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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Welcome to Super-Shiritori!

Please remember:

  • No vandalism – Do not add nonsense, false info, spam, or blank pages.
  • Respect others – Be polite and assume good faith.
  • Use reliable information – Make sure edits are accurate and IMPORTANT.
  • Stay constructive – Help us grow the wiki with content, especially with the Word compendium.

⚠️ Repeated vandalism or rule-breaking may result in warnings or blocks. If you see vandalism, please revert it and notify an admin.

Documentation for this module may be created at Module:Anchors/doc

local export = {}

local string_utilities_module = "Module:string utilities"

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_entities(...)
end

-- Returns the anchor text to be used as the fragment of a link to a language section.
function export.language_anchor(lang, id)
	return anchor_encode(lang:getFullName() .. ": " .. id)
end
language_anchor = export.language_anchor

-- Normalizes input text (removes formatting etc.), which can then be used as an anchor in an `id=` field.
function export.normalize_anchor(str)
	return decode_entities(anchor_encode(str))
end

function export.make_anchors(ids)
	local anchors = {}
	for i = 1, #ids do
		local id = ids[i]
		local el = mw.html.create("span")
			:addClass("template-anchor")
			:attr("id", anchor_encode(id))
			:attr("data-id", id)
		insert(anchors, tostring(el))
	end
	return concat(anchors)
end

function export.senseid(lang, id, tag_name)
	-- The following tag is opened but never closed, where is it supposed to be closed?
	--         with <li> it doesn't matter, as it is closed automatically.
	--         with <p> it is a problem
	-- Cannot use mw.html here as it always closes tags
	return "<" .. tag_name .. " class=\"senseid\" id=\"" .. language_anchor(lang, id) .. "\" data-lang=\"" .. lang:getCode() .. "\" data-id=\"" .. encode_entities(id) .. "\">"
end

function export.etymid(lang, id)
	-- Use a <ul> tag to ensure spacing doesn't get messed up.
	local el = mw.html.create("ul")
		:addClass("etymid")
		:attr("id", language_anchor(lang, id))
		:attr("data-lang", lang:getCode())
		:attr("data-id", id)
	return tostring(el)
end

function export.etymonid(lang, id, opts)
	opts = opts or {}
	-- Use a <ul> tag to ensure spacing doesn't get messed up.
	local el = mw.html.create("ul")
		:addClass("etymonid")
		:attr("data-lang", lang:getCode())
	
	if id then
		el:attr("id", language_anchor(lang, id))
		el:attr("data-id", id)
	end
	if opts.no_tree then
		el:attr("data-no-tree", "1")
	end
	if opts.title then
		el:attr("data-title", opts.title)
	end
	if opts.empty_tree then
		el:attr("data-empty-tree", "1")
	end
	
	return tostring(el)
end

return export