Module:topos/functions: Διαφορά μεταξύ των αναθεωρήσεων

Περιεχόμενο που διαγράφηκε Περιεχόμενο που προστέθηκε
no, It still works for ALL categories
Ετικέτα: Χειροκίνητη αναστροφή
p.catword_to_firstkeyword(word_cat)
Γραμμή 39:
return table.concat(ret)
end
 
 
--- ========== write word_cat - get the first keyword (kind) ============= -- they always exist
-- i need three keywords, the third keyword i choose is: word
function p.catword_to_firstkeyword(word_cat) -- word_cat is the name of the Category.
local ret = {}
local i = 1
local word_to_char = {}
for _, v in pairs(require("Module:topos/kind")) do
local word_cat, word, kind = v.word_cat, v.word, v.kind
word_to_char[word] = kind
if word_cat then
word_to_char[word_cat:gsub("[%*%?]", "")] = kind
end
end
for c in mw.text.gsplit(word_cat, "%.") do
ret[i] = word_to_char[c] or c
i = i + 1
end
return table.concat(ret)
end
 
 
--- ========== write word_cat - get the sorting key ============= -- key ALWAYS EXISTS
-- i need three keywordsskeywords, the third keyword i choose is: word
function p.catword_to_catkey(word_cat) -- word_cat is the name of the Category.
local ret = {}