Модуль:Wikilinks: различия между версиями

Содержимое удалено Содержимое добавлено
Новая страница: «-- THIS IS AN EXPERIMENTAL MODULE -- @author RLuts local p = {} --Return links to wikipedia and commons category function p.links(frame) local lang = …»
 
м fixed bug
Строка 19:
entity = mw.wikibase.getEntity()
if not entity == nil then
return nil
end
if (entity.sitelinks[lang .. "wiki"] ~= nil and not hasWikiLink) then
wlinks = "[[wikipedia:" .. lang .. ":" .. entity.sitelinks[lang .. "wiki"].title .. "]]\n"
end
if (entity.claims ~= nil and entity.claims.p373 ~= nil and not hasComLink and wlinks) then
wlinks = wlinks .. "[[commons:Category:" .. entity.claims.p373[0].mainsnak.datavalue.value .. "]]"
elseif (not wlinks) then
wlinks = "[[commons:Category:" .. entity.claims.p373[0].mainsnak.datavalue.value .. "]]"
end