Modulo:BeginEndPage: differenze tra le versioni
Vai alla navigazione
Vai alla ricerca
mNessun oggetto della modifica |
mNessun oggetto della modifica |
||
Riga 66: | Riga 66: | ||
FinalString = PropertiesOnTree(PropertyNumber, 3, false, false, true)[1] | FinalString = PropertiesOnTree(PropertyNumber, 3, false, false, true)[1] | ||
else | else | ||
FinalString = frame:expandTemplate{title = string.sub(TemplateName, string.len(NSPrefix) + 1)} | --FinalString = frame:expandTemplate{title = string.sub(TemplateName, string.len(NSPrefix) + 1)} | ||
FinalString = PropertiesOnTree(PropertyNumber, 3, false, false, true)[1] | |||
end | end | ||
Versione delle 17:08, 10 dic 2023
-- <nowiki>
--------------------------------------------------------------------------------
-- This module handles incipit and epilogue of pages.
-- Comments are compatible with LDoc https://github.com/lunarmodules/ldoc
--
-- @module p
-- @author Luca Mauri [[Utente:Lucamauri]]
-- @keyword: wikitrek
-- Keyword: wikitrek
--------------------------------------------------------------------------------
local PropertiesOnTree = require('Modulo:DTFunzioniComuni').PropertiesOnTree
local p = {}
--------------------------------------------------------------------------------
-- Take parameters out of the frame and pass them to p._buildUniversalIncipit().
-- Return the result.
--
-- @param {Frame} Info from MW session
-- @return {string} The full incipit wikitext
--------------------------------------------------------------------------------
function p.buildUniversalIncipit(frame)
local args = frame:getParent().args
return p._main(args)
end
--------------------------------------------------------------------------------
-- Build and return the page incipit wikitext.
--
-- @param {Frame} Info from MW session
-- @return {string} The full incipit wikitext
--------------------------------------------------------------------------------
function p._buildUniversalIncipit(args)
local ret = {}
local fullUrl = mw.uri.fullUrl
local format = string.format
for i, username in ipairs(args) do
local url = fullUrl(mw.site.namespaces.User.name .. ':' .. username)
url = tostring(url)
local label = args['label' .. tostring(i)]
url = format('[%s %s]', url, label or username)
ret[#ret + 1] = url
end
ret = mw.text.listToText(ret)
ret = '<span class="plainlinks">' .. ret .. '</span>'
return ret
end
--------------------------------------------------------------------------------
-- Function to launch template for DataBoxes
-- Specific for Template:IncipitUniversale
--
-- @param frame Data from MW session
-- @return String with expanded templates
--------------------------------------------------------------------------------
function p.SecondaryBox(frame)
local FinalString
local NSPrefix = "Template:"
local PropertyNumber = "P177"
local TemplateName
--FinalString = PropertiesOnTree("P177", 3, false, false, true)[1]
--FinalString = string.sub(PropertiesOnTree("P177", 3, false, false, true), string.len(NSPrefix))
TemplateName = PropertiesOnTree(PropertyNumber, 3, false, false, true)
if PropertiesOnTree(PropertyNumber, 3, false, false, true) == nil or PropertiesOnTree(PropertyNumber, 3, false, false, true) == "" then
FinalString = PropertiesOnTree(PropertyNumber, 3, false, false, true)[1]
else
--FinalString = frame:expandTemplate{title = string.sub(TemplateName, string.len(NSPrefix) + 1)}
FinalString = PropertiesOnTree(PropertyNumber, 3, false, false, true)[1]
end
return FinalString
end
return p