Commit graph

18 commits

Author SHA1 Message Date
Mitchell Hanberg
8a9e06448b
ci: release please (#203) 2023-06-12 23:17:40 -04:00
Mitchell Hanberg
07c82e21d3
Dynamic Attributes (#190)
* Move directories for ast tests to match convention

* feat!: Rename `:let` to `:let!`

We use the "bang" style as the reserved keyword to differentiate it from
other possible attributes.

* feat: use Phoenix.HTML as the default engine

I am choosing to leverage this library in order to quickly get dynamic
attributes (see #183) up and running.

This also ensures that folks who wish to use Temple outside of a Phoenix
project with get some nice HTML functions as well as properly escaped
HTML out of the box.

This can be made optional if Temple becomes decoupled from the render
and it including HTML specific packages becomes a strange.

* feat: Allow user to make their own Component module

The component module is essentially to defer compiling functions that the
user might not need. The component, render_slot, and inner_block functions
are only mean to be used when there isn't another implementation.

In the case of a LiveView application, LiveView is providing the
component runtime implementation. This was causing some compile time
warnings for temple, because it was using the LiveView engine at compile
time (for Temple, not the user's application) and LiveView hadn't been
compiled or loaded.

So, now we defer this to the user to make their own module and import it
where necessary.

* feat: Pass dynamic attributes with the :rest! attribute

The :rest! attribute can be used to pass in a dynamic list of attributes
to be mixed into the static ones at runtime.

Since this cannot be properly escaped by any engine, we have to mark it
as safe and then allow the function to escape it for us. I decided to
leverage the `attributes_escape/1` function from `phoenix_html`. There
isn't really any point in making my own version of this or vendoring it.

Now you can also pass a variable as the attributes as well if you only
want to pass through attributes from a calling component.

The :rest! attribute also works with components, allowing you to pass
a dynamic list of args into them.

Fixes #183

* Move test components to their own file.

* docs(components): Update documentation on Temple.Components

* docs(guides): Mention attributes_escape/1 function in the guides

* chore(test): Move helper to it's own module

* feat: rest! support for slots

* docs(guides): Dynamic attributes

* ci: downgrade runs-on to support OTP 23
2023-01-21 06:44:29 -05:00
Mitchell Hanberg
2f042506b6
feat: Mix task to convert HTML into Temple (#180) 2022-09-11 22:39:31 -04:00
Mitchell Hanberg
f942817994
Utilize the EEx Engine instead of creating an EEx string (#177) 2022-04-19 23:56:46 -04:00
Mitchell Hanberg
9b4dc26a5d Update elixir/erlang versions in CI workflow 2021-08-29 18:17:55 -04:00
Mitchell Hanberg
5150a93e38 emit live view compatible component and slot markup
- requires the development branch of live_view currently, if you are
  going to be using live view

ci

Docs

Raise minimum elixir version to 1.9

There is some bug in EEx that was fixed in 1.9 and I can't be bothered
to make it backwards compatible with the bug.

ugh

Remove commented out line
2021-05-13 00:21:43 -04:00
Mitchell Hanberg
73b6973a74 Boost minimum tested version to 1.9
Add erlang 22
2021-05-13 00:21:43 -04:00
Mitchell Hanberg
b35b9b6d91 Rename a dir and shrink the test matrix 2021-04-09 00:16:30 -04:00
Mitchell Hanberg
7aba19a87d Update the setup elixir action for github action 2021-04-09 00:16:30 -04:00
Mitchell Hanberg
e97302149b rename default branch 2021-01-02 13:34:19 -05:00
Mitchell Hanberg
c35307cb66 ci: Bump min elixir version on ci for int. tests 2021-01-02 13:33:14 -05:00
Mitchell Hanberg
271567dc8f
Update ci.yml 2020-12-06 22:59:58 -05:00
Mitchell Hanberg
bde40756ee
Update ci.yml 2020-12-06 22:58:10 -05:00
Mitchell Hanberg
8e872e619b Retry integration tests up to 2 more times 2020-07-23 21:17:11 -04:00
Mitchell Hanberg
33c95186fb
Compile to EEx (#80)
Code is gross
2020-06-16 15:28:21 -04:00
Mitchell Hanberg
67fde9d2d7 Update setup-elixir action 2020-04-14 10:40:12 -04:00
Mitchell Hanberg
e38e05bc4b Add Elixir 1.10 to matrix 2020-04-14 10:40:09 -04:00
Mitchell Hanberg
1d71c27a34
Handle HTML fragments in temple.convert task (#35)
* Handle HTML fragments in temple.convert task

* Add GH CI action

* Remove travis config
2019-11-22 22:48:20 -05:00