Content deleted Content added
minor tweak so that the qid parameter works |
rm misplaced tracking category |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 1:
-- Version: 2021-
local p = {}
require('
local wdib = require('Module:WikidataIB')
local getValue = wdib._getValue
Line 12:
local i18n = {
["unknown-author"] = mw.wikibase.getLabel("Q4233718"):gsub("^%l", mw.ustring.upper),
["unknown-author-trackingcat"] = "", -- [[Category:Cite Q - author unknown]]
["ordinal"] = {
[1] = "st",
Line 175:
if v.qualifiers and v.qualifiers.P1932 then
label = v.qualifiers.P1932[1].datavalue.value
else
label = mw.wikibase.getLabel(qnumber)
Line 220 ⟶ 218:
if v.qualifiers and v.qualifiers.P1932 then
label = v.qualifiers.P1932[1].datavalue.value
else
label = i18n["unknown-author"] .. (i18n["unknown-author-trackingcat"] or "")
Line 479 ⟶ 475:
if url then
citeq_args.url = mw.text.split( url, " (", true )[1]
local arcurl = mw.ustring.match( url, " %((.*)%)" ) -- when there is an archive url, <url> holds: url<space>(archive url); here extract the archive url if present
if arcurl then
local arcy, arcm, arcd = arcurl:match("(20%d%d)%p?(%d%d)%p?(%d%d)")
Line 498 ⟶ 494:
if not titleforced then
-- Handle subtitle.
if citeq_args.title then
local subtitle = mw.wikibase.getBestStatements (qid, 'P1680');
if 0 ~= #subtitle then
subtitle = subtitle[1].mainsnak.datavalue.value.text;
citeq_args.title = citeq_args.title .. ": " .. subtitle
end
end
local htmltitle = getValue( {"P1476", qual = "P6833", ps = 1, qid = qid, maxvals = 1, qo = "y"} )
if htmltitle then
Line 609 ⟶ 614:
end
if author_count > 8 then -- convention in astronomy journals, optional mode for this?
citeq_args['display-authors'] = nil; -- unset because no longer needed
else
citeq_args['display-authors'] = citeq_args['display-authors'] or 3 -- limit to three displayed names
end
end
Line 619 ⟶ 628:
end
if editor_count > 8 then -- convention in astronomy journals, optional mode for this?
citeq_args['display-editors'] = nil; -- unset because no longer needed
else
citeq_args['display-editors'] = citeq_args['display-editors'] or 3 -- limit to three displayed names
end
end
Line 684 ⟶ 697:
end
-- make the nowiki'd string and done
return
end
|