More actions
Created page with "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("a") html:attr("href", mw.uri.fullUrl(article)) :addClass("button-with-circle") :tag("div") :addClass("circle-image") :c..." |
No edit summary |
||
(14 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
local article = args.article or mw.title.getCurrentTitle().fullText | local article = args.article or mw.title.getCurrentTitle().fullText | ||
local label = args.label or mw.title.new(article).text | local label = args.label or mw.title.new(article).text | ||
local image = args.image | local image = args.image | ||
if string.len(label) >= 32 then | |||
label = string.sub(label, 1, 31).."..." | |||
end | |||
local html = mw.html.create(" | local html = mw.html.create("span") | ||
html | html:addClass("button-with-circle") | ||
:tag("div") | :tag("div") | ||
:addClass("circle-image") | :addClass("circle-image") | ||
: | :wikitext( string.format( '[[File:%s|x48px|link=]]', image ) ) | ||
:done() | :done() | ||
:tag("span") | :tag("span") | ||
:wikitext(label) | :wikitext(string.format('[[%s|%s]]', article, label)) | ||
:done() | :done() | ||
Latest revision as of 22:32, 16 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
if string.len(label) >= 32 then
label = string.sub(label, 1, 31).."..."
end
local html = mw.html.create("span")
html:addClass("button-with-circle")
:tag("div")
:addClass("circle-image")
:wikitext( string.format( '[[File:%s|x48px|link=]]', image ) )
:done()
:tag("span")
:wikitext(string.format('[[%s|%s]]', article, label))
:done()
return tostring(html)
end
return p