diff --git a/silkmvc/core/hook.lua b/silkmvc/core/hook.lua index 13c9152..0c46449 100644 --- a/silkmvc/core/hook.lua +++ b/silkmvc/core/hook.lua @@ -64,7 +64,7 @@ function loadscript(file, args) if (s) then if mtbegin then if html ~= "" then - pro = pro .. "echo(\"" .. utils.escape(html) .. "\")\n" + pro = pro .. "echo(\"" .. utils.escape(html, true) .. "\")\n" html = "" end local b, f = line:find("%?>%s*$") @@ -89,7 +89,7 @@ function loadscript(file, args) -- find the close local x, y = tmp:find("%?>") if x then - pro = pro .. "\"" .. utils.escape(html .. tmp:sub(0, b - 1):gsub("%%", "%%%%")) .. + pro = pro .. "\"" .. utils.escape(html .. tmp:sub(0, b - 1), true) .. "\".." pro = pro .. tmp:sub(f + 1, x - 1) .. ".." html = "" @@ -99,9 +99,9 @@ function loadscript(file, args) error("Syntax error near line " .. i) end end - pro = pro .. "\"" .. utils.escape(tmp:gsub("%%", "%%%%")) .. "\")\n" + pro = pro .. "\"" .. utils.escape(tmp, true) .. "\")\n" else - html = html .. ulib.trim(line, " "):gsub("%%", "%%%%") .. "\n" + html = html .. ulib.trim(line, " ") .. "\n" end else if line ~= "" then @@ -114,7 +114,7 @@ function loadscript(file, args) end f:close() if (html ~= "") then - pro = pro .. "echo(\"" .. utils.escape(html) .. "\")\n" + pro = pro .. "echo(\"" .. utils.escape(html, true) .. "\")\n" end pro = pro .. "\nend \n return fn" local r, e = load(pro)