본문으로 이동

미디어위키 1.45 안정화가 거의 끝났습니다. 다만 Flow 확장 기능 관련 이슈가 있어서 대체하는 작업을 수행할 계획입니다.

  1. 큰숲백과:청사진에서 위키 발전의 대략적인 방향성을 제시했습니다. 의견이 있으신 분은 큰숲백과토론:청사진에서 의견을 남겨주시면 좋겠습니다.
  2. 기능상의 오류로 지원하지 않고 있는 기능에 대해서는 큰숲백과토론:이슈 트래커에 요약했습니다. 참고하시기 바랍니다.
  3. 데이터베이스 덤프 받고싶으신 분은 큰숲백과 가입 후에 사용자토론:Bigforest에 의견 남겨주시면 ftp 주소, 계정, 비밀번호를 특수:EmailUser를 통해서 공개할 예정입니다.

모듈:Br separated entries

큰숲백과, 나무를 보지 말고 큰 숲을 보라.
-- 한국어 위키백과에서 가져옴
local p = {}

local function _main( args )
    local sep = '<br />'
    local lastsep
    local t = {}
    for i, v in ipairs( args ) do
        table.insert( t, v )
        if mw.ustring.match( v, '%S' ) then
            table.insert( t, sep )
            lastsep = #t
        end
    end
    if lastsep then
        table.remove( t, lastsep )
    end
    return table.concat( t )
end

function p.main( frame )
    local origArgs
    if frame == mw.getCurrentFrame() then
        -- We're being called via #invoke. If the invoking template passed any arguments,
        -- use them. Otherwise, use the arguments that were passed into the template.
        origArgs = frame:getParent().args
        for k, v in pairs( frame.args ) do
            origArgs = frame.args
            break
        end
    else        
        -- We're being called from another module or from the debug console, so assume
        -- the arguments are passed in directly.
        origArgs = frame
    end
    
    -- Use integer args only, and allow for explicit positional arguments
    -- that are specified out of order, e.g. {{br separated entries|3=entry3}}.
    -- After processing, the args can be accessed accurately from ipairs.
    local args = {}
    for k, v in pairs( origArgs ) do
        if type( k ) == 'number' and k >= 1 and math.floor( k ) == k then
            table.insert( args, k )
        end
    end
    table.sort( args )
    for i,v in ipairs( args ) do
        args[ i ] = origArgs[ v ]
    end
    
    return _main( args )
end

return p