« Module:Version imprimable » : différence entre les versions
Contenu supprimé Contenu ajouté
MEP |
Aucun résumé des modifications |
||
Ligne 8 :
Ending1 = "GFDL"
Ending2 = ""
templateLeft = '<div style="float: left;">[[File:Go-previous-grey.svg|
templateRight = '<div style="float: right;">[[printf]] [[File:Go-next-grey.svg|
TOC = "Sommaire"
sep = "/"
Ligne 139 :
function p.displays_footer(frame)
if frame == nil then return
if frame.args == nil then return
if frame.args[1] == nil then return
local BookName = frame.args[1]
local currentPageName = frame.args[2]
if (BookName ~= nil and mw.text.trim(BookName) ~=
title = mw.title.new(BookName)
if mw.ustring.find(BookName, p._escapePattern(sep .. TOC)) ~= nil then BookName = mw.ustring.gsub(BookName, "^(.*)" .. sep .. TOC .. "$", "%1") end
Ligne 152 :
end
if
if (currentPageName ~= nil and mw.text.trim(currentPageName) ~= "") then
currentPageName = mw.text.trim(currentPageName)
else
Ligne 158 ⟶ 159 :
end
if (title == nil or title ==
text = title.getContent(title)
if (text == nil or text ==
-- Book subpages titles normalization to absolute names
local lines_ = mw.text.split(text, "\n")
local footer = {}
local previousChapter =
local found = false
local chapter
Ligne 178 ⟶ 179 :
if (ChapterTitle ~= nil and ChapterTitle.exists) then
PageName = mw.ustring.gsub(chapter, "[^"..sep.."]*"..sep.."*(.*)", "%1")
if (PageName ~= nil and PageName ~=
if found == true then
if debug then table.insert(footer, "<font color=red>Previous & next chapter insertion</font>\n") end
if previousChapter ==
theTemplateLeft, nb = mw.ustring.gsub(templateLeft, "printf", BookName ..
else
theTemplateLeft, nb = mw.ustring.gsub(templateLeft, "printf", BookName .. sep .. previousChapter ..
end
table.insert(footer, theTemplateLeft)
theTemplateRight, nb = mw.ustring.gsub(templateRight, "printf", BookName .. sep .. PageName ..
table.insert(footer, theTemplateRight)
break
Ligne 193 ⟶ 194 :
found = true
if debug then table.insert(footer, "<font color=red>Page</font> '" .. currentPageName .. "' found\n\n") end
elseif mw.text.trim(v) ~=
previousChapter = PageName
else
Ligne 207 ⟶ 208 :
if found == true and table.getn(footer) == 0 then
if debug then table.insert(footer, "<font color=red>No next chapter</font>\n") end
theTemplateLeft, nb = mw.ustring.gsub(templateLeft, "printf", BookName .. sep .. previousChapter ..
table.insert(footer, theTemplateLeft)
theTemplateRight, nb = mw.ustring.gsub(templateRight, "printf", BookName ..
table.insert(footer, theTemplateRight)
end
|