diff --git a/CHANGELOG.md b/CHANGELOG.md index 6309688..ee84e10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ This changelog documents all noteworthy changes in the project. The format adher ## Next +## v0.2.0 - 26th September 2023 + +### Added + +- Allow passing atom for attributes and tags. + ## v0.1.1 - 26th September 2023 ### Added diff --git a/README.md b/README.md index aafe06e..c5307ee 100644 --- a/README.md +++ b/README.md @@ -17,17 +17,40 @@ Package can be installed by adding `e2h` to your list of dependencies: ### Rebar3 ```erlang -{deps, [{e2h, "0.1.1"}]}. +{deps, [{e2h, "0.2.0"}]}. ``` ### Mix ```elixir defp deps do - [{:e2h, "~> 0.1.1"}] + [{:e2h, "~> 0.2.0"}] end ``` +## Example + +```erlang +UserStatus = <<"busy">>, +UserProfileImage = <<"https://example.com/image.jpeg">>, +UserName = <<"adam">>, +UserBio = <<"some nonsense">>, + +Document = [ + {'div', [{class, <<"user">>}, {status, UserStatus}], [ + {img, [{href, UserProfileImage}]}, + {'div', [], [ + {h1, [], [UserName]}, + {p, [], [UserBio]} + ]} + ]} +], + +e2h:render(Document). +% +%

adam

some nonsense

+``` + ## Documentation Please consult the [HexDocs](https://hexdocs.pm/e2h) for documentation. diff --git a/src/e2h.app.src b/src/e2h.app.src index 47a81fc..9716901 100644 --- a/src/e2h.app.src +++ b/src/e2h.app.src @@ -1,6 +1,6 @@ {application, e2h, [ {description, "HTML generator for Erlang ecosystem"}, - {vsn, "0.1.1"}, + {vsn, "0.2.0"}, {registered, []}, {applications, [ kernel, diff --git a/src/e2h.erl b/src/e2h.erl index 2a2ca38..912fb5f 100644 --- a/src/e2h.erl +++ b/src/e2h.erl @@ -10,7 +10,7 @@ -module(e2h). -export([render/1, escape/1]). --export_type([attributes/0, elements/0]). +-export_type([key/0, attributes/0, elements/0]). %%%============================================================================= %%% Public types @@ -25,7 +25,7 @@ %% == Example == %% %% ``` -%% Attributes = [{<<"class">>, <<"container">>}, {<<"id">>, <<"my-element">>}]. +%% Attributes = [{class, <<"container">>}, {<<"id">>, <<"my-element">>}]. %% % Represents attributes like: class="container" id="my-element" %% ''' %%