Skip to content
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

fix erlydtl 0.8 compilation #393

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

dialtone
Copy link

@dialtone dialtone commented Feb 6, 2014

Currently erlydtl 0.8+ compilation is broken and raises the following errors:

unexpected error compiling templates/profile.html
{'EXIT',{{case_clause,{ok,profile_dtl}},
         [{rebar_erlydtl_compiler,do_compile,4,
                                  [{file,"src/rebar_erlydtl_compiler.erl"},
                                   {line,208}]},
          {rebar_base_compiler,compile,3,
                               [{file,"src/rebar_base_compiler.erl"},
                                {line,121}]},
          {rebar_base_compiler,compile_worker,3,
                               [{file,"src/rebar_base_compiler.erl"},
                                {line,194}]}]}}
ERROR: compile failed while processing /Users/dialtone/dev/Adroll/dyno: rebar_abort
make: *** [all] Error 1

With this simple pull request you can compile erlydtl templates again.

@kaos
Copy link

kaos commented Feb 6, 2014

What arguments were passed to erlydtl in this case?

The only path I can see that results in {ok, Module} is when compiling a binary template (i.e. the template is verbatim rather than a file name).

We could add this case to not crash, but I suspect that the resulting template is not what you want, so that would actually only hide the real issue here.

I would like you to render the resulting template you get with this fix and tell me if you get what you expected.

I've been considering to update the erlydtl api so you can say if the argument indeed is a file or a verbatim template, instead of looking only for binary vs. list, which is rather silly.
Edit: added issue erlydtl/erlydtl#125 to keep track of this.

This relates to rebar/rebar#221.

@dialtone
Copy link
Author

dialtone commented Feb 6, 2014

Uhm, not sure what's a binary template. Currently the erlydtl_opts in rebar.config is {erlydtl_opts, [{source_ext, ".html"}]}. while the template itself is this: {{ function }}({"profiles": {{user_lists}} }); inside templates/profile.html. Any time I try to compile it fails but it actually compiled the file.

The rendered template looks normal.

@dialtone
Copy link
Author

Sooooo... Is this ever getting merged?

@kaos
Copy link

kaos commented Feb 13, 2014

Sorry, my bad. There is a good path leading to {ok, Module}, as you have observed.

This fix gets 👍 from me :)

@kaos
Copy link

kaos commented Feb 13, 2014

Ah, then again. Take a look at rebar_elrlydtl_compiler.erl from rebar/rebar. There are more changes to adapt to recent erlydtl changes. See rebar/rebar#210 and rebar/rebar#221.

With those changes applied, this fix is not needed.

Ps.
Why is there two active forks of rebar?

@kaos
Copy link

kaos commented Jul 18, 2015

Perhaps close this.. ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants