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

compile_dir/2,3 produces modules with incorrect output #148

Closed
acammack opened this issue Mar 11, 2014 · 2 comments
Closed

compile_dir/2,3 produces modules with incorrect output #148

acammack opened this issue Mar 11, 2014 · 2 comments
Assignees
Labels
Milestone

Comments

@acammack
Copy link

Modules produced with compile_dir/2.3 return {ok, iolist()}, making them incompatible with the custom_tags_modules option. This occurs on the latest master, but not stable.

$ cat helpers/broken
This helper is broken

$ cat foo.dtl
{% broken %}

$ erl -pa ebin/ deps/erlydtl/ebin/ deps/erlydtl/deps/merl/ebin/
Erlang/OTP 17 [RELEASE CANDIDATE 2] [erts-6.0] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V6.0  (abort with ^G)
1> erlydtl:compile_dir("helpers/", helpers, [{out_dir, "ebin/"}]).
{ok,helpers}
2> erlydtl:compile("foo.dtl", foo, [{out_dir, "ebin/"}, {custom_tags_modules, [helpers]}]).
{ok,foo}
3> foo:render([]).
{ok,[<<"{ok,[<<\"This helper is broken\\n\">>]}">>,
     <<"\n">>]}

@kaos kaos added the compiler label Mar 11, 2014
@kaos kaos added this to the 0.9.2 milestone Mar 11, 2014
@kaos kaos self-assigned this Mar 11, 2014
@kaos
Copy link
Member

kaos commented Mar 11, 2014

Ah, so that was the reason for having compile_dir templates behave differently from that of regular templates. (this change was introduced in commit 0b61b69).

I'll look at how to best resolve this.

@kaos kaos closed this as completed in 73bd19d Mar 11, 2014
kaos added a commit that referenced this issue Mar 11, 2014
The backward incompatible change introduced in commit
0b61b69 is reverted, and instead a
new `render` function is added for those who wish to get the tagged
result tuple `{ok, iolist()} | {error, Reason}`.
@acammack
Copy link
Author

Thanks! This works like a charm.

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

No branches or pull requests

2 participants