내 여동생이 이렇게 귀여울 리가 없어 위키
Advertisement

이 모듈에 대한 설명문서는 모듈:Figure/설명문서에서 만들 수 있습니다

local p = {}
local getArgs = getArgs or require("Module:Arguments").getArgs

function p.main(frame)
    local args = getArgs(frame)
    local formatDate = require("Module:Date")._formatDate

    local container, image, caption
    local company, name, fullname, filename = "", "", "", ""
    local companyLink, productLink, dateText = "", "", "", ""

    if args["제조사"] and args["상품명"] then
        company = args["제조사"]
        name = args["상품명"]
        fullname = company .. " " .. name
        filename = args["파일명"] or fullname
        image = "[[파일:" .. filename .. ".png|x130px|링크=" .. fullname .. "]]"
        companyLink = "[[:분류:" .. company .. " 피규어|" .. company .. "]]" or company
        productLink = "[[" .. fullname .. "]]" or fullname
    else
        image = "<i class='text-muted text-smaller'>제조사와 상품명을 입력해 주세요.</span>"
    end
    
    dateText = formatDate(args["발매시기/년"], args["발매시기/월"], args["발매시기/일"])
    
    container = mw.html.create("div"):addClass("flex-gallery__item oi-figure")
    
    container
        :tag("div")
            :addClass("oi-figure__thumb")
            :wikitext(image)
    
    caption = container:tag("div"):addClass("oi-figure__caption")
    
    caption
        :tag("div")
            :addClass("text-smaller")
            :wikitext(companyLink)
    
    caption
        :tag("div")
            :addClass("text-smaller")
            :wikitext(dateText)
    
    caption
        :tag("div")
            :wikitext(productLink)
            
    return container:done()
end

return p
Advertisement