local export = {}
-- Extract a Wikidata id from a sense id
local function Wikidata_id(id)
return mw.ustring.match(id, "Q%d+")
end
function export.anchor(lang, id)
if not (type(id) == "string" or type(id) == "number") then
error("The second argument to senseid should be a string or a number.")
end
return lang:getCanonicalName() .. "-" .. mw.uri.encode(id, "WIKI")
end
function export.senseid(lang, id)
-- Track which entries use Wikidata ids
if Wikidata_id(id) then
--[=[
[[Special:WhatLinksHere/Template:Wt/sco/tracking/senseid/Wikidata]]
]=]
require("Module:debug").track("senseid/Wikidata")
end
return '<li class="senseid" id="' .. export.anchor(lang, id) .. '">'
end
return export