« Module:Episode » : différence entre les versions
Apparence
Contenu supprimé Contenu ajouté
Page créée avec « local data = require("Module:Episode/data") local p = {} -- Function 1: Get full episode link from key function p.getEpisode(frame) local key = string.lower(frame.args[1] or "") local entry = data[key] if not entry then return "Episode not found" end local ns, link, title = unpack(entry) -- If namespace is empty or nil, omit it if ns == "" or ns == nil then return string.format("%s", link, title) else... » |
Aucun résumé des modifications |
||
| Ligne 8 : | Ligne 8 : | ||
if not entry then |
if not entry then |
||
return " |
return "Épisode non trouvé" |
||
end |
end |
||
| Ligne 27 : | Ligne 27 : | ||
if not entry then |
if not entry then |
||
return " |
return "Épisode non trouvé" |
||
end |
end |
||
local _, link, title = unpack(entry) -- We ignore original namespace |
local _, link, title = unpack(entry) -- We ignore original namespace |
||
return string.format("[[ |
return string.format("[[Crédits:%s|%s]]", link, title) |
||
end |
end |
||
| Ligne 40 : | Ligne 40 : | ||
if not entry then |
if not entry then |
||
return " |
return "Épisode non trouvé" |
||
end |
end |
||
local _, link, title = unpack(entry) -- We ignore original namespace |
local _, link, title = unpack(entry) -- We ignore original namespace |
||
return string.format("[[ |
return string.format("[[Retranscription:%s|%s]]", link, title) |
||
end |
end |
||
-- Function 4: Force namespace to "Quotes:" |
-- Function 4: Force namespace to "Quotes:" |
||
| Ligne 52 : | Ligne 52 : | ||
if not entry then |
if not entry then |
||
return " |
return "Épisode non trouvé" |
||
end |
end |
||
local _, link, title = unpack(entry) -- We ignore original namespace |
local _, link, title = unpack(entry) -- We ignore original namespace |
||
return string.format("[[ |
return string.format("[[Citations:%s|%s]]", link, title) |
||
end |
end |
||
| Ligne 65 : | Ligne 65 : | ||
if not entry then |
if not entry then |
||
return " |
return "Épisode non trouvé" |
||
end |
end |
||
local _, link, title = unpack(entry) -- We ignore original namespace |
local _, link, title = unpack(entry) -- We ignore original namespace |
||
return string.format("[[: |
return string.format("[[:Catégorie:Images de %s|%s]]", link, title) |
||
end |
end |
||
| Ligne 78 : | Ligne 78 : | ||
if not entry then |
if not entry then |
||
return " |
return "Épisode non trouvé" |
||
end |
end |
||
| Ligne 91 : | Ligne 91 : | ||
if not entry then |
if not entry then |
||
return " |
return "Épisode non trouvé" |
||
end |
end |
||
Version du 22 octobre 2025 à 21:21
local data = require("Module:Episode/data")
local p = {}
-- Function 1: Get full episode link from key
function p.getEpisode(frame)
local key = string.lower(frame.args[1] or "")
local entry = data[key]
if not entry then
return "Épisode non trouvé"
end
local ns, link, title = unpack(entry)
-- If namespace is empty or nil, omit it
if ns == "" or ns == nil then
return string.format("[[%s|%s]]", link, title)
else
return string.format("[[%s:%s|%s]]", ns, link, title)
end
end
-- Function 2: Force namespace to "Credits:"
function p.getCreditsLink(frame)
local key = string.lower(frame.args[1] or "")
local entry = data[key]
if not entry then
return "Épisode non trouvé"
end
local _, link, title = unpack(entry) -- We ignore original namespace
return string.format("[[Crédits:%s|%s]]", link, title)
end
-- Function 3: Force namespace to "Transcript:"
function p.getTranscriptLink(frame)
local key = string.lower(frame.args[1] or "")
local entry = data[key]
if not entry then
return "Épisode non trouvé"
end
local _, link, title = unpack(entry) -- We ignore original namespace
return string.format("[[Retranscription:%s|%s]]", link, title)
end
-- Function 4: Force namespace to "Quotes:"
function p.getQuotesLink(frame)
local key = string.lower(frame.args[1] or "")
local entry = data[key]
if not entry then
return "Épisode non trouvé"
end
local _, link, title = unpack(entry) -- We ignore original namespace
return string.format("[[Citations:%s|%s]]", link, title)
end
-- Function 5: Force namespace to "Category:Images from"
function p.getImagesLink(frame)
local key = string.lower(frame.args[1] or "")
local entry = data[key]
if not entry then
return "Épisode non trouvé"
end
local _, link, title = unpack(entry) -- We ignore original namespace
return string.format("[[:Catégorie:Images de %s|%s]]", link, title)
end
-- Function 6: Retrieve from link
function p.getEpisodeLink(frame)
local key = string.lower(frame.args[1] or "")
local entry = data[key]
if not entry then
return "Épisode non trouvé"
end
local _, link, _ = unpack(entry) -- We ignore original namespace
return string.format("%s", link)
end
-- Function 7: Get full episode link only from key
function p.getEpisodeFullLink(frame)
local key = string.lower(frame.args[1] or "")
local entry = data[key]
if not entry then
return "Épisode non trouvé"
end
local ns, link, _ = unpack(entry)
-- If namespace is empty or nil, omit it
if ns == "" or ns == nil then
return string.format("%s", link)
else
return string.format("%s:%s", ns, link)
end
end
return p