Module:Link:修订间差异

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


local function makeInvokeFunc(funcName)
local function makeInvokeFunc(funcName)
第12行: 第11行:
p.titular = makeInvokeFunc('_titular')
p.titular = makeInvokeFunc('_titular')


function p.titular(args)
function p._titular(args)
local result=""
local result=""
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>'
end
end
return result
end
function link(page,name)
local result= '[['..page..'列表#'..name..'|'..name..']]'
return result
end
end


第22行: 第27行:


function p._link(args)
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