יחידה:OCLC
מראה
ניתן ליצור תיעוד על היחידה הזאת בדף יחידה:OCLC/תיעוד
local p= { }
function p.oclc(frame)
local args = require('Module:Arguments').getArgs(frame)
local short = args['מקוצר']
local qid = args['qid'] or mw.wikibase.getEntityIdForCurrentPage()
local oclc = args[1]
local oclcUrl = ''
if oclc==nil or oclc=='' then
oclc = mw.wikibase.getBestStatements( qid, 'P5331' )
if #oclc>0 then
oclc = oclc[1].mainsnak.datavalue.value
oclcUrl = 'http://classify.oclc.org/classify2/ClassifyDemo?owi=' .. oclc
else
oclc = mw.wikibase.getBestStatements( qid, 'P243' )
if #oclc==0 then
return ''
end
oclc = oclc[1].mainsnak.datavalue.value
oclcUrl = 'http://www.worldcat.org/oclc/' .. oclc
end
else
oclcUrl = 'http://www.worldcat.org/oclc/' .. oclc
end
if short then
return mw.ustring.format('[%s %s]', oclcUrl, oclc)
else
local name = args[2]
if name==nil or #name==0 then
name = mw.title.getCurrentTitle().text
name = mw.ustring.gsub(name, " *[(].*[)]","")
end
return mw.ustring.format('[%s %s], באתר [[Online Computer Library Center|OCLC]] %s', oclcUrl, name, frame:expandTemplate{ title = 'אנגלית' })
end
end
return p