diff --git a/mix.exs b/mix.exs
index 825bc3143..665135b56 100644
--- a/mix.exs
+++ b/mix.exs
@@ -46,8 +46,7 @@ defmodule ExDoc.Mixfile do
{:makeup_c, ">= 0.1.0", optional: true},
{:makeup_html, ">= 0.1.0", optional: true},
{:jason, "~> 1.2", only: :test},
- {:floki, "~> 0.0", only: :test},
- {:easyhtml, "~> 0.0", only: :test}
+ {:lazy_html, "~> 0.1.0", only: :test}
]
end
diff --git a/mix.lock b/mix.lock
index 419c2703e..ce8e36e50 100644
--- a/mix.lock
+++ b/mix.lock
@@ -1,8 +1,10 @@
%{
+ "cc_precompiler": {:hex, :cc_precompiler, "0.1.10", "47c9c08d8869cf09b41da36538f62bc1abd3e19e41701c2cea2675b53c704258", [:mix], [{:elixir_make, "~> 0.7", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "f6e046254e53cd6b41c6bacd70ae728011aa82b2742a80d6e2214855c6e06b22"},
"earmark_parser": {:hex, :earmark_parser, "1.4.44", "f20830dd6b5c77afe2b063777ddbbff09f9759396500cdbe7523efd58d7a339c", [:mix], [], "hexpm", "4778ac752b4701a5599215f7030989c989ffdc4f6df457c5f36938cc2d2a2750"},
- "easyhtml": {:hex, :easyhtml, "0.3.2", "050adfc8074f53b261f7dfe83303d864f1fbf5988245b369f8fdff1bf4c4b3e6", [:mix], [{:floki, "~> 0.35", [hex: :floki, repo: "hexpm", optional: false]}], "hexpm", "b6a936f91612a4870aa3e828cd8da5a08d9e3b6221b4d3012b6ec70b87845d06"},
- "floki": {:hex, :floki, "0.36.2", "a7da0193538c93f937714a6704369711998a51a6164a222d710ebd54020aa7a3", [:mix], [], "hexpm", "a8766c0bc92f074e5cb36c4f9961982eda84c5d2b8e979ca67f5c268ec8ed580"},
+ "elixir_make": {:hex, :elixir_make, "0.9.0", "6484b3cd8c0cee58f09f05ecaf1a140a8c97670671a6a0e7ab4dc326c3109726", [:mix], [], "hexpm", "db23d4fd8b757462ad02f8aa73431a426fe6671c80b200d9710caf3d1dd0ffdb"},
+ "fine": {:hex, :fine, "0.1.0", "9bb99a5ff9b968f12c3b458fa1277c39e9a620b23a9439103703a25917293871", [:mix], [], "hexpm", "1d6485bf811b95dc6ae3d197c0e6f994880b86167a827983bb29cbfc03a02684"},
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
+ "lazy_html": {:hex, :lazy_html, "0.1.0", "619c4c124a7375ecbf66263de90270d221ffc7479afde436717a4e5cceaac954", [:make, :mix], [{:cc_precompiler, "~> 0.1", [hex: :cc_precompiler, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.9.0", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:fine, "~> 0.1.0", [hex: :fine, repo: "hexpm", optional: false]}], "hexpm", "a212f417b0e546055b7d5d72d302fce747b63ac9dfe0cf491c1f9af6d198e256"},
"makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"},
"makeup_c": {:hex, :makeup_c, "0.1.1", "14250b1a69770b1892f4113129417a2df098e2a72b9e1477aa9096e9e6c473a6", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "89e9cf45372822d354c19a7e18d77f84cfd70e2d206ac987eb15a1b8357f2869"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"},
diff --git a/test/ex_doc/formatter/html/erlang_test.exs b/test/ex_doc/formatter/html/erlang_test.exs
index 4c7edc9cf..6f1944523 100644
--- a/test/ex_doc/formatter/html/erlang_test.exs
+++ b/test/ex_doc/formatter/html/erlang_test.exs
@@ -30,7 +30,7 @@ defmodule ExDoc.Formatter.HTML.ErlangTest do
""")
doc = generate_docs(c)
- html = Floki.raw_html(doc)
+ html = LazyHTML.to_html(doc)
assert html =~
~s|-spec foo(t()) -> t().|
@@ -54,6 +54,9 @@ defmodule ExDoc.Formatter.HTML.ErlangTest do
ExDoc.generate_docs(config[:project], config[:version], config)
- [c.tmp_dir, "doc", "foo.html"] |> Path.join() |> File.read!() |> Floki.parse_document!()
+ [c.tmp_dir, "doc", "foo.html"]
+ |> Path.join()
+ |> File.read!()
+ |> LazyHTML.from_document()
end
end
diff --git a/test/ex_doc/formatter/html/templates_test.exs b/test/ex_doc/formatter/html/templates_test.exs
index ae4dbbba1..e622d2dad 100644
--- a/test/ex_doc/formatter/html/templates_test.exs
+++ b/test/ex_doc/formatter/html/templates_test.exs
@@ -497,13 +497,13 @@ defmodule ExDoc.Formatter.HTML.TemplatesTest do
end
)
- doc = EasyHTML.parse!(content)
- assert doc["#example-functions a[href='#example-functions']"]
- assert doc["#legacy a[href='#legacy']"]
- assert doc["#example-functions [id='example/2']"]
- refute doc["#legacy [id='example/2']"]
- assert doc["#functions [id='example_1/0']"]
- refute doc["#functions [id='example/2']"]
+ doc = LazyHTML.from_document(content)
+ assert Enum.count(doc["#example-functions a[href='#example-functions']"]) == 1
+ assert Enum.count(doc["#legacy a[href='#legacy']"]) == 1
+ assert Enum.count(doc["#example-functions [id='example/2']"]) == 1
+ assert Enum.count(doc["#legacy [id='example/2']"]) == 0
+ assert Enum.count(doc["#functions [id='example_1/0']"]) == 1
+ assert Enum.count(doc["#functions [id='example/2']"]) == 0
end
test "outputs deprecation information", context do
diff --git a/test/ex_doc/formatter/html_test.exs b/test/ex_doc/formatter/html_test.exs
index 8677bbf07..fc31e4d70 100644
--- a/test/ex_doc/formatter/html_test.exs
+++ b/test/ex_doc/formatter/html_test.exs
@@ -105,11 +105,11 @@ defmodule ExDoc.Formatter.HTMLTest do
generate_docs(config)
- foo_content = EasyHTML.parse!(File.read!("#{c.tmp_dir}/html/readme-1.html"))["#content"]
- bar_content = EasyHTML.parse!(File.read!("#{c.tmp_dir}/html/readme-2.html"))["#content"]
+ foo_content = "#{c.tmp_dir}/html/readme-1.html" |> File.read!() |> LazyHTML.from_document()
+ bar_content = "#{c.tmp_dir}/html/readme-2.html" |> File.read!() |> LazyHTML.from_document()
- assert to_string(foo_content["h1"]) == "README foo"
- assert to_string(bar_content["h1"]) == "README bar"
+ assert LazyHTML.text(foo_content["h1"]) == "README foo"
+ assert LazyHTML.text(bar_content["h1"]) == "README bar"
end
test "warns when generating an index.html file with an invalid redirect",