Module:Cite Q: Difference between revisions

Content deleted Content added
Commenting out problematic code that is causing links to appear in WhatLinksHere
Prepare for "series ordinal" by introducing a "position" local variable.
Line 73:
if props[1].mainsnak.datavalue.type == "wikibase-entityid" then
-- it's wiki-linked value, so output as link if possible
local maxpos = 0
for k, v in pairs(props) do
local qnumber = "Q" .. v.mainsnak.datavalue.value["numeric-id"]
Line 82 ⟶ 83:
label = qnumber
end
local position = maxpos + 1 -- Default to 'next' author.
-- todo: use P1545 (series ordinal) instead of default position.
maxpos = math.max(maxpos, position)
if sitelink then
-- just the plain name,
-- but keep a record of the links, using the same index
out[#out + 1position] = label
link[#outposition] = sitelink
else
-- no sitelink, so check first for a redirect with that label
Line 96 ⟶ 100:
-- but there's a redirect with the same title as the label;
-- so store the link to that
-- out[#out + 1position] = label
-- link[#outposition] = label
-- else
-- no sitelink and not a redirect but an article exists with the same title as the label
-- that's probably a dab page, so output the plain label
-- out[#out + 1position] = label
-- end
--else
Line 107 ⟶ 111:
if wdl then
-- show that there's a Wikidata entry available
out[#out + 1position] = "[[:d:Q" .. v.mainsnak.datavalue.value["numeric-id"] .. "|" .. label .. "]]&nbsp;<span title='" .. i18n["errors"]["local-article-not-found"] .. "'>[[File:Wikidata-logo.svg|16px|alt=|link=]]</span>"
else
-- no wikidata links wanted, so just give the plain label
out[#out + 1position] = label
end
-- end