Packages
floki
0.34.1
0.38.4
0.38.3
0.38.2
0.38.1
0.38.0
0.37.1
0.37.0
0.36.3
0.36.2
0.36.1
0.36.0
0.35.4
0.35.3
0.35.2
0.35.1
0.35.0
0.34.3
0.34.2
0.34.1
0.34.0
0.33.1
0.33.0
0.32.1
0.32.0
0.31.0
0.30.1
0.30.0
0.29.0
0.28.0
0.27.0
0.26.0
0.25.0
0.24.0
0.23.1
0.23.0
0.22.0
0.21.0
0.20.4
0.20.3
0.20.2
0.20.1
0.20.0
0.19.3
0.19.2
0.19.1
0.19.0
0.18.1
0.18.0
0.17.2
0.17.1
0.17.0
0.16.0
0.15.0
0.14.0
0.13.2
0.13.1
0.13.0
0.12.1
0.12.0
0.11.0
0.10.1
0.10.0
0.9.0
0.8.1
0.8.0
0.7.2
0.7.1
0.7.0
0.6.1
0.6.0
0.5.0
0.4.1
0.4.0
0.3.3
0.3.2
0.3.1
0.3.0
0.2.1
0.2.0
0.1.1
0.1.0
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
Floki is a simple HTML parser that enables search for nodes using CSS selectors.
Current section
86 Versions
Jump to
Current section
86 Versions
Compare versions
7
files changed
+46
additions
-31
deletions
| @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. | |
| 7 7 | |
| 8 8 | ## [Unreleased][unreleased] |
| 9 9 | |
| 10 | + ## [0.34.1] - 2023-02-11 |
| 11 | + |
| 12 | + ### Fixed |
| 13 | + |
| 14 | + - Fix pseudo-class ":not" selector parsing halting point. |
| 15 | + This is a fix for when a "pseudo-class" ":not" that contains an attribute selector is |
| 16 | + followed by another selector. This is an example: "a:not([class]), div". |
| 17 | + |
| 18 | + - Ignore decimal numeric char ref when number is negative. |
| 19 | + |
| 10 20 | ## [0.34.0] - 2022-11-03 |
| 11 21 | |
| 12 22 | ### Added |
| @@ -633,7 +643,8 @@ of the parent element inside HTML. | |
| 633 643 | |
| 634 644 | - Elixir version requirement from "~> 1.0.0" to ">= 1.0.0". |
| 635 645 | |
| 636 | - [unreleased]: https://github.com/philss/floki/compare/v0.34.0...HEAD |
| 646 | + [unreleased]: https://github.com/philss/floki/compare/v0.34.1...HEAD |
| 647 | + [0.34.1]: https://github.com/philss/floki/compare/v0.34.0...v0.34.1 |
| 637 648 | [0.34.0]: https://github.com/philss/floki/compare/v0.33.1...v0.34.0 |
| 638 649 | [0.33.1]: https://github.com/philss/floki/compare/v0.33.0...v0.33.1 |
| 639 650 | [0.33.0]: https://github.com/philss/floki/compare/v0.32.1...v0.33.0 |
| @@ -18,11 +18,11 @@ | |
| 18 18 | <<"lib/floki/selector/functional.ex">>, |
| 19 19 | <<"lib/floki/selector/tokenizer.ex">>, |
| 20 20 | <<"lib/floki/selector/attribute_selector.ex">>, |
| 21 | - <<"lib/floki/selector/combinator.ex">>,<<"lib/floki/selector/parser.ex">>, |
| 22 | - <<"lib/floki/selector/pseudo_class.ex">>,<<"lib/floki/traversal.ex">>, |
| 23 | - <<"lib/floki/selector.ex">>,<<"lib/floki/entities.ex">>, |
| 24 | - <<"lib/floki/entities">>,<<"lib/floki/entities/codepoints.ex">>, |
| 25 | - <<"lib/floki/raw_html.ex">>,<<"lib/floki.ex">>, |
| 21 | + <<"lib/floki/selector/combinator.ex">>, |
| 22 | + <<"lib/floki/selector/pseudo_class.ex">>,<<"lib/floki/selector/parser.ex">>, |
| 23 | + <<"lib/floki/traversal.ex">>,<<"lib/floki/entities">>, |
| 24 | + <<"lib/floki/entities/codepoints.ex">>,<<"lib/floki/raw_html.ex">>, |
| 25 | + <<"lib/floki/selector.ex">>,<<"lib/floki/entities.ex">>,<<"lib/floki.ex">>, |
| 26 26 | <<"src/floki_selector_lexer.xrl">>,<<"src/floki_mochi_html.erl">>, |
| 27 27 | <<"src/floki.gleam">>,<<"mix.exs">>,<<"README.md">>,<<"LICENSE">>, |
| 28 28 | <<"CODE_OF_CONDUCT.md">>,<<"CONTRIBUTING.md">>,<<"CHANGELOG.md">>]}. |
| @@ -33,4 +33,4 @@ | |
| 33 33 | {<<"Sponsor">>,<<"https://github.com/sponsors/philss">>}]}. |
| 34 34 | {<<"name">>,<<"floki">>}. |
| 35 35 | {<<"requirements">>,[]}. |
| 36 | - {<<"version">>,<<"0.34.0">>}. |
| 36 | + {<<"version">>,<<"0.34.1">>}. |
| @@ -502,7 +502,7 @@ defmodule Floki do | |
| 502 502 | |
| 503 503 | """ |
| 504 504 | |
| 505 | - @spec text(html_tree | binary) :: binary |
| 505 | + @spec text(html_tree | html_node | binary) :: binary |
| 506 506 | |
| 507 507 | def text(html, opts \\ [deep: true, js: false, style: true, sep: ""]) do |
| 508 508 | cleaned_html_tree = |
| @@ -12,8 +12,13 @@ defmodule Floki.Entities do | |
| 12 12 | <<"&#", numeric::binary>> -> |
| 13 13 | case extract_byte_from_num_charref(numeric) do |
| 14 14 | {:ok, number} -> |
| 15 | - {:ok, {_, unicode_number}} = Floki.HTML.NumericCharref.to_unicode_number(number) |
| 16 | - {:ok, <<unicode_number::utf8>>} |
| 15 | + case Floki.HTML.NumericCharref.to_unicode_number(number) do |
| 16 | + {:ok, {_, unicode_number}} -> |
| 17 | + {:ok, <<unicode_number::utf8>>} |
| 18 | + |
| 19 | + {:error, {:negative_number, _}} -> |
| 20 | + {:error, :not_found} |
| 21 | + end |
| 17 22 | |
| 18 23 | :error -> |
| 19 24 | {:error, :not_found} |
| @@ -104,5 +104,8 @@ defmodule Floki.HTML.NumericCharref do | |
| 104 104 | {:ok, {:list_of_errors, number}} |
| 105 105 | end |
| 106 106 | |
| 107 | - def to_unicode_number(number), do: {:ok, {:unicode, number}} |
| 107 | + def to_unicode_number(number) when is_integer(number) and number >= 0, |
| 108 | + do: {:ok, {:unicode, number}} |
| 109 | + |
| 110 | + def to_unicode_number(number), do: {:error, {:negative_number, number}} |
| 108 111 | end |
Loading more files…