lapis icon indicating copy to clipboard operation
lapis copied to clipboard

Value not available in sub-sub-template if render(..., {value = ...}) used in the template

Open semyon422 opened this issue 1 year ago • 0 comments

app.lua

local lapis = require("lapis")

local app = lapis.Application()
app:enable("etlua")

app:match("test", "/test", function(self)
    self.value_1 = "qwerty"
    self.context = {value_2 = "asdfgh"}
    return {render = true}
end)

return app

views/test.etlua

value_1 in test: <%= value_1 %><br>
value_2 in test: <%= context.value_2 %><br>
<% render("views.test_sub", context) %>

views/test_sub.etlua

value_1 in test_sub: <%= value_1 %><br>
value_2 in test_sub: <%= value_2 %><br>
<% render("views.test_sub_sub") %>

views/test_sub_sub.etlua

value_1 in test_sub_sub: <%= value_1 %><br>
value_2 in test_sub_sub: <%= value_2 %><br>

GET /test

value_1 in test: qwerty
value_2 in test: asdfgh
value_1 in test_sub: qwerty
value_2 in test_sub: asdfgh
value_1 in test_sub_sub: qwerty
value_2 in test_sub_sub: nil

semyon422 avatar Jun 01 '23 16:06 semyon422