„Modul:LiteratureData” változatai közötti eltérés
Jump to navigation
Jump to search
(Egy közbenső módosítás ugyanattól a szerkesztőtől nincs mutatva) | |||
6. sor: | 6. sor: | ||
for i, name in ipairs(names) do | for i, name in ipairs(names) do | ||
result = name['mainsnak']['datavalue']['value']['time'] | result = name['mainsnak']['datavalue']['value']['time'] | ||
+ | end | ||
+ | return result | ||
+ | end | ||
+ | |||
+ | function p.getPublicationDateBasedOnLanguage(param) | ||
+ | result = 'information not available on data.jwunited.org for ' .. param.args[1] | ||
+ | names = mw.wikibase.getBestStatements( param.args[1], 'P6' ) | ||
+ | for i, name in ipairs(names) do | ||
+ | qualifier = name['qualifiers'] | ||
+ | lang = ''; | ||
+ | if (qualifier ~= nil) | ||
+ | then lang = name['qualifiers']['P5'][1]['datavalue']['value'] | ||
+ | end | ||
+ | if (lang == param.args[2]) | ||
+ | then | ||
+ | result = name['mainsnak']['datavalue']['value']['time'] | ||
+ | end | ||
end | end | ||
return result | return result |
A lap jelenlegi, 2020. január 19., 14:09-kori változata
A modult a Modul:LiteratureData/doc lapon tudod dokumentálni
local p = {}
function p.getPublicationDate(param)
result = 'information not available on data.jwunited.org for ' .. param.args[1]
names = mw.wikibase.getBestStatements( param.args[1], 'P6' )
for i, name in ipairs(names) do
result = name['mainsnak']['datavalue']['value']['time']
end
return result
end
function p.getPublicationDateBasedOnLanguage(param)
result = 'information not available on data.jwunited.org for ' .. param.args[1]
names = mw.wikibase.getBestStatements( param.args[1], 'P6' )
for i, name in ipairs(names) do
qualifier = name['qualifiers']
lang = '';
if (qualifier ~= nil)
then lang = name['qualifiers']['P5'][1]['datavalue']['value']
end
if (lang == param.args[2])
then
result = name['mainsnak']['datavalue']['value']['time']
end
end
return result
end
function p.getNumber(param)
result = 'information not available on data.jwunited.org for ' .. param.args[1]
names = mw.wikibase.getBestStatements( param.args[1], 'P7' )
for i, name in ipairs(names) do
result = name['mainsnak']['datavalue']['value']
end
return result
end
function p.getPageList(param)
result = 'information not available on data.jwunited.org for ' .. param.args[1]
names = mw.wikibase.getBestStatements( param.args[1], 'P9' )
for i, name in ipairs(names) do
result = name['mainsnak']['datavalue']['value']
end
return result
end
function p.getTableOfContents(param)
result = 'information not available on data.jwunited.org for ' .. param.args[1]
names = mw.wikibase.getBestStatements( param.args[1], 'P10' )
for i, name in ipairs(names) do
result = name['mainsnak']['datavalue']['value']
end
return result
end
function p.getVolume(param)
result = 'information not available on data.jwunited.org for ' .. param.args[1]
names = mw.wikibase.getBestStatements( param.args[1], 'P8' )
for i, name in ipairs(names) do
result = name['mainsnak']['datavalue']['value']
end
return result
end
function p.getNameOfLiteratureBasedOnLanguage(param)
result = 'information not available on data.jwunited.org for ' .. param.args[1]
names = mw.wikibase.getBestStatements( param.args[1], 'P2' )
for i, name in ipairs(names) do
qualifier = name['qualifiers']
lang = '';
if (qualifier ~= nil)
then lang = name['qualifiers']['P5'][1]['datavalue']['value']
end
if (lang == param.args[2])
then
result = name['mainsnak']['datavalue']['value']
end
end
return result
end
return p