From cfc6355bbe85874ddee91a05557f4f0a4a106fe4 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Sat, 23 Feb 2019 20:09:43 +0700 Subject: [PATCH 1/2] fix link text --- lib/auto_linker/builder.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/auto_linker/builder.ex b/lib/auto_linker/builder.ex index cb2d18e..e2c0ec0 100644 --- a/lib/auto_linker/builder.ex +++ b/lib/auto_linker/builder.ex @@ -6,15 +6,15 @@ defmodule AutoLinker.Builder do @doc """ Create a link. """ - def create_link(url, opts) do - url = add_scheme(url) + def create_link(text, opts) do + url = add_scheme(text) [] |> build_attrs(url, opts, :rel) |> build_attrs(url, opts, :target) |> build_attrs(url, opts, :class) |> build_attrs(url, opts, :href) - |> format_url(url, opts) + |> format_url(text, opts) end def create_markdown_links(text, opts) do From 82ba30c6582ea6f5bfb7f484b8cb2934ab59559e Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Sat, 23 Feb 2019 20:19:46 +0700 Subject: [PATCH 2/2] cleanup --- lib/auto_linker/builder.ex | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/auto_linker/builder.ex b/lib/auto_linker/builder.ex index e2c0ec0..c2d3799 100644 --- a/lib/auto_linker/builder.ex +++ b/lib/auto_linker/builder.ex @@ -59,7 +59,7 @@ defmodule AutoLinker.Builder do |> truncate(Map.get(opts, :truncate, false)) attrs = format_attrs(attrs) - "" <> url <> "" + "#{url}" end defp format_attrs(attrs) do @@ -93,9 +93,7 @@ defmodule AutoLinker.Builder do defp strip_prefix(url, _), do: url - def create_phone_link([], buffer, _) do - buffer - end + def create_phone_link([], buffer, _), do: buffer def create_phone_link([h | t], buffer, opts) do create_phone_link(t, format_phone_link(h, buffer, opts), opts)