-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
INCLUDE directive with variable generates invalid Lua code #7
Comments
@mikz Thanks for the report. It is known that use of variables inside the This is actually a bit tricky to support unless the lemplate compiler itself is written in OpenResty/Lua. This Perl 5 version of lemplate will probably never do that. My colleague @ingydotnet is currently working on the fanlang implementation of lemplate atm, which will make the lemplate compiler itself run atop OpenResty/Lua. At that point, this might be possible though running a full lemplate compiler on the edge is definitely not the most efficient choice. |
Having pure Lua version would be awesome. My use case is to use these templates to template nginx config. Wanted to use this to compile several included templates to one blob and not depend on a nginx include directive. Efficiency does not really matter there for me. I'm happy to try any alpha quality software. |
I'll add an issue for this to the Fanlang Lemplate. If understand it correctly, this does not involve runtime compilation. You just want these 2 lines to work the same:
@mikz I think for your use case you could just use Perl (with the exact same templates) using the real Template Toolkit http://www.template-toolkit.org/ |
@mikz also take a look at https://metacpan.org/pod/Template::Toolkit::Simple for really simple command line usage like:
|
@mikz I have implemented this in the fanlang version of Lemplate. This should become open source once we have accomplished the prerequisites for doing so. :) |
Sounds great happy to try that when its out. I've went with using https://github.com/chenxianyu2015/liquid-lua because it is pure Lua and I could easily implement for loop and objects for accessing filesystem from the template. For my use case - generating nginx configuration - I really want the FS access to for example generate includes or include those files directly. edit: Example configuration https://github.com/3scale/cors-proxy/blob/37907f85ce9fa21b1f71451422ee0f3e1f4b2da6/nginx/main.conf.liquid |
Using
INCLUDE
with variable generates invalid lua code. Looks like it concatenates how toget the variable value with the logic of getting the block.
Version 0.11
Template
Lua
The text was updated successfully, but these errors were encountered: