Mitchell Hanberg
59e64dce3b
Parser abstraction
...
This implements a Temple.Parser behavior. This contracts requires a
`applicable/1` and `run/2` functions to be defined.
`applicable/1` is passed the unparsed AST, and returns true or false
as to whether this parser module should be run.
`run/2` is passed the unparsed AST as well as the buffer. It should add
parsed markup to the buffer.
The function either returns `:ok` if the AST is done, or
`{:component_applied, ast}`. If the latter is returned, the parser pass
starts over with the return ast.
2020-07-23 20:59:10 -04:00
Mitchell Hanberg
7bf649c4b5
Correctly parse do blocks
...
Did not correctly parse expressions with do blocks
where the expression had two or more arguments before
the block.
2020-07-22 21:34:50 -04:00
Mitchell Hanberg
2206aa62fe
Bump v0.6.0-alpha.4
2020-07-16 00:21:25 -04:00
Mitchell Hanberg
f5ad95642a
Only split args when list is a keyword list
2020-07-16 00:19:57 -04:00
Mitchell Hanberg
bd403a2037
Bump v0.6.0-alpha-3
2020-07-15 23:23:41 -04:00
Mitchell Hanberg
1f599f5f6d
Handle expressions with do blocks that aren't if/unless/for
2020-07-15 23:23:12 -04:00
Mitchell Hanberg
3c787297e5
Update README
2020-07-15 22:47:23 -04:00
Mitchell Hanberg
1b02dc86db
Bump v0.6.0-alpha.2
2020-07-15 22:42:45 -04:00
Mitchell Hanberg
3da6d275a6
Merge pull request #86 from mhanberg/0-6-components
...
Components API
2020-07-15 22:41:25 -04:00
Mitchell Hanberg
a2917d3bae
Update changelog
2020-07-15 22:40:46 -04:00
Mitchell Hanberg
292c91538b
Update README
2020-07-15 22:32:27 -04:00
Mitchell Hanberg
1a5837d1b7
Components API
...
Components work very similarly to how they worked before, but with a few
differences.
To define a component, you can create a file in your configured temple
components directory, which defaults to `lib/components`. You would
probably want ot change that to be `lib/my_app_web/components` if you
are building a phoenix app.
This file should be of the `.exs` extension, and contain any temple
compatible code.
You can then use this component in any other temple template.
For example, if I were to define a `flex` component, I would create a
file called `lib/my_app_web/components/flex.exs`, with the following
contents.
```elixir
div class: "flex #{@temple[:class]}", id: @id do
@children
end
```
And we could use the component like so
```elixir
flex class: "justify-between items-center", id: "arnold" do
div do: "Hi"
div do: "I'm"
div do: "Arnold"
div do: "Schwarzenegger"
end
```
We've demonstated several features to components in this example.
We can pass assigns to our component, and access them just like we would
in a normal phoenix template. If they don't match up with any assigns we
passed to our component, they will be rendered as-is, and will become a
normal Phoenix assign.
You can also access a special `@temple` assign. This allows you do
optionally pass an assign, and not have the `@my_assign` pass through.
If you didn't pass it to your component, it will evaluate to nil.
The block passed to your component can be accessed as `@children`. This
allows your components to wrap a body of markup from the call site.
In order for components to trigger a recompile when they are changed,
you can call `use Temple.Recompiler` in your `lib/my_app_web.ex` file,
in the `view`, `live_view`, and `live_component` functions
```elixir
def view do
quote do
# ...
use Temple.Recompiler
# ...
end
end
```
2020-07-15 22:32:27 -04:00
Mitchell Hanberg
f8f1ec623f
Plugin architecture for parsers
2020-07-15 22:32:27 -04:00
zimt28
3d620c7b07
Update Readme ( #83 )
...
- Updates version in installation instructions
- Adds `lexs` extension to the live reload and formatter configs
2020-07-14 10:03:42 -04:00
Mitchell Hanberg
edb023fd9a
Bump v0.6.0-alpha.1
2020-06-30 20:48:08 -04:00
Mitchell Hanberg
4498eabedb
Context/LiveView generator
2020-06-30 20:43:04 -04:00
Shritesh Bhattarai
a3ec57344a
Fix LiveView engine instruction ( #82 )
2020-06-16 17:36:12 -04:00
Mitchell Hanberg
853253bc4a
Fix README example
2020-06-16 15:52:59 -04:00
Mitchell Hanberg
33c95186fb
Compile to EEx ( #80 )
...
Code is gross
2020-06-16 15:28:21 -04:00
Mitchell Hanberg
43bd75056f
Add sponsor button
2020-05-16 20:24:47 -04:00
Romain Bertrand
c580d4e2fb
Suggest 0.5.0 in README ( #76 )
2020-05-14 16:04:15 -04:00
Mitchell Hanberg
1ba5d1b88f
Update README
2020-04-21 11:24:39 -04:00
Mitchell Hanberg
25284988bb
Bump v0.5.0
2020-04-14 10:40:19 -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
Mitchell Hanberg
764818bf7c
Update .tool-versions
2020-04-14 10:40:15 -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
3993c798c0
Join markup with a new line
...
Text nodes separated by new lines still show whitespace when rendered,
so we should maintain user specified new lines.
Closes #59
Closes #60
2020-04-14 10:40:05 -04:00
Mitchell Hanberg
1093a4d602
Rename props
to assigns
...
This helps stay consistent with the Phoenix nomenclature.
2020-04-14 10:40:01 -04:00
zimt28
fa41e73bb0
Add @props access to components ( #66 )
...
* Add @props access to components
* Document `@props` assign
2020-04-14 10:40:00 -04:00
Mitchell Hanberg
916a9469d6
Remove mdn docs
...
They became broken at some point, and are probably not too useful
anyway. We can bring them back in the future.
2020-04-14 10:39:58 -04:00
Mitchell Hanberg
7376ce5d34
Bump v0.4.4
2020-04-14 10:39:47 -04:00
Michał Łępicki
997b62b9f4
Remove unnecessary dependency on Plug ( #61 )
...
The plug dependency is not needed since Phoenix provides it.
2020-03-19 11:02:08 -04:00
GarlandCrow
7d1e436ac6
Update README with Phoenix live-reload config change ( #57 )
...
Co-authored-by: Mitchell Hanberg <mitch@mitchellhanberg.com>
2020-03-18 19:35:34 -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
Mitchell Hanberg
fb0359fa8c
Bump v0.4.3
2020-01-07 23:49:51 -05:00
Adam Rutkowski
3e3f4480fa
Ensure optional Phoenix is optional ( #39 )
2020-01-07 23:44:39 -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
Mitchell Hanberg
71bddc6346
Bump v0.4.2
2019-11-22 22:55:57 -05:00
Mitchell Hanberg
d8e17c54bb
Fix readme CI badge
2019-11-22 22:52:16 -05: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
Mitchell Hanberg
d2e8a45094
Bump v0.4.1
2019-09-25 19:23:00 -04: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