Module talk:Mw
Appearance
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, " ") .. "/>"
else
return "<" .. name .. " " .. table.concat(attrs, " ") .. ">" .. content .. "</" .. name .. ">"
end
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)
- 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 theurl.local()
function could not refer tourl.encode
becauseurl
did not yet exist at the time. (Or, rather, it referred to a differenturl
that wasnil
.) Uncle G (talk) 16:19, 6 September 2012 (UTC)
escape()
[edit]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)