Jump to content

Module talk:Mw

Page contents not supported in other languages.
From Wikipedia

Empty tag[edit]

The result of text.tag needs to be adjusted for the case where content is empty. I propose the following:

        if ("" == content) then
            return "<" .. name .. " " .. table.concat(attrs, " ") .. "/>"
            return "<" .. name .. " " .. table.concat(attrs, " ") .. ">" .. content .. "</" .. name .. ">"

As a stylistic issue, is there a particular reason why the definitions of text.tag, url.local and url.full are outside the definitions of text and url respectively?

HTH HAND —Phil Boswell (talk) 16:03, 6 September 2012 (UTC)[reply]

  • If memory of the error message serves, it was mandated by the language semantics. Lua evaluates all of the right-hand side of a local statement before creating and assigning to the left-hand side. So the url.local() function could not refer to url.encode because url did not yet exist at the time. (Or, rather, it referred to a different url that was nil.) Uncle G (talk) 16:19, 6 September 2012 (UTC)[reply]


What needs to be done to leading spaces? I can't see where anything needs to change, given the limited internal usage of this function, but maybe there's some external usage which dictates something different? —Phil Boswell (talk) 16:51, 26 November 2012 (UTC)[reply]