词条 | Module:PetScan |
释义 | local params = { --{par = "lang", name = ""}, {par = "template", name = "templates_yes"}, {par = "props", name = "wikidata_prop_item_use"}, {par = "commands", name = "al_commands"} } local p = {} local getArgs = require('Module:Arguments').getArgs function p._main(args) local out = {} for k,v in ipairs(params) do local value = args[v.par] local name = v.name if v.par == 'commands' then value = string.gsub(value,';','\' ) end if v.par == 'template' or v.par == 'commands' then value = mw.uri.encode(value,"PATH") end if value then out[#out+1] = '&' .. name .. '=' .. value end end query = table.concat(out) url = 'http://petscan.wmflabs.org/?language=en&project=wikipedia&ns%5B0%5D=1&wpiu=none&common_wiki=wikidata&wikidata_item=with' .. query .. '&doit=' label2 = '"' .. args.template .. '" - ' .. args.props .. ' - "' .. args.commands .. '"' label = args.label return '[' .. url .. ' ' .. (label or label2) .. ']' end function p.main(frame) local args = getArgs(frame) return p._main(args) end return p |
随便看 |
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。