update deps and deprecated

This commit is contained in:
keepcosmos 2018-07-24 18:13:08 +09:00
parent 133044f50c
commit 2ed20b6fe1
8 changed files with 13 additions and 10 deletions

View File

@ -208,7 +208,7 @@ defmodule Readability do
Regex.replace(tags_to_br, html_str, &"\n#{&1}")
|> Floki.parse()
|> Floki.text()
|> String.strip()
|> String.trim()
end
@doc """

View File

@ -25,7 +25,7 @@ defmodule Readability.AuthorFinder do
meta
|> Floki.attribute("content")
|> Enum.join(" ")
|> String.strip()
|> String.trim()
end)
|> Enum.reject(&(is_nil(&1) || String.length(&1) == 0))

View File

@ -41,7 +41,8 @@ defmodule Readability.Candidate.Cleaner do
defp unlikely_tree?({tag, attrs, _}) do
idclass_str =
attrs
|> Enum.filter_map(&(elem(&1, 0) =~ ~r/id|class/i), &elem(&1, 1))
|> Enum.filter(&(elem(&1, 0) =~ ~r/id|class/i))
|> Enum.map(&elem(&1, 1))
|> Enum.join("")
str = tag <> idclass_str

View File

@ -84,7 +84,8 @@ defmodule Readability.Candidate.Scoring do
defp calc_grand_children_content_score({_, _, children_tree}) do
score =
children_tree
|> Enum.filter_map(&is_tuple(&1), &elem(&1, 2))
|> Enum.filter(&is_tuple(&1))
|> Enum.map(&elem(&1, 2))
|> List.flatten()
|> Enum.filter(&(is_tuple(&1) && Helper.candidate_tag?(&1)))
|> calc_content_score

View File

@ -84,7 +84,7 @@ defmodule Readability.Helper do
"""
@spec text_length(html_tree) :: number
def text_length(html_tree) do
html_tree |> Floki.text() |> String.strip() |> String.length()
html_tree |> Floki.text() |> String.trim() |> String.length()
end
@doc """

View File

@ -77,13 +77,13 @@ defmodule Readability.TitleFinder do
end
defp clean_title([title]) when is_binary(title) do
String.strip(title)
String.trim(title)
end
defp clean_title(html_tree) do
html_tree
|> Floki.text()
|> String.strip()
|> String.trim()
end
defp good_title?(title) do

View File

@ -2,7 +2,7 @@ defmodule Readability.Mixfile do
@moduledoc """
"""
@version "0.9.1"
@version "0.10.0"
@description """
Readability library for extracting and curating articles.
"""
@ -43,7 +43,7 @@ defmodule Readability.Mixfile do
{:floki, "~> 0.20"},
{:httpoison, "~> 0.13.0"},
{:ex_doc, "~> 0.14", only: :dev},
{:credo, "~> 0.6.1", only: [:dev, :test]},
{:credo, "~> 0.9", only: [:dev, :test]},
{:dialyxir, "~> 0.3", only: [:dev]},
{:mock, "~> 0.2.0", only: :test}
]

View File

@ -1,7 +1,7 @@
%{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], []},
"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], []},
"credo": {:hex, :credo, "0.6.1", "a941e2591bd2bd2055dc92b810c174650b40b8290459c89a835af9d59ac4a5f8", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, optional: false]}]},
"credo": {:hex, :credo, "0.9.3", "76fa3e9e497ab282e0cf64b98a624aa11da702854c52c82db1bf24e54ab7c97a", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:poison, ">= 0.0.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"},
"dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], []},
"earmark": {:hex, :earmark, "1.2.3", "206eb2e2ac1a794aa5256f3982de7a76bf4579ff91cb28d0e17ea2c9491e46a4", [:mix], []},
"ex_doc": {:hex, :ex_doc, "0.16.3", "cd2a4cfe5d26e37502d3ec776702c72efa1adfa24ed9ce723bb565f4c30bd31a", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, optional: false]}]},
@ -15,6 +15,7 @@
"mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], []},
"mochiweb": {:hex, :mochiweb, "2.15.0", "e1daac474df07651e5d17cc1e642c4069c7850dc4508d3db7263a0651330aacc", [:rebar3], []},
"mock": {:hex, :mock, "0.2.1", "bfdba786903e77f9c18772dee472d020ceb8ef000783e737725a4c8f54ad28ec", [:mix], [{:meck, "~> 0.8.2", [hex: :meck, optional: false]}]},
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], []},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [:rebar3], []},
}