Module:Alteraedje
Apparence
La documentation pour ce module peut être créée à Module:Alteraedje/doc
local p = {}
local NS = mw.title.getCurrentTitle().namespace
local reasons = {
T = 'coridjaedje del tipografeye',
P = 'coridjaedje do pontiaedje',
R = 'radjoutaedje',
}
local dataPrefix = 'data-popuptextalt-'
function p.main(frame)
local args = frame.args
local text, repl, reason = ''
local class = 'cor'
if args.text ~= nil then text = args.text end
if args.repl ~= nil then repl = args.repl end
if args.class ~= nil then class = args.class end
if args.reason ~= nil then
if reasons[args.reason] ~=nil then
reason = reasons[args.reason]
else
reason = args.reason
end
end
local attrs = {
[dataPrefix..'txt'] = mw.uri.encode(text, 'PATH'), -- avou PATH po-z awè des %20
[dataPrefix..'alt'] = mw.uri.encode(repl , 'PATH'),
['class'] = class
}
local title = '[coridjaedje] « '..repl..' »'
if mw.text.trim(reason) ~= "" then
title = title .. ' ('..reason..')'
attrs[dataPrefix..'reason'] = reason
end
attrs['title'] = title
local html = mw.html.create()
span = mw.html.create( 'span' )
span:attr(attrs)
if class == 'cor' then
span:wikitext(repl)
else
span:wikitext(text)
end
html:node( span )
return html
end
return p