From 8da9f43a23e774dfe4b6e4a1d66de4f8c604acb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius?= Date: Tue, 7 Nov 2023 06:24:09 -0300 Subject: [PATCH] Fix typo in function name --- lib/mix/tasks/simple_blog/compile.ex | 4 ++-- lib/simple_blog/converter/page.ex | 8 ++++---- lib/simple_blog/server.ex | 4 ++-- test/simple_blog/converter/page_test.exs | 14 +++++++------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/mix/tasks/simple_blog/compile.ex b/lib/mix/tasks/simple_blog/compile.ex index ba13330..8283334 100644 --- a/lib/mix/tasks/simple_blog/compile.ex +++ b/lib/mix/tasks/simple_blog/compile.ex @@ -26,7 +26,7 @@ defmodule Mix.Tasks.SimpleBlog.Compile do index_html = File.read(root_directory <> "/index.html.eex") - |> SimpleBlog.Converter.Page.exx_to_html(posts) + |> SimpleBlog.Converter.Page.eex_to_html(posts) |> rewrite_stylesheets("./") |> rewrite_images("./") |> rewrite_post_links() @@ -126,7 +126,7 @@ defmodule Mix.Tasks.SimpleBlog.Compile do result = File.read(root_directory <> "/post.html.eex") - |> SimpleBlog.Converter.Page.exx_to_html(post) + |> SimpleBlog.Converter.Page.eex_to_html(post) |> rewrite_stylesheets("../../../../") |> rewrite_images("../../../../") |> rewrite_back_link() diff --git a/lib/simple_blog/converter/page.ex b/lib/simple_blog/converter/page.ex index ce2a11f..0cd7dd0 100644 --- a/lib/simple_blog/converter/page.ex +++ b/lib/simple_blog/converter/page.ex @@ -9,14 +9,14 @@ defmodule SimpleBlog.Converter.Page do ## Examples iex> posts = [%SimpleBlog.Post{title: "post 1"}, %SimpleBlog.Post{title: "post 2"}] - iex> SimpleBlog.Converter.Page.exx_to_html({:ok, "<%= for post <- posts do %><%= post.title %><% end %>"}, posts) + iex> SimpleBlog.Converter.Page.eex_to_html({:ok, "<%= for post <- posts do %><%= post.title %><% end %>"}, posts) "post 1post 2" iex> post = %SimpleBlog.Post{title: "post 1"} - iex> SimpleBlog.Converter.Page.exx_to_html({:ok, "<%= post.title %>"}, post) + iex> SimpleBlog.Converter.Page.eex_to_html({:ok, "<%= post.title %>"}, post) "post 1" """ - def exx_to_html({:ok, body}, posts) when is_list(posts) do + def eex_to_html({:ok, body}, posts) when is_list(posts) do quoted = EEx.compile_string(body) case Code.eval_quoted(quoted, posts: posts) do @@ -24,7 +24,7 @@ defmodule SimpleBlog.Converter.Page do end end - def exx_to_html({:ok, body}, post) do + def eex_to_html({:ok, body}, post) do quoted = EEx.compile_string(body) case Code.eval_quoted(quoted, post: post) do diff --git a/lib/simple_blog/server.ex b/lib/simple_blog/server.ex index 4ff43ee..7a6b1a3 100644 --- a/lib/simple_blog/server.ex +++ b/lib/simple_blog/server.ex @@ -35,7 +35,7 @@ defmodule SimpleBlog.Server do result = File.read("blog/post.html.eex") - |> SimpleBlog.Converter.Page.exx_to_html(post) + |> SimpleBlog.Converter.Page.eex_to_html(post) conn |> put_resp_content_type("text/html") @@ -51,7 +51,7 @@ defmodule SimpleBlog.Server do result = File.read("blog/index.html.eex") - |> SimpleBlog.Converter.Page.exx_to_html(posts) + |> SimpleBlog.Converter.Page.eex_to_html(posts) conn |> put_resp_content_type("text/html") diff --git a/test/simple_blog/converter/page_test.exs b/test/simple_blog/converter/page_test.exs index c14a866..def51d1 100644 --- a/test/simple_blog/converter/page_test.exs +++ b/test/simple_blog/converter/page_test.exs @@ -2,9 +2,9 @@ defmodule SimpleBlog.Converter.PageTest do use ExUnit.Case doctest SimpleBlog.Converter.Page - describe "exx_to_html" do - test "transform exx list in html" do - exx = """ + describe "eex_to_html" do + test "transform eex list in html" do + eex = """ @@ -32,12 +32,12 @@ defmodule SimpleBlog.Converter.PageTest do """ - html = SimpleBlog.Converter.Page.exx_to_html({:ok, exx}, posts_html) + html = SimpleBlog.Converter.Page.eex_to_html({:ok, eex}, posts_html) assert normalize(output) == normalize(html) end - test "transform exx in html" do - exx = """ + test "transform eex in html" do + eex = """ @@ -59,7 +59,7 @@ defmodule SimpleBlog.Converter.PageTest do """ - html = SimpleBlog.Converter.Page.exx_to_html({:ok, exx}, posts_html) + html = SimpleBlog.Converter.Page.eex_to_html({:ok, eex}, posts_html) assert normalize(output) == normalize(html) end end