mirror of
https://github.com/lxsang/antd-lua-plugin
synced 2024-12-28 02:18:21 +01:00
disable unescape
This commit is contained in:
parent
177787d07d
commit
0d28bf935a
@ -49,20 +49,31 @@ function utils.decodeURI(url)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function utils.unescape(s)
|
function utils.unescape(s)
|
||||||
local replacements = {
|
local str = ""
|
||||||
["\\\\"] = "\\" ,
|
local escape = false
|
||||||
['\\"'] = '"' ,
|
local esc_map = {b = '\b', f = '\f', n = '\n', r = '\r', t = '\t'}
|
||||||
["\\n"] = "\n" ,
|
for c in s:gmatch"." do
|
||||||
["\\t"] = "\t" ,
|
if c ~= '\\' then
|
||||||
["\\b"] = "\b" ,
|
if escape then
|
||||||
["\\f"] = "\f" ,
|
if esc_map[c] then
|
||||||
["\\r"] = "\r"
|
str = str..esc_map[c]
|
||||||
}
|
else
|
||||||
local out = s
|
str = str..c
|
||||||
for k,v in pairs(replacements) do
|
end
|
||||||
out = out:gsub(k,v)
|
else
|
||||||
|
str = str..c
|
||||||
|
end
|
||||||
|
escape = false
|
||||||
|
else
|
||||||
|
if escape then
|
||||||
|
str = str..c
|
||||||
|
escape = false
|
||||||
|
else
|
||||||
|
escape = true
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return out
|
return str
|
||||||
end
|
end
|
||||||
|
|
||||||
function utils.file_exists(name)
|
function utils.file_exists(name)
|
||||||
|
@ -113,14 +113,14 @@ static int process_token_string(lua_State* L, jsmntok_t* t, const char* s, int c
|
|||||||
//const char* replace_token[8] = {"\\","\"","\n","\t","\b","\f","\r","/"};
|
//const char* replace_token[8] = {"\\","\"","\n","\t","\b","\f","\r","/"};
|
||||||
char * str = strndup(s+t[cid].start, t[cid].end-t[cid].start);
|
char * str = strndup(s+t[cid].start, t[cid].end-t[cid].start);
|
||||||
// un escape the string
|
// un escape the string
|
||||||
lua_getglobal(L, "utils");
|
/*lua_getglobal(L, "utils");
|
||||||
lua_getfield(L, -1, "unescape");
|
lua_getfield(L, -1, "unescape");
|
||||||
lua_pushstring(L,str);
|
lua_pushstring(L,str);
|
||||||
if (lua_pcall(L, 1, 1, 0) != 0)
|
if (lua_pcall(L, 1, 1, 0) != 0)
|
||||||
printf("Error running function `unescape': %s\n",lua_tostring(L, -1));
|
printf("Error running function `unescape': %s\n",lua_tostring(L, -1));
|
||||||
if(str) free(str);
|
if(str) free(str);
|
||||||
str = (char*)luaL_checkstring(L,-1);
|
str = (char*)luaL_checkstring(L,-1);
|
||||||
lua_settop(L, -3);
|
lua_settop(L, -3);*/
|
||||||
lua_pushstring(L,str);
|
lua_pushstring(L,str);
|
||||||
//stackDump(L);
|
//stackDump(L);
|
||||||
//lua_pushstring(L, str);
|
//lua_pushstring(L, str);
|
||||||
|
Loading…
Reference in New Issue
Block a user