Page MenuHomePhorge

No OneTemporary

Size
8 KB
Referenced Files
None
Subscribers
None
diff --git a/.gitmodules b/.gitmodules
index 0ac1fa7..0568e2d 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,8 +1,8 @@
# SPDX-FileCopyrightText: 2017-2019 myhtmlex authors <https://github.com/Overbryd/myhtmlex>
# SPDX-FileCopyrightText: 2019-2023 Pleroma Authors <https://pleroma.social>
# SPDX-License-Identifier: LGPL-2.1-only
[submodule "c_src/lexbor"]
path = c_src/lexbor
url = https://github.com/lexbor/lexbor.git
- branch = v2.2.0
+ branch = v2.3.0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 17fade3..92218d2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,67 +1,78 @@
<!--
SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
SPDX-License-Identifier: LGPL-2.1-only
-->
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
+## [2.3.0] - 2023-08-18
+## Added
+- Ability to use system lexbor
+
+## Removed
+- Remove compatibility for Erlang <22
+
+## Changed
+- Allow custom CFLAGS
+- Updated vendored lexbor to 2.3.0
+
## [2.2.0] - 2023-04-08
### Changed
- Updated vendored lexbor to 2.2.0
## [2.0.4] - 2020-09-01
#### Fixed
- Regression of the gcc 10 fix in the hex package, due to an outdated submodule on the publishing machine
## [2.0.3] - 2020-08-30
### Changed
- Improved error message on make errors
## [2.0.2] - 2020-08-26
### Fixed
- lexbor compilation errors with gcc 10
- Inability to use the library with distillery releases due to priv dir being in the source code
## [2.0.1] - 2020-08-04
### Fixed
- Build failures using the hex package due to CMake cache files accidentally included there
### Added
- Changelog is now available at hexdocs
## [2.0.0] - 2020-08-01
### Changed
- **Breaking:** CMake is now required at compile-time due to it being lexbor's build system
- **Breaking:** namespaces are no longer automatically appended. i.e `<svg> </svg>` will be `{"svg", [], []}` instead of `{"svg:svg", [], []}`
- **Breaking:** when using `:nil_self_closing` flag, only valid [void elements](https://html.spec.whatwg.org/#void-elements) will have `nil` in children
- Now deprecated myhtml was switched to [lexbor](https://github.com/lexbor/lexbor)
- The worker process now communicates with the node via stdio, instead of TCP, which was known to cause issues
on BSD systems
### Added
- `FastHtml.Pool` for fast_html workers. There is a default pool of `System.schedulers_online/0` workers, but a custom pool can be started if desired, or it can be disabled altogether. See `FastHtml.Pool` module documentation for more info
## [1.0.3] - 2020-02-10
### Fixed
- C-Node not respawning after being killed.
## [1.0.2] - 2020-02-10
### Fixed
- Incorrect behavior when parsing empty attribute values. Instead of an empty string the attribute name was returned.
## [1.0.1] - 2019-12-11
### Added
- `:fast_html.decode_fragment`
### Fixed
- Errors from C-Node not being reported, timing out instead
## [1.0.0] - 2019-12-02
### Changed
- **BREAKING:** `:fast_html.decode` now returns an array of nodes at the top level, instead of a single node. This was done because it's possible to have more than one root node, for example in (`<!-- a comment --> <html> </html>` both the comment and the `html` tag are root nodes).
### Fixed
- Worker going into infinite loop when decoding a document with more than one root node.
diff --git a/Makefile b/Makefile
index 1977293..7060795 100644
--- a/Makefile
+++ b/Makefile
@@ -1,54 +1,54 @@
# SPDX-FileCopyrightText: 2017-2019 myhtmlex authors <https://github.com/Overbryd/myhtmlex>
# SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
# SPDX-License-Identifier: LGPL-2.1-only
MIX = mix
CMAKE = cmake
CFLAGS ?= -g -O2 -pedantic -Wcomment -Wextra -Wno-old-style-declaration -Wall
# set erlang include path
ERLANG_PATH = $(shell erl -eval 'io:format("~s", [lists:concat([code:root_dir(), "/erts-", erlang:system_info(version)])])' -s init stop -noshell)
CNODE_CFLAGS += -I$(ERLANG_PATH)/include
# expecting lexbor as a submodule in c_src/
# that way we can pin a version and package the whole thing in hex
LXB_PATH = c_src/lexbor
LXB_AR = $(LXB_PATH)/liblexbor_static.a
ifeq ($(WITH_SYSTEM_LEXBOR),1)
LXB_CFLAGS =
LXB_LDFLAGS = -llexbor
LXB_DEPS =
else
LXB_CFLAGS = -I$(LXB_PATH)/source
LXB_LDFLAGS = $(LXB_AR)
LXB_DEPS = $(LXB_AR)
endif
# C-Node
ERL_INTERFACE = $(wildcard $(ERLANG_PATH)/../lib/erl_interface-*)
CNODE_CFLAGS += -I$(ERL_INTERFACE)/include
CNODE_LDFLAGS += -L$(ERL_INTERFACE)/lib -lei -lpthread
.PHONY: all
all: priv/fasthtml_worker
$(LXB_AR): $(LXB_PATH)
# Sadly, build components separately seems to sporadically fail
cd $(LXB_PATH); \
CFLAGS='$(CFLAGS)' \
cmake -DLEXBOR_BUILD_SEPARATELY=OFF -DLEXBOR_BUILD_SHARED=OFF
$(MAKE) -C $(LXB_PATH)
priv/fasthtml_worker: c_src/fasthtml_worker.c $(LXB_DEPS)
mkdir -p priv
- $(CC) -std=c99 $(CFLAGS) $(CNODE_CFLAGS) $(LXB_CFLAGS) -o $@ $< $(LDFLAGS) $(CNODE_LDFLAGS) $(LXB_LDFLAGS)
+ $(CC) -std=c99 $(CFLAGS) $(CNODE_CFLAGS) $(LXB_CFLAGS) -o $@ $< $(LDFLAGS) -lm $(CNODE_LDFLAGS) $(LXB_LDFLAGS)
clean: clean-myhtml
$(RM) -r priv/myhtmlex*
$(RM) priv/fasthtml_worker
$(RM) myhtmlex-*.tar
$(RM) -r package-test
clean-myhtml:
$(MAKE) -C $(LXB_PATH) clean
diff --git a/c_src/lexbor b/c_src/lexbor
index 74f28d6..26a8819 160000
--- a/c_src/lexbor
+++ b/c_src/lexbor
@@ -1 +1 @@
-Subproject commit 74f28d6df42759dbb708bed1cae8ec59205a473b
+Subproject commit 26a8819b60801301df92d771f12a01dbe8705a7a
diff --git a/mix.exs b/mix.exs
index 4f042a7..aa4c4d8 100644
--- a/mix.exs
+++ b/mix.exs
@@ -1,98 +1,98 @@
# SPDX-FileCopyrightText: 2017-2019 myhtmlex authors <https://github.com/Overbryd/myhtmlex>
# SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
# SPDX-License-Identifier: LGPL-2.1-only
defmodule FastHtml.Mixfile do
use Mix.Project
def project do
[
app: :fast_html,
- version: "2.2.0",
+ version: "2.3.0",
elixir: "~> 1.11",
deps: deps(),
package: package(),
compilers: [:elixir_make] ++ Mix.compilers(),
make_env: make_env(),
make_error_message: make_error_message(),
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
name: "FastHtml",
description: """
A module to decode HTML into a tree,
porting all properties of the underlying
library lexbor, being fast and correct
in regards to the html spec.
""",
docs: docs()
]
end
def package do
[
maintainers: ["Ariadne Conill", "rinpatch"],
licenses: ["LGPL-2.1-only"],
links: %{
"GitLab" => "https://git.pleroma.social/pleroma/elixir-libraries/fast_html/",
"Issues" => "https://git.pleroma.social/pleroma/elixir-libraries/fast_html/issues",
"lexbor" => "https://github.com/lexbor/lexbor"
},
files: hex_files()
]
end
def application do
[
extra_applications: [:logger],
mod: {FastHtml.Application, []}
]
end
defp deps do
[
# documentation helpers
{:ex_doc, "~> 0.19", only: :dev},
# benchmarking helpers
{:benchee, "~> 1.0", only: :bench, optional: true},
{:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false},
{:myhtmlex, "~> 0.2.0", only: :bench, runtime: false, optional: true},
{:mochiweb, "~> 2.18", only: :bench, optional: true},
{:html5ever,
git: "https://github.com/rusterlium/html5ever_elixir.git", only: :bench, optional: true},
{:nimble_pool, "~> 0.2.0"},
{:elixir_make, "~> 0.4", runtime: false}
]
end
defp docs do
[
main: "readme",
extras: ["README.md", "CHANGELOG.md"]
]
end
defp hex_files do
# This is run every time mix is executed, so it will fail in the hex package,
# therefore check if git is even available
if File.exists?(".git") and System.find_executable("git") do
{files, 0} = System.cmd("git", ["ls-files", "--recurse-submodules"])
files
|> String.split("\n")
# Last element is "", which makes hex include all files in the folder to the project
|> List.delete_at(-1)
|> Enum.reject(fn path ->
Path.dirname(path) == "bench_fixtures" or
(Path.dirname(path) != "priv" and String.starts_with?(Path.basename(path), "."))
end)
else
[]
end
end
defp make_env, do: %{}
defp make_error_message,
do:
"Please check you have: a C compiler, GNU Make, CMake and Erlang development headers installed before reporting an issue."
end

File Metadata

Mime Type
text/x-diff
Expires
Sun, Nov 24, 3:01 PM (1 d, 3 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39427
Default Alt Text
(8 KB)

Event Timeline