« Module:CleTri » : différence entre les versions
De MedFilm PPRD
Page créée avec « local p = {} local dict = {"le","la","les","l","die","the"} function p.translate(pn) if dict[pn] then return dict[pn] end return pn end function p.fw(frame) local first_word = mw.text.split(frame.args[1], "[_ ']") return first_word -- 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*... » |
Aucun résumé des modifications |
||
| Ligne 5 : | Ligne 5 : | ||
function p.translate(pn) | function p.translate(pn) | ||
if dict[pn] then | if dict[pn] then | ||
return | return("Oui") | ||
end | end | ||
return pn | return pn | ||
Version du 25 mars 2025 à 13:02
La documentation pour ce module peut être créée à Module:CleTri/doc
local p = {}
local dict = {"le","la","les","l","die","the"}
function p.translate(pn)
if dict[pn] then
return("Oui")
end
return pn
end
function p.fw(frame)
local first_word = mw.text.split(frame.args[1], "[_ ']")
return first_word
-- 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

