openresty / lemplate

OpenResty/Lua template framework implementing Perl's TT2 templating language
54 stars 9 forks source link

Directives wrapper parse error #6

Closed xiaocang closed 6 years ago

xiaocang commented 7 years ago

when I use WRAPPER in tt2 file, there is an error in output lua file.

Reproduce

t.tt2 content:

[% BLOCK wrapper_bug %]
[% content %]
[% END %]

[% WRAPPER wrapper_bug %]
    test
[% END %]

execute lemplate in bash

$ lemplate --compile t.tt2 > template.lua

luac output

luac5.1: template.lua:149: unexpected symbol near '/'

149 lines context

   146  i = i + 1 output[i] = '\n\n'
   147  -- line 7 "t.tt2"
   148
   149  // WRAPPER
   150  i = i + 1 output[i] = (function() {
   151      var output = '';
   152  i = i + 1 output[i] = '\n    test\n';
   153      return context.include('wrapper_bug', { 'content': output });
   154  })();
agentzh commented 7 years ago

@xiaocang I'm afraid WRAPPER is not really implemented yet.

xiaocang commented 7 years ago

OK, thx. I will use another directives to avoid this error. Cloud you please update the README doc file to let others know about it.

agentzh commented 7 years ago

@xiaocang Updated docs. Thanks!