Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:ArticleButton: Difference between revisions

From Ved's Trolleybuses Place Wiki
No edit summary
No edit summary
Line 12: Line 12:
         :tag("div")
         :tag("div")
             :addClass("circle-image")
             :addClass("circle-image")
             :css("background-image", "url('" .. image .. "')")
             :wikitext( string.format( '[[File:%s|x48px|link=]]', image ) )
         :done()
         :done()
         :tag("span")
         :tag("span")

Revision as of 06:16, 13 December 2024

Documentation for this module may be created at Module:ArticleButton/doc

local p = {}

function p.render(frame)
    local args = frame:getParent().args
    local article = args.article or mw.title.getCurrentTitle().fullText
    local label = args.label or mw.title.new(article).text
    local image = args.image or mw.ext.PageImages.getImage(article)

    local html = mw.html.create("span")
    html:attr('id', article)
        :addClass("button-with-circle")
        :tag("div")
            :addClass("circle-image")
            :wikitext( string.format( '[[File:%s|x48px|link=]]', image ) )
        :done()
        :tag("span")
            :wikitext(label)
        :done()

    return tostring(html)
end

return p