| -rw-r--r-- | luahtml.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -74,18 +74,16 @@ void luaHtml_call(lua_State *L, char *fileName){ if(state == 0){ printf("LuaHtml Error: Scriptlet ended while not inside of a scriptlet at line: %d", line); error = 1; - charState = 0; } else { if(state == 1){ - appendToResult(&result, "; result = result .. \"", &length, &sizeAlloced); + appendToResult(&result, "\n result = result .. \"", &length, &sizeAlloced); } else if(state == 2){ - appendToResult(&result, "; result = result .. \"", &length, &sizeAlloced); + appendToResult(&result, "\n result = result .. \"", &length, &sizeAlloced); } state = 0; } - } else { - charState = 0; } + charState = 0; } else if(c == '=' && charState == 2){ if(state == 1 || state == 2){ printf("LuaHtml Error: Scriptlet started while already inside of a scriptlet at line: %d", line); @@ -104,6 +102,9 @@ void luaHtml_call(lua_State *L, char *fileName){ } else if(charState == 1){ charState = 0; appendCharToResult(&result, '<', &length, &sizeAlloced); + } else if(charState == 4){ + charState = 0; + appendCharToResult(&result, '%', &length, &sizeAlloced); } if(state == 0 && (c == '"' || c == '\\')){ appendCharToResult(&result, '\\', &length, &sizeAlloced); @@ -113,7 +114,7 @@ void luaHtml_call(lua_State *L, char *fileName){ error = luaL_loadbuffer(L, result, length, "line") || lua_pcall(L, 0, 0, 0); if(error){ - fprintf(stderr, "%s", lua_tostring(L, -1)); + fprintf(stderr, "%s\n", lua_tostring(L, -1)); lua_pop(L, 1); } @@ -128,7 +129,7 @@ void luaHtml_call(lua_State *L, char *fileName){ error = luaL_loadbuffer(L, result, length, "line") || lua_pcall(L, 0, 0, 0); if(error){ - fprintf(stderr, "%s", lua_tostring(L, -1)); + fprintf(stderr, "%s\n", lua_tostring(L, -1)); lua_pop(L, 1); } |
