Modulo:DTBase: differenze tra le versioni

Vai alla navigazione Vai alla ricerca
m
nessun oggetto della modifica
(Link constructor fixed in case of "Category" link)
mNessun oggetto della modifica
(9 versioni intermedie di uno stesso utente non sono mostrate)
Riga 287: Riga 287:
local WTLink
local WTLink
if (not AddSemantic) and SMWProperty and (SMWProperty ~= "") then
if AddSemantic and SMWProperty and (SMWProperty ~= "") then
AddSemantic = true
AddSemantic = true
else
else
Riga 309: Riga 309:
if not mw.wikibase.getSitelink(QItem) then
if not mw.wikibase.getSitelink(QItem) then
--if mw.wikibase.getSitelink(QItem) == nil or (not mw.wikibase.getSitelink(QItem)) then
--if mw.wikibase.getSitelink(QItem) == nil or (not mw.wikibase.getSitelink(QItem)) then
return Label
--return Label
--https://wikitrek.org/wiki/Speciale:AboutTopic/Q64
return "[[Special:AboutTopic/" .. QItem .. "|" .. Label .. "]]"
else
else
WTLink = Item.sitelinks['wikitrek'].title
WTLink = Item.sitelinks['wikitrek'].title
Riga 316: Riga 319:
Label = WTLink
Label = WTLink
end
end
if string.find(WTLink, "Categoria:", 1, true) ~= nil then
if string.find(WTLink, "Categoria:", 1, true) ~= nil then
return "[[" .. WTLink .. "]]"
return "[[" .. WTLink .. "]]"
elseif AddSemantic then
elseif AddSemantic then
Riga 476: Riga 479:
     return queryResult
     return queryResult
end
end
 
--- Writes a gneric UL list from property, adding SMW link if specified
--
-- @param PName Info from MW session
-- @param SMWPrefix
-- @return A bullet list of backlinks
function p.PropertyList(frame)
--{{#invoke:DTBase|PropertyList|P59|Scritto da}}
local AllReferences = {}
local Item = mw.wikibase.getEntityIdForCurrentPage()
if not Item then
Item = 'Q1'
end
local Statements = mw.wikibase.getAllStatements(Item, frame.args["Property"])
if not Statements then
return "Nessun riferimento trovato"
elseif table.getn(Statements) == 1 then
return p.LabelOrLink(Statements[1].mainsnak.datavalue.value.id, frame.args["SMWPrefix"], true)
else
for _, Statement in pairs(Statements) do
--local ReferenceItem = Statement.mainsnak.datavalue.value.id
AllReferences[#AllReferences + 1] = "<li>" .. p.LabelOrLink(Statement.mainsnak.datavalue.value.id, frame.args["SMWPrefix"], true) .. "</li>"
end
return "<ul>" .. table.concat(AllReferences, string.char(10)) .. "</ul>"
end
end
return p
return p

Menu di navigazione