모듈:Linkwithtemplate: 두 판 사이의 차이

큰숲백과, 나무를 보지 말고 큰 숲을 보라.
편집 요약 없음
편집 요약 없음
1번째 줄: 1번째 줄:
local p = {}
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,
            mw.site.server,
            mw.site.scriptPath,
            mw.uri.buildQueryString {
                action = 'edit', title = article, editintro = editintro, preload = preload
            },
            linkname)
    end
end


p.main = function(frame)
p.main = function(frame)
local args = require('Module:Arguments').getArgs(frame)
    local args = require('Module:Arguments').getArgs(frame)
local article = args[1] or ''
local linkname = args[2] or nil
local class = args['class'] or ''


if mw.title.new(article).exists then
    return p.makelink(args[1] or '', args[2] or args[1], args['preload'], args['editintro'], args['class'] or '')
return '[[' .. article .. (linkname and '|'..linkname or '') .. ']]'
else
if linkname == nil then
linkname = article
end
return '<span class="plainlinks new '..class..'">['..mw.site.server..'/index.php?'..
mw.uri.buildQueryString {
    action = 'edit', title = article, editintro = args['editintro'], preload = args['템플릿']
}..' '..linkname..']</span>'
end
end
end
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
return p
return p

2025년 1월 30일 (목) 17:58 판

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,
            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