[awful] Add escape function

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
marc lagrange 2008-06-10 18:25:03 +02:00 committed by Julien Danjou
parent 13a96b6edd
commit 77fc1cb503
1 changed files with 10 additions and 0 deletions

View File

@ -375,6 +375,15 @@ local function menu(p, textbox, exe_callback)
end)
end
local function escape(text)
text = text:gsub("&", "&amp;")
text = text:gsub("<", "&lt;")
text = text:gsub(">", "&gt;")
text = text:gsub("\\", "&apos;")
text = text:gsub("\"", "&quot;")
return text
end
-- Export tags function
P.tag =
{
@ -415,5 +424,6 @@ P.layout =
}
P.spawn = spawn
P.menu = menu
P.escape = escape
return P