EexToHeex (eextoheex v0.1.3)

EexToHeex performs best effort conversion of html.eex templates to heex.

The output is not guaranteed to be correct. However, conversion works correctly for a sufficiently wide range of input templates that the amount of manual conversion work can be significantly reduced.

See https://github.com/phoenixframework/phoenix_live_view/blob/master/CHANGELOG.md#new-html-engine for information on the differences between eex and heex templates.

Link to this section Summary

Functions

Performs best effort conversion of an html.eex template to a heex template. Returns {:ok, output_string} if successful, or {:error, output_string, error} on error. In the latter case, output_string may be nil if the error occurred before any output was generated.

Performs best effort conversion of inline ~L templates to ~H templates. Returns {:ok, output_string} if successful, or {:error, output_string, error} on error. In the latter case, output_string may be nil if the error occurred before any output was generated.

Link to this section Functions

Link to this function

eex_to_heex(str)

Specs

eex_to_heex(String.t()) :: {:ok, String.t()} | {:error, String.t() | nil, any()}

Performs best effort conversion of an html.eex template to a heex template. Returns {:ok, output_string} if successful, or {:error, output_string, error} on error. In the latter case, output_string may be nil if the error occurred before any output was generated.

On success, the output is guaranteed to be a valid heex template (since it has passed successfully through HTMLEngine.compile). However, there is no general guarantee that the output template will have exactly the same behavior as the input template.

Link to this function

ex_to_heex(str)

Specs

ex_to_heex(String.t()) :: {:ok, String.t()} | {:error, String.t() | nil, any()}

Performs best effort conversion of inline ~L templates to ~H templates. Returns {:ok, output_string} if successful, or {:error, output_string, error} on error. In the latter case, output_string may be nil if the error occurred before any output was generated.

On success, the inline ~H templates are guaranteed to be valid, (since they've passed successfully through HTMLEngine.compile). However, there is no general guarantee that the output templates will have exactly the same behavior as the input templates.