مۆدیوول:also/auto
ڕواڵەت
"بەڵگەدارکردنی ئەم مۆدیوولە دەکرێ لە مۆدیوول:also/auto/docدا دروست بکرێ"
local p = {}
local PAGENAME = mw.title.getCurrentTitle().text
local m_unicode = require("Module:Unicode data")
local m_data = require("Module:also/processed data") -- this contains only existing pages
function get_hashkey(word)
buffer = mw.ustring.toNFKD(mw.ustring.lower(word))
for k, v in pairs(m_data.customkeys) do
buffer = mw.ustring.gsub(buffer, k, v)
end
hashkey = {}
for cp in mw.ustring.gcodepoint(buffer) do
table.insert(hashkey, is_valid(cp) and mw.ustring.char(cp) or "")
end
return table.concat(hashkey)
end
function is_valid(cp)
category = m_unicode.lookup_category(cp)
return (category:match("^[LN].$") or category == "Mc") -- can't rely on built-in %w class
end
function p.main(frame)
local hashkey = get_hashkey(PAGENAME)
local data = m_data.lookups[hashkey] or {}
for i, v in ipairs(frame:getParent().args) do -- if it has manual params
table.insert(data, v)
end
local new_frame = frame:newChild{title = frame:getTitle(), args = data}
function new_frame:getParent()
return self
end
return require('Module:also').main(new_frame)
end
return p