모듈:Linkwithtemplate

큰숲백과, 나무를 보지 말고 큰 숲을 보라.
Cerulean (토론 | 기여)님의 2022년 1월 27일 (목) 00:44 판 (새 문서: 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...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)
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 '[['..doc..'|'..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.buildQueryString {
		    	action = 'edit',
				preload = args['템플릿'],
		    	editintro = args['editintro'],
			    title = doc
			}..' '..linkname..']</span>'
	end
end
------------------------------------------------------------------------------------
return p