From 3e895c9b4d76f4c58e51694d2bb785550ccccb65 Mon Sep 17 00:00:00 2001 From: Milton Mazzarri Date: Mon, 9 Feb 2026 08:58:02 -0600 Subject: [PATCH] epub: void elements, such `wbr`, must be terminated by the matching end-tag Otherwise, it will produce error while parsing the XHTML in some EPUB readers. --- lib/ex_doc/formatter/html/templates.ex | 4 ++-- test/ex_doc/formatter/epub/templates_test.exs | 2 +- test/ex_doc/formatter/html/templates_test.exs | 2 +- test/ex_doc/formatter/html_test.exs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ex_doc/formatter/html/templates.ex b/lib/ex_doc/formatter/html/templates.ex index 798550fc6..f5983b36c 100644 --- a/lib/ex_doc/formatter/html/templates.ex +++ b/lib/ex_doc/formatter/html/templates.ex @@ -15,10 +15,10 @@ defmodule ExDoc.Formatter.HTML.Templates do end @doc """ - Returns the title with `` after each fullstop, allowing word breaks in long module names. + Returns the title with `` after each fullstop, allowing word breaks in long module names. """ def breakable_module_title(title) when is_binary(title) do - String.replace(title, ".", ".") + String.replace(title, ".", ".") end @doc """ diff --git a/test/ex_doc/formatter/epub/templates_test.exs b/test/ex_doc/formatter/epub/templates_test.exs index b69938fad..f0c66c2ef 100644 --- a/test/ex_doc/formatter/epub/templates_test.exs +++ b/test/ex_doc/formatter/epub/templates_test.exs @@ -116,7 +116,7 @@ defmodule ExDoc.Formatter.EPUB.TemplatesTest do content = Templates.module_template(formatter_config(), module_node) assert content =~ ~r{XPTO.NestedModule [^<]*} - assert content =~ ~r{

\s*XPTO.NestedModule\s*} + assert content =~ ~r{

\s*XPTO.NestedModule\s*} end test "outputs the functions and docstrings" do diff --git a/test/ex_doc/formatter/html/templates_test.exs b/test/ex_doc/formatter/html/templates_test.exs index 47c5c14ff..e458b92c3 100644 --- a/test/ex_doc/formatter/html/templates_test.exs +++ b/test/ex_doc/formatter/html/templates_test.exs @@ -525,7 +525,7 @@ defmodule ExDoc.Formatter.HTML.TemplatesTest do test "add word breaks to title", context do content = get_module_template([CompiledWithDocs.Nested], context) - assert content =~ "CompiledWithDocs.Nested" + assert content =~ "CompiledWithDocs.Nested" end test "do not output overlapping functions, causing duplicate IDs", context do diff --git a/test/ex_doc/formatter/html_test.exs b/test/ex_doc/formatter/html_test.exs index 12976da95..0771c9123 100644 --- a/test/ex_doc/formatter/html_test.exs +++ b/test/ex_doc/formatter/html_test.exs @@ -117,7 +117,7 @@ defmodule ExDoc.Formatter.HTMLTest do assert content =~ ~r{

moduledoc

} assert content =~ - ~r{CompiledWithDocs.Nested} + ~r{CompiledWithDocs.Nested} assert content =~ ~r{mix task_with_docs}