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

큰숲백과, 나무를 보지 말고 큰 숲을 보라.
편집 요약 없음
편집 요약 없음
 
(같은 사용자의 중간 판 2개는 보이지 않습니다)
6번째 줄: 6번째 줄:
     else
     else
         return string.format('<span class="plainlinks new %s">[%s%s/index.php?%s %s]</span>',
         return string.format('<span class="plainlinks new %s">[%s%s/index.php?%s %s]</span>',
             class,
             class or '',
             mw.site.server,
             mw.site.server,
             mw.site.scriptPath,
             mw.site.scriptPath,
             mw.uri.buildQueryString {
             mw.uri.buildQueryString {
                action = 'edit', title = article, editintro = editintro, preload = preload
                action = 'edit',  
                title = article, editintro = editintro, preload = preload
             },
             },
             linkname)
             linkname)

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