Module:Cite Q/sandbox: Difference between revisions

Content deleted Content added
translator doesn't go in others
making others into loop
Line 32:
pages = {id="P304", maxvals=1},
translator = {id="P655", maxvals=0}, -- does **not** go to "others" section!
illustrator = {id="P110", maxvals=0, others=1}, -- goes to "others" section
composer = {id="P86", maxvals=0, others=1}, -- goes to "others" section
animator = {id="P6942", maxvals=0, others=1}, -- goes to "others" section
director = {id="P57", maxvals=0, others=1}, -- goes to "others" section
screenwriter = {id="P58", maxvals=0, others=1}, -- goes to "others" section
}
 
Line 213:
end
local oth = {}
for name, data in pairs(simple_properties) do
citeq_args[name] = getValue( {data.id, ps = 1, qid = citeq_args.qid, maxvals=data.maxvals, linked=data.linked, citeq_args[name] } )
if not citeq_argsdata.others then
oth[#oth+1] = citeq_args.composer[name] and (name:gsub("Composer^%l", string.upper) .. ": " .. citeq_args.composer[name])
citeq_args.composer[name] = nil
end
end
citeq_args.others = citeq_args.others or table.concat(oth, ". ")
 
citeq_args.journal = citeq_args.journal and citeq_args.journal:gsub("^''", ""):gsub("''$", "")
 
citeq_args.ol = (getValue( {"P648", ps = 1, qid = citeq_args.qid, maxvals=1, citeq_args.ol } ) or ''):gsub("^OL(.+)$", "%1")
ifciteq_args.biorxiv = citeq_args.biorxiv thenand ("10.1101/" .. citeq_args.biorxiv)
citeq_args.biorxiv = "10.1101/" .. citeq_args.biorxiv
end
-- best way to make a list is to use a table
if not citeq_args.others then
local oth = {}
oth[#oth+1] = citeq_args.illustrator and ("Illustrator: " .. citeq_args.illustrator)
oth[#oth+1] = citeq_args.composer and ("Composer: " .. citeq_args.composer)
oth[#oth+1] = citeq_args.animator and ("Animator: " .. citeq_args.animator)
oth[#oth+1] = citeq_args.director and ("Director: " .. citeq_args.director)
oth[#oth+1] = citeq_args.screenwriter and ("Screenwriter: " .. citeq_args.screenwriter)
-- any more go here
citeq_args.others = table.concat(oth, ". ")
end
citeq_args.illustrator = nil
citeq_args.composer = nil
citeq_args.animator = nil
citeq_args.director = nil
citeq_args.screenwriter = nil
 
citeq_args.isbn = getValue( {"P957", ps = 1, qid = citeq_args.qid, maxvals=0, citeq_args.isbn } ) -- try ISBN 10