gbranden pushed a commit to branch master
in repository groff.

commit af7f747eeca4bdeabac9d4d09fa1913c1efcb33b
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Tue Mar 4 08:14:36 2025 -0600

    [troff]: Implement recursive node dumping (5t/9).
    
    * src/roff/troff/node.h (class break_char_node): Specialize (override)
      `dump_properties()` for this class.
    
    * src/roff/troff/node.cpp (break_char_node::dump_properties): New member
      function reports values of `break code before`, `break code after`,
      and `terminal_color` properties.
    
    Changes `pline` request output as follows.
    
    -{"type": "break_char_node", "diversion level": 0, "is_special_node": 
false},
    +{"type": "break_char_node", "diversion level": 0, "is_special_node": 
false, "break code before": 2, "break code after": 0, "terminal_color": 
"default"},
---
 ChangeLog               |  9 +++++++++
 src/roff/troff/node.cpp | 11 +++++++++++
 2 files changed, 20 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 0ecf8c8fd..69f92871e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-03-04  G. Branden Robinson <g.branden.robin...@gmail.com>
+
+       * src/roff/troff/node.h (class break_char_node):
+       Specialize (override) `dump_properties()` for this class.
+       * src/roff/troff/node.cpp
+       (break_char_node::dump_properties): New member function reports
+       values of `break code before`, `break code after`, and
+       `terminal_color` properties.
+
 2025-03-04  G. Branden Robinson <g.branden.robin...@gmail.com>
 
        * src/roff/troff/node.h (class italic_corrected_node):
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 41e4ebd1a..e916a2bc4 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -2879,6 +2879,7 @@ public:
   bool causes_tprint();
   bool is_tag();
   int get_break_code();
+  void dump_properties();
 };
 
 break_char_node::break_char_node(node *n, int bc, int pbc, color *c, node *x)
@@ -2893,6 +2894,16 @@ break_char_node::break_char_node(node *n, int bc, int 
pbc, color *c,
 {
 }
 
+void break_char_node::dump_properties()
+{
+  node::dump_properties();
+  fprintf(stderr, ", \"break code before\": %d", break_code);
+  fprintf(stderr, ", \"break code after\": %d", prev_break_code);
+  fputs(", \"terminal_color\": ", stderr);
+  col->nm.json_dump();
+  fflush(stderr);
+}
+
 break_char_node::~break_char_node()
 {
   delete nodes;

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

Reply via email to