Modulo:Versione stampabile: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Correggo la visualizzazione delle note
Translations on Commons
Riga 1:
debug = false
-- Search and display the book pages from the TOC page, in order to create a printable version.
 
-- Locally translated parameters
Error = "Errore: Indice non valido"
Beginning1 = ""
Beginning2 = ""
Break = ""
Ending1 = ""
Ending2 = ""
templateLeft = '<div style="float: left;">[[File:Go-previous-grey.svg|40px|link=]] [[printf]]</div>'
templateRight = '<div style="float: right;">[[printf]] [[File:Go-next-grey.svg|40px|link=]]</div>'
TOC = "TOC"
sep = "/"
OnlySubpages = true
local p = {}
debug = false
 
Error = require('Module:TNT').format('I18n/Module:Printable version', 'error_invalid_toc')
 
Beginning1 = require('Module:TNT').format('I18n/Module:Printable version', 'header_notice')
local p = {}
Beginning2 = require('Module:TNT').format('I18n/Module:Printable version', 'header_cover')
Break = require('Module:TNT').format('I18n/Module:Printable version', 'page_break')
Ending1 = require('Module:TNT').format('I18n/Module:Printable version', 'footer_license')
Ending2 = require('Module:TNT').format('I18n/Module:Printable version', 'footer2')
templateLeft = require('Module:TNT').format('I18n/Module:Printable version', 'template_left')
templateRight = require('Module:TNT').format('I18n/Module:Printable version', 'template_right')
TOC = require('Module:TNT').format('I18n/Module:Printable version', 'TOC')
sep = require('Module:TNT').format('I18n/Module:Printable version', 'subpage_separator')
 
 
Line 75 ⟶ 71:
if Ending2 ~= "" then Templates2 = Templates2 .. frame:expandTemplate{title = Ending2} .. '\n' end
 
return Templates1 .. table.concat(PrintVersion, "\r\n") .. frame:callParserFunction( '#tag', 'references' ) .. Templates2
end
 
Line 187 ⟶ 183:
text = title.getContent(title)
if (text == nil or text == "") then return Error end
 
if frame.args[3] ~= nil and frame.args[3] ~= '' then
if frame.args[3] == 'programming' then
if debug then table.insert(footer, theTemplateLeft" skin=programming\n\n") end
templateLeft = '{| style="width:100%; border:solid 1px #71c837; background:#c6e9af; color:#2d5016;" class="noprint"\n| style="text-align:left; width:33%; font-size:90%;" |[[Image:Navigation_Left_Arrow.svg|18px|link=printf|alt=]] [[printf]]\n'
templateRight = '| style="text-align:center; width:34%;" | [['..mw.title.getCurrentTitle().rootText..']]<br><b>'..mw.title.getCurrentTitle().subpageText..'</b>\n| style="text-align:right; width:33%; font-size:90%;" | [[printf]] [[Image:Navigation_Right_Arrow.svg|18px|link=printf|alt=]]\n|}'
end
end
 
-- Book subpages titles normalization to absolute names
Line 193 ⟶ 197:
local found = false
local fullPageName
local homepage = false
local subpageName
local rawFullPageName
 
if (currentPageName == BookName) then
if debug then table.insert(footer, " homepage\n") end
homepage = true
end
 
for i, v in ipairs(lines_) do
Line 218 ⟶ 228:
if debug then table.insert(footer, " cut subpage: " .. subpageName .. "\n") end
if (subpageName ~= nil and subpageName ~= "") then
if found == true or homepage == true then
if debug then table.insert(footer, "<font color=red>Previous & next chapter insertion</font>\n") end
 
if previousChapter == "" then
if theTemplateLeft, nbhomepage == mw.ustring.gsub(templateLeft, "printf", BookName .. "|" ..false TOC)then
else if previousChapter == "" then
theTemplateLeft, nb = mw.ustring.gsub(templateLeft, "printf", BookName .. sep .. previousChapter .. "|" .. previousChapterTOC)
if previousChapter == "" thenelse
theTemplateLeft, nb = mw.ustring.gsub(templateLeft, "printf", BookName .. sep .. previousChapter .. "|" .. previousChapter)
end
table.insert(footer, theTemplateLeft)
end
 
table.insert(footer, theTemplateLeft)
theTemplateRight, nb = mw.ustring.gsub(templateRight, "printf", BookName .. sep .. subpageName .. "|" .. subpageName)
table.insert(footer, theTemplateRight)