Module:Datalist: Difference between revisions

From Tsadra Foundation Advanced Contemplative Scholarships
(by SublimeText.Mediawiker)
(by SublimeText.Mediawiker)
 
Line 15: Line 15:
     end
     end


     return tostring( output )
     return output


end
end


return p
return p

Latest revision as of 09:37, 29 April 2024

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

local p = {}

function p.datalist(frame)

    local pargs = frame:getParent().args

    local output = mw.html.create( 'datalist' )
    output
        :attr( 'id', pargs[1] )

    for value in string.gmatch(pargs[2], "([^,]+)") do
        output
            :tag( 'option' )
                :attr( 'value', value )
    end

    return output

end

return p