Code Monkey home page Code Monkey logo

Comments (13)

usernope avatar usernope commented on June 9, 2024 2

Thanks @tooolbox serve2 seems to work with pongo2 for now.

from algernon.

tooolbox avatar tooolbox commented on June 9, 2024 2

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.

tooolbox avatar tooolbox commented on June 9, 2024 1

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.

xyproto avatar xyproto commented on June 9, 2024 1

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, o2and 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.

tooolbox avatar tooolbox commented on June 9, 2024 1

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.

xyproto avatar xyproto commented on June 9, 2024 1

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.

xyproto avatar xyproto commented on June 9, 2024

Thanks for reporting! I'll look into this.

from algernon.

tooolbox avatar tooolbox commented on June 9, 2024

@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.

usernope avatar usernope commented on June 9, 2024

@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.

tooolbox avatar tooolbox commented on June 9, 2024

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.

usernope avatar usernope commented on June 9, 2024

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.

xyproto avatar xyproto commented on June 9, 2024

@usernope

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.

xyproto avatar xyproto commented on June 9, 2024

I think the "next action" here might be to switch to a different Lua implementation.

from algernon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.