Skip to content

Commit 2c41ba8

Browse files
authored
Release v0.38 (#629)
* Prepare to release v0.38 * Fix some docs issues * Add last minute change
1 parent ca714a4 commit 2c41ba8

5 files changed

Lines changed: 68 additions & 15 deletions

File tree

CHANGELOG.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,53 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased][unreleased]
99

10+
## [0.38.0] - 2025-06-14
11+
12+
### Added
13+
14+
- This version adds initial support for the `:has` pseudo-selector.
15+
It is a great addition that enables finding elements containing
16+
matching children.
17+
18+
Examples for selectors:
19+
20+
* `"div:has(h1)"`
21+
* `"div:has(h1, p, span)"`
22+
* `"div:has(p.foo)"`
23+
* `"div:has(img[src='https://example.com'])"`
24+
* `"tr:has(*:fl-contains('TEST'))"`
25+
26+
Note that combinators like `">"` are not allowed yet.
27+
28+
Thank you [@bvobart](https://github.com/bvobart) for this feature!
29+
30+
### Fixed
31+
32+
- Add `:style` option documentation to `Floki.text/2`.
33+
Thanks [@s3cur3](https://github.com/s3cur3) for the fix.
34+
35+
- Fix deprecation warnings for upcoming Elixir 1.19.
36+
37+
- Prevent from crashing when selector is an empty string.
38+
39+
### Removed
40+
41+
- Remove support for Elixir 1.14 and OTP 23.
42+
43+
- Remove deprecated functions and function clauses
44+
that were accepting strings (binaries).
45+
46+
Affected functions:
47+
48+
* `parse/1` - removed function
49+
* `map/2` - removed function
50+
* `attr/4` - removed clause
51+
* `find/2` - removed clause
52+
* `text/3` - removed clause
53+
* `text/3` - removed clause
54+
* `attribute/2` - removed clause
55+
* `filter_out/2` - removed clause
56+
1057
## [0.37.1] - 2025-03-22
1158

1259
### Fixed
@@ -820,7 +867,8 @@ of the parent element inside HTML.
820867

821868
- Elixir version requirement from "~> 1.0.0" to ">= 1.0.0".
822869

823-
[unreleased]: https://github.com/philss/floki/compare/v0.37.1...HEAD
870+
[unreleased]: https://github.com/philss/floki/compare/v0.38.0...HEAD
871+
[0.38.0]: https://github.com/philss/floki/compare/v0.37.1...v0.38.0
824872
[0.37.1]: https://github.com/philss/floki/compare/v0.37.0...v0.37.1
825873
[0.37.0]: https://github.com/philss/floki/compare/v0.36.3...v0.37.0
826874
[0.36.3]: https://github.com/philss/floki/compare/v0.36.2...v0.36.3

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Floki.find(document, "p.headline")
4040

4141
document
4242
|> Floki.find("p.headline")
43-
|> Floki.raw_html
43+
|> Floki.raw_html()
4444
# => <p class="headline">Floki</p>
4545
```
4646

@@ -61,7 +61,7 @@ Add Floki to your `mix.exs`:
6161
```elixir
6262
defp deps do
6363
[
64-
{:floki, "~> 0.37.0"}
64+
{:floki, "~> 0.38.0"}
6565
]
6666
end
6767
```
@@ -72,7 +72,7 @@ If you are running on [Livebook](https://livebook.dev) or a script, you can inst
7272

7373
```elixir
7474
Mix.install([
75-
{:floki, "~> 0.37.0"}
75+
{:floki, "~> 0.38.0"}
7676
])
7777
```
7878

@@ -128,8 +128,8 @@ you don't need to install anything to compile it thanks to [RustlerPrecompiled](
128128
```elixir
129129
defp deps do
130130
[
131-
{:floki, "~> 0.37.0"},
132-
{:html5ever, "~> 0.15.0"}
131+
{:floki, "~> 0.38.0"},
132+
{:html5ever, "~> 0.16.0"}
133133
]
134134
end
135135
```
@@ -156,7 +156,7 @@ First, add `fast_html` to your dependencies:
156156
```elixir
157157
defp deps do
158158
[
159-
{:floki, "~> 0.37.0"},
159+
{:floki, "~> 0.38.0"},
160160
{:fast_html, "~> 2.0"}
161161
]
162162
end
@@ -201,7 +201,7 @@ To convert your node tree back to raw HTML (spaces are ignored):
201201
```elixir
202202
document
203203
|> Floki.find(".example")
204-
|> Floki.raw_html
204+
|> Floki.raw_html()
205205
# => <div class="example"></div>
206206
```
207207

@@ -226,7 +226,7 @@ If you want to get the text from an element, try:
226226
```elixir
227227
document
228228
|> Floki.find(".headline")
229-
|> Floki.text
229+
|> Floki.text()
230230

231231
# => "Floki"
232232
```

lib/floki.ex

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
defmodule Floki do
22
alias Floki.{Finder, FilterOut, HTMLTree}
33

4-
require Logger
5-
64
@moduledoc """
75
Floki is a simple HTML parser that enables search for nodes using CSS selectors.
86

lib/floki/html_parser/mochiweb.ex

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
defmodule Floki.HTMLParser.Mochiweb do
2-
@behaviour Floki.HTMLParser
2+
@moduledoc """
3+
The default HTML parser engine for Floki.
4+
5+
This parser is historically not compliant to the HTML5 specs, but will
6+
parse faster and in most of the cases it will produce a valid HTML tree.
37
4-
@moduledoc false
8+
For alternative, please check the `README.md` file.
9+
"""
10+
11+
@behaviour Floki.HTMLParser
512
@root_node "floki"
613

714
@impl true

mix.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule Floki.Mixfile do
33

44
@description "Floki is a simple HTML parser that enables search for nodes using CSS selectors."
55
@source_url "https://github.com/philss/floki"
6-
@version "0.37.1"
6+
@version "0.38.0"
77

88
def project do
99
[
@@ -33,7 +33,7 @@ defmodule Floki.Mixfile do
3333
[
3434
extras: ["CHANGELOG.md", {:"README.md", [title: "Overview"]}],
3535
main: "readme",
36-
assets: "assets",
36+
assets: %{"assets" => "assets"},
3737
logo: "assets/images/floki-logo.svg",
3838
source_url: @source_url,
3939
source_ref: "v#{@version}",

0 commit comments

Comments
 (0)