Commit graph

48 commits

Author SHA1 Message Date
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
dependabot[bot] 85eb81944e
Bump ex_doc from 0.29.0 to 0.29.1 (#191) 2022-11-22 08:13:45 -05:00
dependabot[bot] f6c4340c98
Bump floki from 0.33.1 to 0.34.0 (#189)
Bumps [floki](https://github.com/philss/floki) from 0.33.1 to 0.34.0.
- [Release notes](https://github.com/philss/floki/releases)
- [Changelog](https://github.com/philss/floki/blob/main/CHANGELOG.md)
- [Commits](https://github.com/philss/floki/compare/v0.33.1...v0.34.0)

---
updated-dependencies:
- dependency-name: floki
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-11 22:28:35 -05:00
dependabot[bot] 61aea98d9e
Bump ex_doc from 0.28.6 to 0.29.0 (#186)
Bumps [ex_doc](https://github.com/elixir-lang/ex_doc) from 0.28.6 to 0.29.0.
- [Release notes](https://github.com/elixir-lang/ex_doc/releases)
- [Changelog](https://github.com/elixir-lang/ex_doc/blob/main/CHANGELOG.md)
- [Commits](https://github.com/elixir-lang/ex_doc/compare/v0.28.6...v0.29.0)

---
updated-dependencies:
- dependency-name: ex_doc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-26 23:20:17 -04:00
dependabot[bot] d349b0992c
Bump ex_doc from 0.28.5 to 0.28.6 (#185)
Bumps [ex_doc](https://github.com/elixir-lang/ex_doc) from 0.28.5 to 0.28.6.
- [Release notes](https://github.com/elixir-lang/ex_doc/releases)
- [Changelog](https://github.com/elixir-lang/ex_doc/blob/main/CHANGELOG.md)
- [Commits](https://github.com/elixir-lang/ex_doc/compare/v0.28.5...v0.28.6)

---
updated-dependencies:
- dependency-name: ex_doc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-16 21:33:32 -04:00
Mitchell Hanberg 99cbb42962
SVG (#181)
This basically just adds svg elements as void and nonvoid element
aliases and it works, will test on a real proejct before releasing the
next release.

Also, fixed the weird behaviour problem by defining types for each of the ast
nodes and then referencing those types when defining the ast type.

Unclear why this works, but I imagine it has to do with the types not
being a big part of the compilation process or something.

This also uses the typed_struct library to do so. Seems pretty slick and
does what it claims it does.
2022-09-19 20:35:45 -04:00
dependabot[bot] f9ccfbc718
Bump ex_doc from 0.28.4 to 0.28.5 (#179)
Bumps [ex_doc](https://github.com/elixir-lang/ex_doc) from 0.28.4 to 0.28.5.
- [Release notes](https://github.com/elixir-lang/ex_doc/releases)
- [Changelog](https://github.com/elixir-lang/ex_doc/blob/v0.28.5/CHANGELOG.md)
- [Commits](https://github.com/elixir-lang/ex_doc/compare/v0.28.4...v0.28.5)

---
updated-dependencies:
- dependency-name: ex_doc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-11 22:41:28 -04:00
Mitchell Hanberg 2f042506b6
feat: Mix task to convert HTML into Temple (#180) 2022-09-11 22:39:31 -04:00
dependabot[bot] 21e3c7e3a2
Bump ex_doc from 0.28.3 to 0.28.4 (#178)
Bumps [ex_doc](https://github.com/elixir-lang/ex_doc) from 0.28.3 to 0.28.4.
- [Release notes](https://github.com/elixir-lang/ex_doc/releases)
- [Changelog](https://github.com/elixir-lang/ex_doc/blob/main/CHANGELOG.md)
- [Commits](https://github.com/elixir-lang/ex_doc/compare/v0.28.3...v0.28.4)

---
updated-dependencies:
- dependency-name: ex_doc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-19 13:15:59 -04:00
Mitchell Hanberg c8d3f446b0 Remove last remnants of Phoenix 2022-04-20 00:05:27 -04:00
Mitchell Hanberg f942817994
Utilize the EEx Engine instead of creating an EEx string (#177) 2022-04-19 23:56:46 -04:00
dependabot[bot] ece4cb8a26
Bump ex_doc from 0.24.2 to 0.28.3 (#174) 2022-03-23 08:44:44 -04:00
dependabot[bot] d8a19a20cc
Bump phoenix_live_view from 0.16.1 to 0.17.5 (#158)
Bumps [phoenix_live_view](https://github.com/phoenixframework/phoenix_live_view) from 0.16.1 to 0.17.5.
- [Release notes](https://github.com/phoenixframework/phoenix_live_view/releases)
- [Changelog](https://github.com/phoenixframework/phoenix_live_view/blob/master/CHANGELOG.md)
- [Commits](https://github.com/phoenixframework/phoenix_live_view/compare/v0.16.1...v0.17.5)

---
updated-dependencies:
- dependency-name: phoenix_live_view
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-22 08:54:13 -05:00
Mitchell Hanberg c6d29e592b Bump v0.8.0 2021-08-29 18:11:24 -04:00
dependabot-preview[bot] f79464dcde
Bump phoenix_live_view from 0.13.3 to 0.15.7 (#131)
Bumps [phoenix_live_view](https://github.com/phoenixframework/phoenix_live_view) from 0.13.3 to 0.15.7.
- [Release notes](https://github.com/phoenixframework/phoenix_live_view/releases)
- [Changelog](https://github.com/phoenixframework/phoenix_live_view/blob/v0.15.7/CHANGELOG.md)
- [Commits](https://github.com/phoenixframework/phoenix_live_view/compare/v0.13.3...v0.15.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-06-15 14:08:06 -04:00
Mitchell Hanberg 301963f06b Bump v0.6.0 2021-05-22 01:13:58 -04:00
Mitchell Hanberg ced2f6ab66 feat: New Component API 2021-01-02 13:22:03 -05:00
dependabot-preview[bot] 7d1c243623
Bump ex_doc from 0.22.1 to 0.22.6
Bumps [ex_doc](https://github.com/elixir-lang/ex_doc) from 0.22.1 to 0.22.6.
- [Release notes](https://github.com/elixir-lang/ex_doc/releases)
- [Changelog](https://github.com/elixir-lang/ex_doc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/elixir-lang/ex_doc/compare/v0.22.1...v0.22.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-17 10:36:23 +00:00
Mitchell Hanberg 265c413960 Allow element attrs to be evaluated at runtime
Before this change, only keyword list literals could be passed to
elements. If they had non-literals as values, then those would compile
to EEx expressions.

This allows a non-literal to be passed as attrs and have the entire thing
compile to an EEx expression, which will pass the non-literal to a
"runtime_attrs" function, which evaluates a keyword list into a safe
string.

That last part might need to be reworked if the user is not using
the Phoenix.HTML.Engine EEx Engine.
2020-08-09 10:07:27 -04:00
Mitchell Hanberg ecc34e084c Remove unused dep 2020-07-23 21:10:11 -04:00
Mitchell Hanberg 33c95186fb
Compile to EEx (#80)
Code is gross
2020-06-16 15:28:21 -04:00
dependabot-preview[bot] 1ebec6799a Bump ex_doc from 0.21.2 to 0.21.3 (#46)
Bumps [ex_doc](https://github.com/elixir-lang/ex_doc) from 0.21.2 to 0.21.3.
- [Release notes](https://github.com/elixir-lang/ex_doc/releases)
- [Changelog](https://github.com/elixir-lang/ex_doc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/elixir-lang/ex_doc/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-14 10:40:17 -04:00
dependabot-preview[bot] d09d0276c7 Bump phoenix_ecto from 4.0.0 to 4.1.0 (#32)
Bumps [phoenix_ecto](https://github.com/phoenixframework/phoenix_ecto) from 4.0.0 to 4.1.0.
- [Release notes](https://github.com/phoenixframework/phoenix_ecto/releases)
- [Changelog](https://github.com/phoenixframework/phoenix_ecto/blob/master/CHANGELOG.md)
- [Commits](https://github.com/phoenixframework/phoenix_ecto/compare/v4.0.0...v4.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-14 10:40:17 -04:00
dependabot-preview[bot] e379b46ffc Bump floki from 0.23.1 to 0.26.0 (#50)
Bumps [floki](https://github.com/philss/floki) from 0.23.1 to 0.26.0.
- [Release notes](https://github.com/philss/floki/releases)
- [Changelog](https://github.com/philss/floki/blob/master/CHANGELOG.md)
- [Commits](https://github.com/philss/floki/compare/v0.23.1...v0.26.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-14 10:40:17 -04:00
dependabot-preview[bot] 03ea32d215 Bump phoenix from 1.4.15 to 1.4.16 (#58)
Bumps [phoenix](https://github.com/phoenixframework/phoenix) from 1.4.15 to 1.4.16.
- [Release notes](https://github.com/phoenixframework/phoenix/releases)
- [Changelog](https://github.com/phoenixframework/phoenix/blob/v1.4.16/CHANGELOG.md)
- [Commits](https://github.com/phoenixframework/phoenix/compare/v1.4.15...v1.4.16)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-14 10:40:17 -04:00
dependabot-preview[bot] 4cdac12ef5 Bump phoenix_html from 2.13.3 to 2.14.1 (#62)
Bumps [phoenix_html](https://github.com/phoenixframework/phoenix_html) from 2.13.3 to 2.14.1.
- [Release notes](https://github.com/phoenixframework/phoenix_html/releases)
- [Changelog](https://github.com/phoenixframework/phoenix_html/blob/master/CHANGELOG.md)
- [Commits](https://github.com/phoenixframework/phoenix_html/compare/v2.13.3...v2.14.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-14 10:40:17 -04:00
dependabot-preview[bot] 77719210a1 Bump ecto from 3.2.1 to 3.4.0 (#65)
Bumps [ecto](https://github.com/elixir-ecto/ecto) from 3.2.1 to 3.4.0.
- [Release notes](https://github.com/elixir-ecto/ecto/releases)
- [Changelog](https://github.com/elixir-ecto/ecto/blob/master/CHANGELOG.md)
- [Commits](https://github.com/elixir-ecto/ecto/compare/v3.2.1...v3.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-14 10:40:17 -04:00
dependabot-preview[bot] 73c3c45f27 Bump phoenix from 1.4.10 to 1.4.15
Bumps [phoenix](https://github.com/phoenixframework/phoenix) from 1.4.10 to 1.4.15.
- [Release notes](https://github.com/phoenixframework/phoenix/releases)
- [Changelog](https://github.com/phoenixframework/phoenix/blob/v1.4.15/CHANGELOG.md)
- [Commits](https://github.com/phoenixframework/phoenix/compare/v1.4.10...v1.4.15)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-09 15:31:18 -04:00
dependabot-preview[bot] a9fc07bcc5 Bump html_sanitize_ex from 1.3.0 to 1.4.0 (#37)
Bumps [html_sanitize_ex](https://github.com/rrrene/html_sanitize_ex) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/rrrene/html_sanitize_ex/releases)
- [Changelog](https://github.com/rrrene/html_sanitize_ex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rrrene/html_sanitize_ex/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-07 23:53:11 -05:00
dependabot-preview[bot] 9aea707fcc Bump floki from 0.23.0 to 0.23.1 (#36)
Bumps [floki](https://github.com/philss/floki) from 0.23.0 to 0.23.1.
- [Release notes](https://github.com/philss/floki/releases)
- [Changelog](https://github.com/philss/floki/blob/master/CHANGELOG.md)
- [Commits](https://github.com/philss/floki/compare/v0.23.0...v0.23.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-02 13:33:11 -05:00
Shritesh d1fceaf75f Don't depend on floki in prod (#28)
* Set @preferred_cli_env for Convert Task to :dev

* Set floki dep to :dev and :test, bump nimble_parsec
2019-09-25 15:16:56 -04:00
dependabot-preview[bot] 0863d19e7d Bump ecto from 3.2.0 to 3.2.1 (#27)
Bumps [ecto](https://github.com/elixir-ecto/ecto) from 3.2.0 to 3.2.1.
- [Release notes](https://github.com/elixir-ecto/ecto/releases)
- [Changelog](https://github.com/elixir-ecto/ecto/blob/v3.2.1/CHANGELOG.md)
- [Commits](https://github.com/elixir-ecto/ecto/compare/v3.2.0...v3.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-19 21:20:40 -04:00
Mitchell Hanberg 5acd6fc079
Svg module (#25)
* Temple.Svg

- scopes update_mdn_task to the temple namespace
- introduces new temple.convert mix task to convert plain HTML and SVG to
  Temple syntax

* Rename Temple.Tags to Temple.Html

* Remove hackney

I'm not sure why it was even in there ¯\_(ツ)_/¯

* Update floki

* Document temple.convert in README
2019-09-13 21:36:16 -04:00
dependabot-preview[bot] 50c3bd93eb Bump phoenix from 1.4.9 to 1.4.10 (#23)
Bumps [phoenix](https://github.com/phoenixframework/phoenix) from 1.4.9 to 1.4.10.
- [Release notes](https://github.com/phoenixframework/phoenix/releases)
- [Changelog](https://github.com/phoenixframework/phoenix/blob/v1.4.10/CHANGELOG.md)
- [Commits](https://github.com/phoenixframework/phoenix/compare/v1.4.9...v1.4.10)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-09 15:46:24 -04:00
dependabot-preview[bot] 8d4d55ad10 Bump ecto from 3.1.7 to 3.2.0 (#24)
Bumps [ecto](https://github.com/elixir-ecto/ecto) from 3.1.7 to 3.2.0.
- [Release notes](https://github.com/elixir-ecto/ecto/releases)
- [Changelog](https://github.com/elixir-ecto/ecto/blob/master/CHANGELOG.md)
- [Commits](https://github.com/elixir-ecto/ecto/compare/v3.1.7...v3.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-09 09:50:44 -04:00
dependabot-preview[bot] eab538c1ca Bump ex_doc from 0.21.1 to 0.21.2 (#21)
Bumps [ex_doc](https://github.com/elixir-lang/ex_doc) from 0.21.1 to 0.21.2.
- [Release notes](https://github.com/elixir-lang/ex_doc/releases)
- [Changelog](https://github.com/elixir-lang/ex_doc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/elixir-lang/ex_doc/compare/v0.21.1...v0.21.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-08-30 07:36:18 -04:00
Mitchell Hanberg b01ec03362 Remove dialyzer
Temple is mostly macros ¯\_(ツ)_/¯. All dialyzer was doing was taking
forever on CI.
2019-08-27 22:22:56 -04:00
dependabot-preview[bot] 617e8e4e8f Bump plug from 1.8.2 to 1.8.3 (#9)
Bumps [plug](https://github.com/elixir-plug/plug) from 1.8.2 to 1.8.3.
- [Release notes](https://github.com/elixir-plug/plug/releases)
- [Changelog](https://github.com/elixir-plug/plug/blob/master/CHANGELOG.md)
- [Commits](https://github.com/elixir-plug/plug/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-08-17 10:00:49 -04:00
dependabot-preview[bot] 46d02646de
Bump ex_doc from 0.21.0 to 0.21.1
Bumps [ex_doc](https://github.com/elixir-lang/ex_doc) from 0.21.0 to 0.21.1.
- [Release notes](https://github.com/elixir-lang/ex_doc/releases)
- [Changelog](https://github.com/elixir-lang/ex_doc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/elixir-lang/ex_doc/compare/v0.21.0...v0.21.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-07-22 11:11:41 +00:00
dependabot-preview[bot] e359cdb47c
Bump ecto from 3.1.4 to 3.1.7
Bumps [ecto](https://github.com/elixir-ecto/ecto) from 3.1.4 to 3.1.7.
- [Release notes](https://github.com/elixir-ecto/ecto/releases)
- [Changelog](https://github.com/elixir-ecto/ecto/blob/v3.1.7/CHANGELOG.md)
- [Commits](https://github.com/elixir-ecto/ecto/compare/v3.1.4...v3.1.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-07-20 00:00:32 +00:00
Mitchell Hanberg 847f2d0ad7
Merge pull request #1 from mhanberg/dependabot/hex/phoenix-1.4.9
Bump phoenix from 1.4.3 to 1.4.9
2019-07-19 19:59:05 -04:00
dependabot-preview[bot] 9e0a31df25
Bump ex_doc from 0.20.2 to 0.21.0
Bumps [ex_doc](https://github.com/elixir-lang/ex_doc) from 0.20.2 to 0.21.0.
- [Release notes](https://github.com/elixir-lang/ex_doc/releases)
- [Changelog](https://github.com/elixir-lang/ex_doc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/elixir-lang/ex_doc/compare/v0.20.2...v0.21.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-07-17 11:35:41 +00:00
dependabot-preview[bot] 51c9a674fe
Bump phoenix from 1.4.3 to 1.4.9
Bumps [phoenix](https://github.com/phoenixframework/phoenix) from 1.4.3 to 1.4.9.
- [Release notes](https://github.com/phoenixframework/phoenix/releases)
- [Changelog](https://github.com/phoenixframework/phoenix/blob/v1.4.9/CHANGELOG.md)
- [Commits](https://github.com/phoenixframework/phoenix/compare/v1.4.3...v1.4.9)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-07-12 19:49:18 +00:00
dependabot-preview[bot] beb5f1f8fa
Bump phoenix_html from 2.13.2 to 2.13.3
Bumps [phoenix_html](https://github.com/phoenixframework/phoenix_html) from 2.13.2 to 2.13.3.
- [Release notes](https://github.com/phoenixframework/phoenix_html/releases)
- [Changelog](https://github.com/phoenixframework/phoenix_html/blob/master/CHANGELOG.md)
- [Commits](https://github.com/phoenixframework/phoenix_html/compare/v2.13.2...v2.13.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-07-08 01:36:11 +00:00
Mitchell Hanberg 6b55fc7665 Implement remaining from helpers 2019-06-01 00:02:49 -04:00
Mitchell Hanberg b62ad6fd97 Install ex_docs 2019-05-08 22:06:44 -04:00
Mitchell Hanberg 6c6bd8dd3b Phoenix template engine 2019-04-28 22:25:57 -04:00
Mitchell Hanberg 115f148864 Initial commit 2019-04-14 21:44:39 -04:00