chrismccord / phoenix_haml

Phoenix Template Engine for Haml
MIT License
158 stars 42 forks source link

form.html.haml:7: missing terminator: end (for "fn" starting at line 1) #34

Closed folsen closed 8 years ago

folsen commented 8 years ago

I generated a template for a model, it currently doesn't have any inputs, but the template doesn't compile.

The template looks like this

- form_for @changeset, @action, fn f ->
  - if @changeset.action do
    .alert.alert-danger
      %p
        Oops, something went wrong! Please check the errors below.
  .form-group
    = submit "Submit", class: "btn btn-primary"

And it generates this error message:

== Compilation error on file web/views/property_view.ex ==
** (TokenMissingError) web/templates/property/form.html.haml:7: missing terminator: end (for "fn" starting at line 1)
    (eex) lib/eex/compiler.ex:54: EEx.Compiler.generate_buffer/4
    (eex) lib/eex/compiler.ex:41: EEx.Compiler.generate_buffer/4
    (phoenix) lib/phoenix/template.ex:321: Phoenix.Template.compile/2
    (phoenix) lib/phoenix/template.ex:154: Phoenix.Template."-MACRO-__before_compile__/2-fun-0-"/3
    (elixir) lib/enum.ex:1473: Enum."-reduce/3-lists^foldl/2-0-"/3
    (phoenix) expanding macro: Phoenix.Template.__before_compile__/1
    web/views/property_view.ex:1:MyApp.PropertyView (module)
    (elixir) lib/kernel/parallel_compiler.ex:100: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compiler

I include the deps with reference directly to github repo:

{:phoenix_haml, github: "chrismccord/phoenix_haml"}
smpallen99 commented 8 years ago

The issue is due is very likely to the version of calliope published in hex. A new version if ready, but I don't yet have hex access to publish the new version. I'm waiting on the owner of calliope to come back from vacation to give me write access.

Add the following to your project's deps and it should work.

{:calliope, github: "nurugger07/calliope", override: true},

Let me know if that resolves your issue @folsen

smpallen99 commented 8 years ago

This has been fixed on calliope v0.4.0 which has just been published on hex. I just published phoenix_haml v0.2.1 with the updated calliope dep.