Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Jc86035/3
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
require('strict') local infobox = require('Module:Infobox').infobox local p = {} local function getProperty(entity, property, value) if entity and entity.claims then local claims = entity.claims[property] if claims and claims[1] then if value == 'string' then return claims[1].mainsnak.datavalue.value, claims[1].qualifiers end return claims[1].mainsnak.datavalue.value.id, claims[1].qualifiers end end end local function getQualifier(qualifiers, property, value) local claims = qualifiers[property] if claims and claims[1] then if value == 'string' then return claims[1].datavalue.value end return claims[1].datavalue.value.id end end function p.test(frame) local args = frame.args local entity = mw.wikibase.getEntity(args.qid) local data = { title = 'Title', aboveclass = 'summary', label3 = 'Language', data3 = args.language, label10 = 'Artist', data10 = args.artist, label20 = 'ISWC', data20 = (args.ISWC or args.iswc or getProperty(entity, 'P1827', 'string')), label21 = 'ISRC', data21 = (args.ISRC or args.isrc), } local recording if not data.data10 or not data.data21 then local artist, qualifiers = getProperty(entity, 'P175') if artist then data.data10 = data.data10 or mw.wikibase.getLabel(artist) end local subject_of = getQualifier(qualifiers, 'P805') if subject_of then recording = mw.wikibase.getEntity(subject_of) local isrc = getProperty(recording, 'P1243', 'string') data.data21 = data.data21 or isrc end end return infobox(data) end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/Jc86035/3/doc
(
edit
)