Current section

86 Versions

Jump to

Compare versions

12 files changed
+338 additions
-311 deletions
  @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7 7
8 8 ## [Unreleased][unreleased]
9 9
10 + ## [0.36.3] - 2024-10-21
11 +
12 + This release contains some performance improvements, thanks to [@ypconstante](https://github.com/ypconstante).
13 +
14 + ### Fixed
15 +
16 + - Stop `Floki.get_by_id/2` traversal on first match. Thanks [@ypconstante](https://github.com/ypconstante).
17 +
18 + - Remove extra whitespaces from nodes without attributes on `Floki.raw_html/1`.
19 + Thank you [@ypconstante](https://github.com/ypconstante).
20 +
21 + - Fix `Floki.raw_html/1` typespecs. Thanks [@davydog187](https://github.com/davydog187).
22 +
10 23 ## [0.36.2] - 2024-04-26
11 24
12 25 ### Added
  @@ -786,7 +799,8 @@ of the parent element inside HTML.
786 799
787 800 - Elixir version requirement from "~> 1.0.0" to ">= 1.0.0".
788 801
789 - [unreleased]: https://github.com/philss/floki/compare/v0.36.2...HEAD
802 + [unreleased]: https://github.com/philss/floki/compare/v0.36.3...HEAD
803 + [0.36.3]: https://github.com/philss/floki/compare/v0.36.2...v0.36.3
790 804 [0.36.2]: https://github.com/philss/floki/compare/v0.36.1...v0.36.2
791 805 [0.36.1]: https://github.com/philss/floki/compare/v0.36.0...v0.36.1
792 806 [0.36.0]: https://github.com/philss/floki/compare/v0.35.4...v0.36.0
  @@ -113,8 +113,10 @@ its developers.
113 113
114 114 You can perform a benchmark by running the following:
115 115
116 - $ sh benchs/extract.sh
117 - $ mix run benchs/parse_document.exs
116 + ```sh
117 + sh benchs/extract.sh
118 + mix run benchs/parse_document.exs
119 + ```
118 120
119 121 Extracting the files is needed only once.
  @@ -1,36 +1,37 @@
1 - {<<"app">>,<<"floki">>}.
2 - {<<"build_tools">>,[<<"mix">>]}.
3 - {<<"description">>,
4 - <<"Floki is a simple HTML parser that enables search for nodes using CSS selectors.">>}.
5 - {<<"elixir">>,<<"~> 1.13">>}.
6 - {<<"files">>,
7 - [<<"lib/floki">>,<<"lib/floki/html_tree.ex">>,<<"lib/floki/html_parser">>,
8 - <<"lib/floki/html_parser/html5ever.ex">>,
9 - <<"lib/floki/html_parser/mochiweb.ex">>,
10 - <<"lib/floki/html_parser/fast_html.ex">>,<<"lib/floki/traversal.ex">>,
11 - <<"lib/floki/html_tree">>,<<"lib/floki/html_tree/text.ex">>,
12 - <<"lib/floki/html_tree/html_node.ex">>,<<"lib/floki/html_tree/comment.ex">>,
13 - <<"lib/floki/html_tree/id_seeder.ex">>,<<"lib/floki/selector.ex">>,
14 - <<"lib/floki/entities.ex">>,<<"lib/floki/deep_text.ex">>,
15 - <<"lib/floki/flat_text.ex">>,<<"lib/floki/finder.ex">>,
16 - <<"lib/floki/entities">>,<<"lib/floki/entities/codepoints.ex">>,
17 - <<"lib/floki/filter_out.ex">>,<<"lib/floki/html_parser.ex">>,
18 - <<"lib/floki/selector">>,<<"lib/floki/selector/pseudo_class.ex">>,
19 - <<"lib/floki/selector/attribute_selector.ex">>,
20 - <<"lib/floki/selector/functional.ex">>,
21 - <<"lib/floki/selector/combinator.ex">>,<<"lib/floki/selector/parser.ex">>,
22 - <<"lib/floki/selector/tokenizer.ex">>,<<"lib/floki/raw_html.ex">>,
23 - <<"lib/floki/html">>,<<"lib/floki/html/numeric_charref.ex">>,
24 - <<"lib/floki/html/tokenizer.ex">>,<<"lib/floki/text_extractor.ex">>,
25 - <<"lib/floki/parse_error.ex">>,<<"lib/floki.ex">>,
26 - <<"src/floki_selector_lexer.xrl">>,<<"src/floki_mochi_html.erl">>,
27 - <<"mix.exs">>,<<"README.md">>,<<"LICENSE">>,<<"CODE_OF_CONDUCT.md">>,
28 - <<"CONTRIBUTING.md">>,<<"CHANGELOG.md">>]}.
29 - {<<"licenses">>,[<<"MIT">>]}.
30 1 {<<"links">>,
31 2 [{<<"Changelog">>,<<"https://hexdocs.pm/floki/changelog.html">>},
32 3 {<<"GitHub">>,<<"https://github.com/philss/floki">>},
33 4 {<<"Sponsor">>,<<"https://github.com/sponsors/philss">>}]}.
34 5 {<<"name">>,<<"floki">>}.
6 + {<<"version">>,<<"0.36.3">>}.
7 + {<<"description">>,
8 + <<"Floki is a simple HTML parser that enables search for nodes using CSS selectors.">>}.
9 + {<<"elixir">>,<<"~> 1.13">>}.
10 + {<<"app">>,<<"floki">>}.
11 + {<<"licenses">>,[<<"MIT">>]}.
12 + {<<"files">>,
13 + [<<"lib/floki">>,<<"lib/floki/html_parser">>,
14 + <<"lib/floki/html_parser/html5ever.ex">>,
15 + <<"lib/floki/html_parser/fast_html.ex">>,
16 + <<"lib/floki/html_parser/mochiweb.ex">>,<<"lib/floki/traversal.ex">>,
17 + <<"lib/floki/text_extractor.ex">>,<<"lib/floki/raw_html.ex">>,
18 + <<"lib/floki/selector.ex">>,<<"lib/floki/selector">>,
19 + <<"lib/floki/selector/combinator.ex">>,
20 + <<"lib/floki/selector/attribute_selector.ex">>,
21 + <<"lib/floki/selector/tokenizer.ex">>,<<"lib/floki/selector/parser.ex">>,
22 + <<"lib/floki/selector/functional.ex">>,
23 + <<"lib/floki/selector/pseudo_class.ex">>,<<"lib/floki/html_tree">>,
24 + <<"lib/floki/html_tree/id_seeder.ex">>,<<"lib/floki/html_tree/comment.ex">>,
25 + <<"lib/floki/html_tree/html_node.ex">>,<<"lib/floki/html_tree/text.ex">>,
26 + <<"lib/floki/finder.ex">>,<<"lib/floki/filter_out.ex">>,
27 + <<"lib/floki/html_tree.ex">>,<<"lib/floki/html">>,
28 + <<"lib/floki/html/numeric_charref.ex">>,<<"lib/floki/html/tokenizer.ex">>,
29 + <<"lib/floki/html_parser.ex">>,<<"lib/floki/deep_text.ex">>,
30 + <<"lib/floki/entities.ex">>,<<"lib/floki/flat_text.ex">>,
31 + <<"lib/floki/parse_error.ex">>,<<"lib/floki/entities">>,
32 + <<"lib/floki/entities/codepoints.ex">>,<<"lib/floki.ex">>,
33 + <<"src/floki_selector_lexer.xrl">>,<<"src/floki_mochi_html.erl">>,
34 + <<"mix.exs">>,<<"README.md">>,<<"LICENSE">>,<<"CODE_OF_CONDUCT.md">>,
35 + <<"CONTRIBUTING.md">>,<<"CHANGELOG.md">>]}.
35 36 {<<"requirements">>,[]}.
36 - {<<"version">>,<<"0.36.2">>}.
37 + {<<"build_tools">>,[<<"mix">>]}.
  @@ -247,7 +247,7 @@ defmodule Floki do
247 247 \"\"\"
248 248 """
249 249
250 - @spec raw_html(html_tree | binary, keyword) :: binary
250 + @spec raw_html(html_tree() | html_node() | binary(), keyword()) :: binary()
251 251
252 252 defdelegate raw_html(html_tree, options \\ []), to: Floki.RawHTML
253 253
  @@ -308,12 +308,7 @@ defmodule Floki do
308 308
309 309 """
310 310 @spec get_by_id(html_tree() | html_node(), String.t()) :: html_node() | nil
311 - def get_by_id(html_tree_as_tuple, id)
312 - when is_list(html_tree_as_tuple) or is_html_node(html_tree_as_tuple) do
313 - html_tree_as_tuple
314 - |> Finder.find(%Floki.Selector{id: id})
315 - |> List.first()
316 - end
311 + defdelegate get_by_id(html_tree_as_tuple, id), to: Finder, as: :find_by_id
317 312
318 313 @doc """
319 314 Changes the attribute values of the elements matched by `selector`
  @@ -61,7 +61,7 @@ defmodule Floki.Entities do
61 61 * less-than sign - < - is replaced by "&lt;".
62 62 * greater-than sign - > - is replaced by "&gt;".
63 63
64 - All other simbols are going to remain the same.
64 + All other symbols are going to remain the same.
65 65
66 66 Optimized IO data implementation from Plug.HTML
67 67 """
Loading more files…