« Module:CleTri » : différence entre les versions
De MedFilm PPRD
Aucun résumé des modifications |
Aucun résumé des modifications |
||
| Ligne 10 : | Ligne 10 : | ||
local words = mw.text.split(frame.args[1], "[_ ']") | local words = mw.text.split(frame.args[1], "[_ ']") | ||
if l_articles[words[1]] then | if l_articles[words[1]] then | ||
return string.sub(frame.args[1],#words[1],-1) | return string.sub(frame.args[1],#words[1]+2,-1) | ||
else return frame.args[1] | else return frame.args[1] | ||
end | end | ||
Version du 25 mars 2025 à 16:04
La documentation pour ce module peut être créée à Module:CleTri/doc
local p = {}
local articles = {"La","Le","Les","L","Die","the","Lo"}
local l_articles ={}
for _,w in ipairs(articles) do
l_articles[w] = true
end
function p.fw(frame)
local words = mw.text.split(frame.args[1], "[_ ']")
if l_articles[words[1]] then
return string.sub(frame.args[1],#words[1]+2,-1)
else return frame.args[1]
end
-- return mw.text.split(frame.args[1], '[_ ]')[1]
end
function p.nom(frame)
local tpn = mw.text.split(frame.args[1], '[_ ]')
return(tpn[#tpn])
end
function p.transl(frame)
-- pn = string.gsub(frame.args[1], '^%s*(.-)%s*$', '%1')
pn = frame.args[1]
if dict[pn] then
return '[[' .. pn .. '|' .. dict[pn] .. ']]'
end
return '[[' .. pn .. ']]'
end
function p.translNoLink(frame)
-- pn = string.gsub(frame.args[1], '^%s*(.-)%s*$', '%1')
pn = frame.args[1]
if dict[pn] then
return dict[pn]
end
return pn
end
return p

