gbranden pushed a commit to branch master
in repository groff.

commit 04d69ea374c7f06bf02065cea4b2bc1a304518ad
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Jul 13 08:19:18 2026 -0500

    [grohtml]: Emit fewer named entities in XHTML.
    
    * src/devices/grohtml/post-html.cpp (get_html_entity): Emit named
      character entities only for HTML 4, not XHTML, with the exception of
      the handful recognized by XML, already handled earlier in this
      function.
    
    This change uses Mulley's brace style and omits an indentation update to
    keep the logic change clear.
---
 ChangeLog                         | 7 +++++++
 src/devices/grohtml/post-html.cpp | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index b53938f33..5b860735b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2026-07-13  G. Branden Robinson <[email protected]>
+
+       * src/devices/grohtml/post-html.cpp (get_html_entity): Emit
+       named character entities only for HTML 4, not XHTML, with the
+       exception of the handful recognized by XML, already handled
+       earlier in this function.
+
 2026-07-13  G. Branden Robinson <[email protected]>
 
        * src/devices/grohtml/post-html.cpp (get_html_entity): Emit
diff --git a/src/devices/grohtml/post-html.cpp 
b/src/devices/grohtml/post-html.cpp
index efabbb1e9..bc33fc53c 100644
--- a/src/devices/grohtml/post-html.cpp
+++ b/src/devices/grohtml/post-html.cpp
@@ -4965,6 +4965,7 @@ static const char *get_html_entity (unsigned int code)
   } else if (CHARSET_UTF8 == charset_encoding) {
       return to_utf8_string(code);
   } else {
+    if (html4 == dialect) {
     switch (code) {
       case 0x00A0: return "&nbsp;";
       case 0x00A1: return "&iexcl;";
@@ -5207,6 +5208,10 @@ static const char *get_html_entity (unsigned int code)
                         ? to_utf8_string(code)
                         : to_numerical_char_ref(code));
     }
+    } else {
+      return (static_cast<bool>(charset_encoding)
+               ? to_utf8_string(code) : to_numerical_char_ref(code));
+    }
   }
 }
 

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to