Line 271: |
Line 271: |
| | | |
| return tostring(row) | | return tostring(row) |
− | end
| |
− |
| |
− | -- Print an HTML attribute (like key="value") if a non-empty value is specified. This is a temporary method during the migration to Lua.
| |
− | -- @param frame The arguments passed to the script.
| |
− | -- @test mw.log(p.printAttribute({ args = { "someKey", "some \"'<> value" }}))
| |
− | function p.printAttribute(frame)
| |
− | local key = frame.args[1]
| |
− | local value = frame.args[2]
| |
− |
| |
− | if value == nil or value == "" then
| |
− | return ""
| |
− | else
| |
− | return key .. "=\"" .. mw.text.encode(value) .. "\""
| |
− | end
| |
| end | | end |
| | | |