请输入您要查询的百科知识:

 

词条 Module:Wikipedia Requests
释义

local p = {}

function p.wikirequests(frame)

-- Goal: given template parameters input, return a wikipedia page of specific page title

pagetitle = 'Wikipedia Requests' -- Template namespace

header = "Requests for "

searchtype =

searchterm =

for key, value in pairs(frame:getParent().args) do -- iterate through arguments, pick out values

searchtype = key

searchterm = value

if key == 'category' then

pagetitle = pagetitle .. '/Category/' .. value

header = header .. '[[:Category:' .. value

elseif key == 'wikiproject' then

pagetitle = pagetitle .. '/WikiProject/' .. value

header = header .. '[[Wikipedia:' .. value

elseif key == 'article' then

pagetitle = pagetitle .. '/Article/' .. value

header = header .. '[[' .. value

end

 	end 	 	header = header .. "]] via Wikipedia Requests:'''\\"  	if pagetitle == 'Wikipedia Requests' then -- You end up with this when there are no parameters 		body = 'You need to specify parameters.' 	else

if mw.title.makeTitle('Template', pagetitle).exists == true then

body = frame:expandTemplate{ title = 'Template:' .. pagetitle, args = {} }

else

body = "The list will be copied to Wikipedia soon"

end

 	end  	footer = '\\' .. frame:expandTemplate{ title = 'Template:Clickable button 2', args = { url = 'https://wpx.wmflabs.org/requests/en/search?searchtype=' .. searchtype .. '&searchterm=' .. string.gsub(searchterm, ' ', '+') .. '&language=en', '… View full list', class='mw-ui-progressive mw-ui-quiet', style='color:#2962CB' } } 	footer = footer .. frame:expandTemplate{ title = 'Template:Clickable button 2', args = { url = 'https://wpx.wmflabs.org/requests/en/add', '+ Add request', class='mw-ui-progressive mw-ui-quiet', style='color:#2962CB' } } 	 	content = header .. body .. footer 	return content end  return p
随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/11 20:01:54