Added ability to echo HTML inside Lua logic blocks.

This commit is contained in:
NiLSPACE 2020-10-17 14:10:48 +02:00
parent a41f74197c
commit b7c3ad8096

View File

@ -233,10 +233,14 @@ end
local function CompileView(a_Content) local function CompileView(a_Content)
content = 'return table.concat({[===[' .. a_Content .. ']===]})'; content = 'return table.concat({[===[' .. a_Content .. ']===]})';
content = content:gsub("%{=%{(.-)%}=%}", function(logic) content = content:gsub("%{=%{(.-)%}=%}", function(logic)
logic = logic
:gsub("<>(.-)</>", "table.insert(__RESULTING_CONTENT__, [===[%1]===])")
:gsub("%{%{(.-)%}%}", "table.insert(__RESULTING_CONTENT__, cWebAdmin:GetHTMLEscapedString(%1))");
return [[]===], ( return [[]===], (
function() function()
local __RESULTING_CONTENT__ = {}; local __RESULTING_CONTENT__ = {};
]] .. logic:gsub("%{%{(.-)%}%}", "table.insert(__RESULTING_CONTENT__, cWebAdmin:GetHTMLEscapedString(%1))") .. [[ ]] .. logic .. [[
return table.concat(__RESULTING_CONTENT__) return table.concat(__RESULTING_CONTENT__)
end end
)(), [===[ )(), [===[