Commit graph

40 commits

Author SHA1 Message Date
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
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
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
Mitchell Hanberg
ac56c3cc81 Improve tests for submit, phx_button, and phx_label 2019-08-27 21:57:41 -04:00
Shritesh
dbb26a6d58 Fix phx_link, phx_button, submit, phx_label markup (#20)
The tests for phx_link were not testing the correct behavior, which is how this slipped by.
2019-08-27 21:51:10 -04:00
Mitchell Hanberg
74e7f3a25e defelement macro
- add location: :keep to all calls to quote
2019-08-20 23:13:10 -04:00
Mitchell Hanberg
b0a7f9da11 Extract helper module for creating elements
Also removes illegal `html` macros, which allows use to only define one
clause and remove some tests.
2019-08-20 21:01:07 -04:00
AJ Harrington
f3aabf8f59 Updated html macro to put a <!DOCTYPE html> before the <html /> tag (#18)
Removed html from the list of nonvoid tags.  Implemented specifically
so the doctype declaration can be put in.  Not sure if this or adding
an if block to check the tag was a better solution.

Added tests for the html macro to the tests since it would no longer
show up in nonvoid_elements list.

mix test passes
2019-08-19 19:53:17 -04:00
Shritesh Bhattarai
43f10cd0de Add radio_button (#14) 2019-08-13 11:04:14 -04:00
Mitchell Hanberg
eb0fde6e83
Don't recursively call generated component macros (#12)
Recursively calling the macros works fine if you `import` the whole
module wherever you are using your components, but not if you `require`
the module.

This is because importing brings in the all the macros into the callers
namespace, which allows them to be called just by the macro name. When
you `require` the module, it will look for the generated 2-arity macro
in the callers namespace, which probably doesn't exist.

We get around this by not recursively calling them and avoiding the
problem all togther. A few utility functions solves the original issue
of wanting to DRY the file.
2019-08-10 01:09:24 -04:00
Mitchell Hanberg
0521aa2aad Escape content passed to single arity tags 2019-08-07 21:08:16 -04:00
Mitchell Hanberg
7ad4b0e941 Rename Temple.htm to Temple.temple 2019-07-08 22:29:41 -04:00
Mitchell Hanberg
d210d3bff5 Extract safe result from hidden fields within inputs_for/4
Also switches to using `with` instead of `lexical_scoping` because it is
more idiomatic.
2019-07-07 22:26:32 -04:00
Mitchell Hanberg
eabe9cdd9b Fix collision of Temple.textarea and Phoenix.HTML.Form.textarea 2019-07-04 11:21:54 -04:00
Mitchell Hanberg
8daf85fdb3 Allow defcomponent to work with runtime values for assigns
Also allows tags and defcomponents to accept maps in addition to keyword
lists
2019-07-04 00:16:29 -04:00
Mitchell Hanberg
9278f7fb4e Rename to Temple 2019-07-01 22:48:51 -04:00
Mitchell Hanberg
dd8edc025d Add wrappe for Phoenix.Form.submit 2019-07-01 00:25:33 -04:00
Mitchell Hanberg
a372a64858 Fix block style phx_link macros 2019-07-01 00:25:13 -04:00
Mitchell Hanberg
52a27c3dc2 Fix phx_link, phx_button block style implementation 2019-06-30 14:28:44 -04:00
Mitchell Hanberg
1cb522d440 Wrap Phoenix.HTML.Link module 2019-06-29 18:14:05 -04:00
Mitchell Hanberg
6b55fc7665 Implement remaining from helpers 2019-06-01 00:02:49 -04:00
Mitchell Hanberg
3a435b1727 Move form tests to the proper test file 2019-05-11 23:30:16 -04:00
Mitchell Hanberg
c4ebf81b6b Move component tests to the proper test file 2019-05-11 23:28:26 -04:00
Mitchell Hanberg
4cdc0de71b extract test component module to a support file 2019-05-11 23:25:57 -04:00
Mitchell Hanberg
72cd90cef3 Utils tests 2019-05-11 23:10:55 -04:00
Mitchell Hanberg
71e6c91c8f Extract Form module and rename Html module to Tags 2019-05-10 15:56:09 -04:00
Mitchell Hanberg
06cbdd80ff form_for and text_input macros 2019-05-10 15:06:03 -04:00
Mitchell Hanberg
0ad883dfcb Add formatter config for locals_without_parens 2019-05-08 03:47:43 -04:00
Mitchell Hanberg
d81029c9be Enable passing content or attrs as variables
Before, the guards in the macro definitions would only work for content
or attributes that were passed in as literals.
2019-05-08 03:31:13 -04:00
Mitchell Hanberg
d6ed780949 Allow passing content as first arg instead of block 2019-04-27 11:46:02 -04:00
Mitchell Hanberg
53ede43000 Compile attrs at runtime to enable interpolation 2019-04-27 11:45:20 -04:00
Mitchell Hanberg
48c5eacf25 Rename component to defcomponent 2019-04-27 11:44:08 -04:00
Mitchell Hanberg
e1c54ff09d Output htm output as raw
This should probably be moved to the phoenix engine once that is started
2019-04-27 11:24:17 -04:00
Mitchell Hanberg
cada669071 Allow Components to take props + other stuff
- Don't allow htm to take safe option
- Always escape calls to `text`
2019-04-26 16:59:43 -04:00
Mitchell Hanberg
8e1ae6cf11 Rename deftag to component 2019-04-15 18:37:13 -04:00
Mitchell Hanberg
2727d346b6 Clean up deftag generated macros 2019-04-14 22:36:16 -04:00
Mitchell Hanberg
85d6b8586f Fix using macro for entry module 2019-04-14 22:35:42 -04:00
Mitchell Hanberg
115f148864 Initial commit 2019-04-14 21:44:39 -04:00