Для документации этого модуля может быть создана страница Модуль:Wikilinks/doc
-- THIS IS AN EXPERIMENTAL MODULE -- @author RLuts local p = {} --Return links to wikipedia and commons category function p.links(frame) local lang = 'ru' if mw.title.getCurrentTitle().exists then local content = string.lower(mw.title.getCurrentTitle():getContent()) local hasWikiLink, hasCommLink if string.find(content, "%[%[wikipedia:.*]]") or string.find(content, "{{[Ff]ooter%s*|.*wikipedia%s*=.+}}") then hasWikiLink = true end if string.find(content, "%[%[commons:.*]]") or string.find(content, "{{[Ff]ooter%s*|.*commons%s*=.+}}") then hasComLink = true end entity = mw.wikibase.getEntityObject() if not entity then return nil end if (entity.sitelinks[lang .. "wiki"] and not hasWikiLink) then wlinks = "[[wikipedia:" .. lang .. ":" .. entity.sitelinks[lang .. "wiki"].title .. "]]\n" end if (entity.claims and entity.claims.P373 and not hasComLink and wlinks) then wlinks = wlinks .. "[[commons:Category:" .. entity.claims.P373[1].mainsnak.datavalue.value .. "]]" elseif (entity.claims and entity.claims.P373 and not hasComLink and not wlinks) then wlinks = "[[commons:Category:" .. entity.claims.P373[1].mainsnak.datavalue.value .. "]]" end return wlinks else return nil end end return p