Arizona - a web framework for Erlang/OTP

I have tried with this sys.config and view, and I get this error:

> rebar3 compile
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling qq
===> Compiling src/home_view.erl failed
src/home_view.erl:none: error in parse transform 'arizona_parse_transform':
exception error: Failed to convert Erlang terms to template in home_view at line 20:
error:function_clause:[{arizona_erl,children_ast_to_html,
                           [{bin,
                                {24,29},
                                [{bin_element,
                                     {24,30},
                                     {string,{24,30},"Arizona Hello World"},
                                     default,
                                     [utf8]}]}],
                           [{file,
                                "/home/carloratm/w/qq/_build/default/lib/arizona/src/arizona_erl.erl"},
                            {line,249}]},
                       {arizona_erl,element_ast_to_html,1,
                           [{file,
                                "/home/carloratm/w/qq/_build/default/lib/arizona/src/arizona_erl.erl"},
                            {line,185}]},
                       {arizona_erl,children_ast_to_html,1,
                           [{file,
                                "/home/carloratm/w/qq/_build/default/lib/arizona/src/arizona_erl.erl"},
                            {line,252}]},
                       {arizona_erl,element_ast_to_html,1,
                           [{file,
                                "/home/carloratm/w/qq/_build/default/lib/arizona/src/arizona_erl.erl"},
                            {line,185}]},
                       {arizona_erl,children_ast_to_html,1,
                           [{file,
                                "/home/carloratm/w/qq/_build/default/lib/arizona/src/arizona_erl.erl"},
                            {line,252}]},
                       {arizona_erl,element_ast_to_html,1,
                           [{file,
                                "/home/carloratm/w/qq/_build/default/lib/arizona/src/arizona_erl.erl"},
                            {line,185}]},
                       {arizona_erl,'-ast_to_html/1-lc$^0/1-0-',1,
                           [{file,
                                "/home/carloratm/w/qq/_build/default/lib/arizona/src/arizona_erl.erl"},
                            {line,94}]},
                       {arizona_erl,'-ast_to_html/1-lc$^0/1-0-',1,
                           [{file,
                                "/home/carloratm/w/qq/_build/default/lib/arizona/src/arizona_erl.erl"},
                            {line,94}]}]
  in function  arizona_parse_transform:transform_from_erl/4 (/home/carloratm/w/qq/_build/default/lib/arizona/src/arizona_parse_transform.erl:549)
     *** Arizona Erlang term template parsing failed
  in call from erl_syntax_lib:'-map/2-lc$^1/1-1-'/2 (erl_syntax_lib.erl:86)
  in call from erl_syntax_lib:'-map/2-lc$^0/1-0-'/2 (erl_syntax_lib.erl:86)
  in call from erl_syntax_lib:'-map/2-lc$^0/1-0-'/2 (erl_syntax_lib.erl:87)
  in call from erl_syntax_lib:map/2 (erl_syntax_lib.erl:87)
  in call from erl_syntax_lib:'-map/2-lc$^1/1-1-'/2 (erl_syntax_lib.erl:86)
  in call from erl_syntax_lib:'-map/2-lc$^0/1-0-'/2 (erl_syntax_lib.erl:86)
  in call from erl_syntax_lib:'-map/2-lc$^0/1-0-'/2 (erl_syntax_lib.erl:87)

I’m on erlang 28.1

Ensure you have the most up-to-date Arizona code. Run rebar3 unlock arizona && rebar3 upgrade arizona. I made some fixes hours ago. I’m on my phone, so I’m currently unable to check your issue.

Yeah that was it. Will play with the framework next week.
Expect more feedback.

1 Like

I almost forgot. Thanks for the tip, @hokan! And that’s what I ended up doing:

IMHO, much better! And gives many more possibilities for improvement. Thanks again!

I went through some of the examples provided, it’s very nice indeed!

Some random thoughts, please take those as random thoughts after 1 day of usage:

  1. I tried the rebar plugin to bootstrap a project using the interactive prompt, and if you press a q when asked for the name, it quits. I am not sure that’s a useful tool though, seems very javascript-esque
  2. May be possible to have some kind of facade module to shorten the function calls? Something like az:template_erl instead of arizona_template:from_erl?
  3. Could be possible to load a template from a file instead of a string?
  4. I saw there’s a neovim plugin, does it support vim as well?

Cheers!

1 Like

Thanks!

I need first to sync it with the latest Arizona breaking changes, then I can take a look at the q bug.

Indeed, the plugin needs improvement. Currently, it’s just a template bootstraping, but I have more ideas for it.

Yes! That’s something I want to explore. I need to polish the API first to figure out what the best approach would be.

Yes, but only for HTML and Markdown:

% HTML
arizona_template:from_html({file, "templates/user.html"})
arizona_template:from_html({priv_file, myapp, "templates/user.html"})

% Markdown
arizona_template:from_markdown({file, "content/blog-post.md"})
arizona_template:from_markdown({priv_file, myapp, "content/blog-post.md"})

No, unfortunately. The Neovim plugin is specifically for Neovim’s Lua API.

Thanks again for trying out Arizona! I’ll be waiting for more feedback :smiley: