X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=libs%2Fweb%2Fluasrc%2Ftemplate.lua;h=7cc6e11b0857a20f308012d23924dc707c89e213;hb=3e0b6b681c1d62465d285859d3496f0667d35018;hp=4971033a2723309e30265ec856104bc1bfc90eea;hpb=80a2dd2cc27e2fc0c55f03f01a1d460a91954ab6;p=project%2Fluci.git diff --git a/libs/web/luasrc/template.lua b/libs/web/luasrc/template.lua index 4971033a2..7cc6e11b0 100644 --- a/libs/web/luasrc/template.lua +++ b/libs/web/luasrc/template.lua @@ -32,6 +32,7 @@ local string = require "string" local config = require "luci.config" local coroutine = require "coroutine" local nixio = require "nixio", require "nixio.util" +local tparser = require "luci.template.parser" local tostring, pairs, loadstring = tostring, pairs, loadstring local setmetatable, loadfile = setmetatable, loadfile @@ -206,12 +207,7 @@ function Template.__init__(self, name) end elseif compiler_mode == "memory" then - local source - source, err = fs.readfile(sourcefile) or fs.readfile(sourcefile .. ".htm") - if source then - self.template, err = compile(source) - end - + self.template, _, err = tparser.parse(sourcefile .. ".htm") end -- If we have no valid template throw error, otherwise cache the template