Skip to content

Commit

Permalink
prepare for v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bunopnu committed Sep 27, 2023
1 parent fc9eca2 commit 02fb90b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ This changelog documents all noteworthy changes in the project. The format adher

## Next

## v0.3.0 - 27th September 2023

### Changed

- Renamed the old `render/1` function to `render_html/1` for clarity in naming.
- Introduced a new `render/1` function that returns HTML without the DOCTYPE declaration for flexibility in usage.

## v0.2.0 - 26th September 2023

### Added
Expand Down
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ Package can be installed by adding `e2h` to your list of dependencies:
### Rebar3

```erlang
{deps, [{e2h, "0.2.0"}]}.
{deps, [{e2h, "0.3.0"}]}.
```

### Mix

```elixir
defp deps do
[{:e2h, "~> 0.2.0"}]
[{:e2h, "~> 0.3.0"}]
end
```

Expand All @@ -33,22 +33,29 @@ end
```erlang
UserStatus = <<"busy">>,
UserProfileImage = <<"https://example.com/image.jpeg">>,
UserName = <<"adam">>,
UserBio = <<"some nonsense">>,
UserName = <<"joe">>,
UserJob = <<"data scientist">>,

Document = [
{'div', [{class, <<"user">>}, {status, UserStatus}], [
{img, [{href, UserProfileImage}]},
{'div', [], [
{h1, [], [UserName]},
{p, [], [UserBio]}
{p, [], [UserJob]}
]}
]}
],

e2h:render(Document).
% <!DOCTYPE html>
% <div class="user" status="busy"><img href="https://example.com/image.jpeg" /><div><h1>adam</h1><p>some nonsense</p></div></div>
% (output is manually formatted for readme)
%
% <div class="user" status="busy">
% <img href="https://example.com/image.jpeg" />
% <div>
% <h1>joe</h1>
% <p>data scientist</p>
% </div>
% </div>
```

## Documentation
Expand Down
2 changes: 1 addition & 1 deletion src/e2h.app.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{application, e2h, [
{description, "HTML generator for Erlang ecosystem"},
{vsn, "0.2.0"},
{vsn, "0.3.0"},
{registered, []},
{applications, [
kernel,
Expand Down
10 changes: 7 additions & 3 deletions test/e2h_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ simple_render_test() ->
]}
],

Rendered = e2h:render(Elements),
Expected =
Rendered1 = e2h:render(Elements),
Expected1 =
<<"<div class=\"test\"><h1>Hello, World!</h1><img src=\"https://example.com/image.png\" /></div>">>,
?assertEqual(Expected, Rendered).
?assertEqual(Expected1, Rendered1),

Rendered2 = e2h:render_html(Elements),
Expected2 = <<"<!DOCTYPE html>\n", Expected1/binary>>,
?assertEqual(Expected2, Rendered2).

0 comments on commit 02fb90b

Please # to comment.