CrowdHailer / eex_html

Extension to Embedded Elixir (EEx), that allows content to be safely embedded into HTML.
https://hex.pm/packages/eex_html
Apache License 2.0
3 stars 5 forks source link

Unexpected EEx.Engine state #10

Closed HarshBalyan closed 6 months ago

HarshBalyan commented 6 months ago

I am trying to update elixir from 1.7.4 to 1.16.2. I am running into a compilation error.

Compilation error in file lib/myapp/api/actions/support/some_action.ex ==
** (RuntimeError) unexpected EEx.Engine state: {{:., [], [{:__aliases__, [alias: false], [:EExHTML]}, :raw]}, [], [[]]}. This typically means a bug or an outdated EEx.Engine or tool
    (eex 1.16.2) lib/eex/engine.ex:218: EEx.Engine.check_state!/1
    (eex 1.16.2) lib/eex/engine.ex:181: EEx.Engine.handle_text/3
    (eex 1.16.2) lib/eex/compiler.ex:321: EEx.Compiler.generate_buffer/4
    (raxx_view 0.1.7) expanding macro: Raxx.View.__using__/1
    lib/myapp/api/actions/support/some_action:6: SomeAction (module)
    (elixir 1.16.2) expanding macro: Kernel.use/2
    lib/myapp/api/actions/support/some_action.ex:6: SomeAction (module)
    expanding macro: MyApp.API.SupportLayout.__using__/1

I have an action like

def SomeAction
  ...
    use MyApp.API.SupportLayout,
    arguments: [:transaction],
    template: Path.join(__DIR__, "transaction.html.eex")

...
end

Support Layout

defmodule MyApp.API.SupportLayout do
  use Raxx.View.Layout,
    optional: [
      page_title: "Admin",
      with_navbar: true,
      message: nil,
      message_type: "info"
    ]
end

EEx.Engine.check_state!/1 expects %{binary: _, dynamic: _, vars_count: _} which was added in Elixir v1.8. EExHTML.Engine.init/1 doesn't set any of these params.

HarshBalyan commented 6 months ago

Not sure if it's the best way but I've made it work for myself after making these changes. Let me know if it's good to go, I'll raise a PR. @CrowdHailer @ejc123

CrowdHailer commented 6 months ago

I'm not actively maintaining this. But if you open a PR I'll try and look over it

HarshBalyan commented 6 months ago

@CrowdHailer please, take a look at #11