gbranden pushed a commit to branch master
in repository groff.

commit 40f7ca3dad43dc107a70334ea4dc54f6f637668d
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Sun Mar 16 10:11:56 2025 -0500

    [troff]: `pchar` dumps charinfo macro contents.
    
    * src/roff/troff/input.cpp (charinfo::dump): Dump user-defined character
      definitions' macro contents.  This is a JSON-encoded string, but the
      other character properties are traditionally reported.
    
    Illustration:
    
    $ printf '.char \\[Unhappy] \\s-2miserable\\s0\n.pchar \\[Unhappy]\n' \
            | ./build/test-groff
    special character "Unhappy"
      is not translated
      has a macro: "\\s-2miserable\\s0"
      special translation: 0
      hyphenation code: 0
      flags: 0
      ASCII code: 0
      asciify code: 0
      is found
      is transparently translatable
      is not translatable as input
      mode: normal
---
 ChangeLog                | 7 +++++++
 src/roff/troff/input.cpp | 7 +++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index da7ce7e94..697111077 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-03-16  G. Branden Robinson <g.branden.robin...@gmail.com>
+
+       * src/roff/troff/input.cpp (charinfo::dump): Dump user-defined
+       character definitions' macro contents.  This is a JSON-encoded
+       string, but the other character properties are traditionally
+       reported.
+
 2025-03-16  G. Branden Robinson <g.branden.robin...@gmail.com>
 
        * src/roff/troff/node.cpp (suppress_node::dump_properties):
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 71eec4fc8..6ad60425a 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -10254,8 +10254,11 @@ void charinfo::dump()
     errprint("  is translated\n");
   else
     errprint("  is not translated\n");
-  if (mac != 0 /* nullptr */)
-    errprint("  has a macro\n");
+  if (mac != 0 /* nullptr */) {
+    errprint("  has a macro: ");
+    mac->json_dump();
+    errprint("\n");
+  }
   else
     errprint("  does not have a macro\n");
   errprint("  special translation: %1\n",

_______________________________________________
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to