gbranden pushed a commit to branch master
in repository groff.

commit a4ec302896e39bbbf70e3b119181ee4face28448
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Apr 12 05:37:46 2025 -0500

    [troff]: Make `pm` dump more macro data.
    
    * src/roff/troff/input.cpp (macro_header::json_dump): If a macro has
      non-zero "length", always dump both its "contents" _and_ its "node
      list".  The `asciify` and `unformat` requests produce a hybrid
      macro-diversion containing both.  Each null character in the
      "contents" corresponds to a node in the "node "list".
---
 ChangeLog                | 8 ++++++++
 src/roff/troff/input.cpp | 7 +++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 699b44478..f1e908aae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-04-12  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/input.cpp (macro_header::json_dump): If a macro
+       has non-zero "length", always dump both its "contents" _and_ its
+       "node list".  The `asciify` and `unformat` requests produce a
+       hybrid macro-diversion containing both.  Each null character in
+       the "contents" corresponds to a node in the "node "list".
+
 2025-04-12  G. Branden Robinson <[email protected]>
 
        [troff]: Adjust debugging/dump output.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 11d5f05a2..7a7d49a0e 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -3726,10 +3726,9 @@ void macro::json_dump()
   errprint("\"length\": %1", len);
   if (p != 0 /* nullptr */) {
     errprint(", ");
-    if (is_a_diversion)
-      p->json_dump_diversion();
-    else
-      p->json_dump_macro();
+    p->json_dump_macro();
+    errprint(", ");
+    p->json_dump_diversion();
   }
 }
 

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

Reply via email to