Module:Link:修订间差异

添加1,109字节 、​ 2021年7月21日 (星期三)
无编辑摘要
无编辑摘要
无编辑摘要
标签移动版编辑 移动版网页编辑
 
(未显示同一用户的15个中间版本)
第1行: 第1行:
local getArgs = require('Module:Arguments').getArgs
local p = {}
local p = {}


function p.titular(frame)
local function makeInvokeFunc(funcName)
return function (frame)
local args = getArgs(frame)
return p[funcName](args)
end
end
 
p.titular = makeInvokeFunc('_titular')
 
function p._titular(args)
local result=""
local result=""
args=mw.getCurrentFrame():getParent().args
for i,k in ipairs(args) do
for i,k in ipairs(args) do
result=result..'<span id="'..k..'"></span>'
result=result..'<span id="'..k..'"></span>'
第10行: 第19行:
end
end


function p.link(frame)
function link(page,name)
local result= '[['..page..'列表#'..name..'|'..name..']]'
return result
end
 
p.link = makeInvokeFunc('_link')
 
function p._link(args)
local page,text=args[1],args[2]
local a,b,c
a,b = text:match('([^\s]*) (feat.*)')
if a and b then
return link(page,a)..' '..b
end
a,b,c = text:match('([^\s]*) (vs) ([^\s]*)')
if a and b and c then
return link(page,a)..' '..b..' '..link(page,c)
end
a,b,c = text:match('([^\s]*) (×) ([^\s]*)')
if a and b and c then
return link(page,a)..' '..b..' '..link(page,c)
end
 
a,b,c = text:match('([^\s]*) (vs.) ([^\s]*)')
if a and b and c then
return link(page,a)..' '..b..' '..link(page,c)
end
 
a,b,c = text:match('([^\s]*) (x) ([^\s]*)')
if a and b and c then
return link(page,a)..' '..b..' '..link(page,c)
end
 
a,b,c = text:match('([^\s]*) (&) ([^\s]*)')
if a and b and c then
return link(page,a)..' '..b..' '..link(page,c)
end


return link(page,text)
end
end


return p
return p