File 1212-Detect-anchors-without-href-attribute.patch of Package erlang
From 1894a01ed731837317bed640d8dedcf5ac2057b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20W=C4=85sowski?= <michal@erlang.org>
Date: Tue, 16 Dec 2025 12:32:44 +0100
Subject: [PATCH 2/4] Detect anchors without href attribute
---
scripts/otp_check_html_links.exs | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/scripts/otp_check_html_links.exs b/scripts/otp_check_html_links.exs
index 0d3e3a35e0..76e4fddaf1 100755
--- a/scripts/otp_check_html_links.exs
+++ b/scripts/otp_check_html_links.exs
@@ -134,6 +134,13 @@ defmodule Anchors do
if String.contains?(file, "doc/html/assets/") do
seen
else
+ # Check anchors without href
+ Floki.find(document, "a:not([href])")
+ |> Enum.each(fn {_, _, content} ->
+ warn(file, "anchor tag without href: #{Floki.text(content)}")
+ end)
+
+ # Check anchors with href
Floki.find(document, "a[href]")
|> Enum.reduce(seen, fn {_, attr, _}, seen ->
href = :proplists.get_value("href", attr)
--
2.51.0