Modul:tryWikidataID

A Wikiszótárból, a nyitott szótárból

A modult a Modul:tryWikidataID/doc lapon tudod dokumentálni

local p = {}

function p.getWikidataId()
    local title = mw.title.getCurrentTitle().text
    local entityIdhu = mw.wikibase.getEntityIdForTitle( title, 'huwiki' )
    local entityIden = mw.wikibase.getEntityIdForTitle( title, 'enwiki' )
    local entityIdru = mw.wikibase.getEntityIdForTitle( title, 'ruwiki' )
    local titleScript = require("Module:scripts").findBestScriptWithoutLang(title) 
    if titleScript == "Latn" then
        if entityIdhu then
    	    local  hu_string = "[[d:" ..  entityIdhu .. "|WdID]] [[d:Special:Search/" .. title .. "|Wd keresés]]"
            return hu_string
        else
        	if entityIden then
            	local  en_string = "[[d:" ..  entityIden .. "|WdID]] [[d:Special:Search/" .. title .. "|Wd keresés]]"
            	return en_string
                else return "[[d:Special:Search/" .. title .. "|Wd keresés]]"
        	end
	    end
    else if titleScript == "Cyrl" then
    		if entityIdru then
        		local  ru_string = "[[d:" ..  entityIdru .. "|WdID]] [[d:Special:Search/" .. title .. "|Wd keresés]]"
        		return ru_string
        	else return "[[d:Special:Search/" .. title .. "|Wd keresés]]"
        	end
    	end
    end
end
return p