Comments (13)
Thanks @tooolbox serve2 seems to work with pongo2 for now.
from algernon.
Hey @xyproto I believe the problem is the output should look roughly like this:
This is the title
test 1: 2 test 1: 3 test 1: 1
test 2: <table> test 2: <table> test 2: <table>
But you just get this:
This is the title
test 1: 2 test 1: 3 test 1: 1
The whole second loop generates no output and if you do {{ object_list | length }}
the result is zero.
I tested and repro'd with latest release rather than latest commit, because I don't actually have a Go compiler on this windows box, long story 😅 But, quickly scanning over the interim commit messages, I don't see anything that would seem to affect this?
from algernon.
I reproduced with the latest release on Windows. Straight sequences and key-value tables work fine, but nesting a table makes the length zero. Also checked with {{ object_list | length }}
I had a suspicion which turned out to be true, though:
I don't use data.lua
because I don't like polluting the global VM space, I use an index.lua
that calls serve2
with a page.tmpl
and that works fine (just tested). So the issue appears to be with the data.lua
feature specifically. @usernope maybe try changing to a Lua handler as a workaround while this is otherwise investigated?
from algernon.
When adding some logging to Algernon, for what the Lua state contains, I get this:
INFO[3816] GOT <nil>: o2 ==> map[1:2] (map[int]int)
INFO[3816] GOT <nil>: number_list ==> map[1:1 2:2 3:3] (map[int]int)
INFO[3816] GOT <nil>: o1 ==> map[1:1] (map[int]int)
INFO[3816] GOT <nil>: _G ==> map[_GOPHER_LUA_VERSION:GopherLua 0.1 _VERSION:Lua 5.1 title:This is the title] (map[string]string)
INFO[3816] GOT <nil>: math ==> map[huge:9223372036854775807 pi:3] (map[string]int)
INFO[3816] GOT <nil>: o3 ==> map[1:3] (map[int]int)
It looks like number_list
is fine, and is considered to be a map[int]int
, while object_list
is interpreted as o1
, o2
and o3
, for some reason.
I wonder if this could be an issue with the Lua interpreter, or if maps of objects just needs to be handled in a different way within Algernon. I'll check the type of object_list
.
from algernon.
I think the "next action" here might be to switch to a different Lua implementation.
Oh my!
Well, is it really the Lua implementation, or is the implementation of the data.lua
feature? Because as I noted above, it works fine when using an index.lua
handler:
I don't use data.lua because I don't like polluting the global VM space, I use an index.lua that calls serve2 with a page.tmpl and that works fine (just tested). So the issue appears to be with the data.lua feature specifically. @usernope maybe try changing to a Lua handler as a workaround while this is otherwise investigated?
Just something to check into before you need to go to those lengths, I think.
from algernon.
You are right. I think my comment was a bit rushed.
There is also #126, thought, that I am contemplating how to resolve without changing the Lua implementation.
from algernon.
Thanks for reporting! I'll look into this.
from algernon.
@usernope what is your expected output? <object>
or some such?
If the output is really blank, Algernon's only failing is probably that it does not output <object>
or <table>
or similar.
from algernon.
@tooolbox I've tried it with just the text "test2" and it doesn't render it.
object_list seems to have a length of 0.
from algernon.
Ah, so the output contains no instances of the text test 2:
Interesting.
This, or approximately this, was working as of #79 so perhaps some kind of regression.
from algernon.
Hi, I'd just like to check if anyone has managed to reproduce the problem or if it's something on my side.
Thanks.
from algernon.
If I place data.lua
and index.po2
in a directory and launch Algernon with algernon -e .
or algernon -t .
, it seems to work fine.
I get:
This is the title
test 1: 2 test 1: 3 test 1: 1
Could you please let me know:
- If you using Algernon from the
main
branch, or the latest release version? - Which command are you using for launching Algernon?
@tooolbox Does this appear to work on Windows when using the latest main
commit?
from algernon.
I think the "next action" here might be to switch to a different Lua implementation.
from algernon.
Related Issues (20)
- url rewrite and reusing index.lua HOT 5
- KeyValue support table-value HOT 1
- How to get RemoteAddr (or other [remote] variables)? HOT 2
- pug and jade template support HOT 6
- %2F in URL
- low ulimit on macOS HOT 1
- Authrefresh crashes randomly at startup HOT 2
- Command line arg --internal=filename ignores filename HOT 3
- Can Algernon be configured to run over SSL but with a self-signed cert
- ability to close the response stream early HOT 5
- Integrate pure-go Svelte compiler just like plenti HOT 7
- gopherlua doesn't support package.loadlib HOT 3
- MultiMarkdown CriticMarkup Support
- lua to wasm HOT 2
- .alg files are persisted to /tmp HOT 2
- sqlite support HOT 2
- examples for data validations
- Create more documentation and learning materials (like tutorial + reference) HOT 7
- Vhost handling HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from algernon.