Module:Sound: Difference between revisions
mNo edit summary |
mNo edit summary |
||
| Line 17: | Line 17: | ||
:attr('data-sound-file', fileUrl) | :attr('data-sound-file', fileUrl) | ||
container | container:wikitext(string.format('[[File:Icon-Volume.png|%s|link=]]', size)) | ||
return tostring(container) | return tostring(container) | ||
Revision as of 12:49, 31 December 2025
Documentation for this module may be created at Module:Sound/doc
local p = {}
function p.main(frame)
local args = frame:getParent().args
local fileName = args[1]
local size = args[2] or '16px'
if not fileName or fileName == '' then
return '<span style="color:red; font-weight:bold;">Error: No file specified</span>'
end
local fileUrl = frame:callParserFunction('filepath', fileName)
if fileUrl:sub(1,2) == "//" then fileUrl = "https:" .. fileUrl end
local container = mw.html.create('span')
:addClass('sound-button')
:attr('data-sound-file', fileUrl)
container:wikitext(string.format('[[File:Icon-Volume.png|%s|link=]]', size))
return tostring(container)
end
return p