모듈:Linkwithtemplate: 두 판 사이의 차이
(새 문서: local p = {} p.test = function(frame) local args = require('Module:Arguments').getArgs(frame) local doc = args[1] or '' local linkname = args[2] or nil local class = args['class'] or '' if mw.title.new(doc).exists then if linkname then return ''..linkname..'' else return ''..doc..'' end else if linkname == nil then linkname = doc end return '<span class="plainlinks new '..class..'">['..mw.site.server..'/index.php?'.. mw.uri.build...) |
편집 요약 없음 |
||
| (같은 사용자의 중간 판 4개는 보이지 않습니다) | |||
| 1번째 줄: | 1번째 줄: | ||
local p = {} | local p = {} | ||
p. | p.makelink = function(article, linkname, preload, editintro, class) | ||
if mw.title.new(article).exists then | |||
return '[[' .. article .. (linkname and '|' .. linkname or '') .. ']]' | |||
else | |||
return string.format('<span class="plainlinks new %s">[%s%s/index.php?%s %s]</span>', | |||
class or '', | |||
mw.site.server, | |||
mw.site.scriptPath, | |||
mw.uri.buildQueryString { | |||
action = 'edit', | |||
title = article, editintro = editintro, preload = preload | |||
}, | |||
linkname) | |||
end | |||
end | |||
p.main = function(frame) | |||
local args = require('Module:Arguments').getArgs(frame) | |||
return p.makelink(args[1] or '', args[2] or args[1], args['preload'], args['editintro'], args['class'] or '') | |||
end | end | ||
------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ||
return p | return p | ||
2025년 1월 30일 (목) 18:35 기준 최신판
local p = {}
p.makelink = function(article, linkname, preload, editintro, class)
if mw.title.new(article).exists then
return '[[' .. article .. (linkname and '|' .. linkname or '') .. ']]'
else
return string.format('<span class="plainlinks new %s">[%s%s/index.php?%s %s]</span>',
class or '',
mw.site.server,
mw.site.scriptPath,
mw.uri.buildQueryString {
action = 'edit',
title = article, editintro = editintro, preload = preload
},
linkname)
end
end
p.main = function(frame)
local args = require('Module:Arguments').getArgs(frame)
return p.makelink(args[1] or '', args[2] or args[1], args['preload'], args['editintro'], args['class'] or '')
end
------------------------------------------------------------------------------------
return p