gbranden pushed a commit to branch master in repository groff. commit a9ede55a3b1317ab5e9023086d0287a17f341740 Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Mon Mar 17 02:02:15 2025 -0500
[troff]: Make `\b` and `\o` work with `troff -a`. Make bracket and overstrike nodes (created with `\b` and `\o`, respectively) produce approximate output. * src/roff/troff/node.h (class bracket_node, class overstrike_node): Declare `ascii_print` member function. * src/roff/troff/node.cpp (bracket_node::ascii_print) (overstrike_node::ascii_print): Implement `ascii_print` member function. --- ChangeLog | 11 +++++++++++ src/roff/troff/node.cpp | 10 ++++++++++ src/roff/troff/node.h | 2 ++ 3 files changed, 23 insertions(+) diff --git a/ChangeLog b/ChangeLog index 127f6c0fb..c2b515fab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2025-03-17 G. Branden Robinson <g.branden.robin...@gmail.com> + + [troff]: Make bracket and overstrike nodes (created with `\b` + and `\o`, respectively) produce approximate output. + + * src/roff/troff/node.h (class bracket_node) + (class overstrike_node): Declare `ascii_print` member function. + * src/roff/troff/node.cpp (bracket_node::ascii_print) + (overstrike_node::ascii_print): Implement `ascii_print` member + function. + 2025-03-17 G. Branden Robinson <g.branden.robin...@gmail.com> * src/roff/troff/node.cpp (composite_node::ascii_print): When diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp index 4bc0bf751..a0cfe138d 100644 --- a/src/roff/troff/node.cpp +++ b/src/roff/troff/node.cpp @@ -3769,6 +3769,11 @@ static void ascii_print_reverse_node_list(ascii_output_file *ascii, node *n) n->ascii_print(ascii); } +void bracket_node::ascii_print(ascii_output_file *ascii) +{ + ascii_print_reverse_node_list(ascii, nodes); +} + void dbreak_node::ascii_print(ascii_output_file *ascii) { ascii_print_reverse_node_list(ascii, none); @@ -3784,6 +3789,11 @@ void node::ascii_print(ascii_output_file *) { } +void overstrike_node::ascii_print(ascii_output_file *ascii) +{ + ascii_print_node_list(ascii, nodes); +} + void space_node::ascii_print(ascii_output_file *ascii) { if (!n.is_zero()) diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h index 3a9a92b71..0ac87d481 100644 --- a/src/roff/troff/node.h +++ b/src/roff/troff/node.h @@ -543,6 +543,7 @@ public: void tprint(troff_output_file *); void overstrike(node *); // add another node to be overstruck hunits width(); + void ascii_print(ascii_output_file *); bool is_same_as(node *); const char *type(); bool causes_tprint(); @@ -562,6 +563,7 @@ public: void tprint(troff_output_file *); void bracket(node *); // add another node to be overstruck hunits width(); + void ascii_print(ascii_output_file *); bool is_same_as(node *); const char *type(); bool causes_tprint(); _______________________________________________ groff-commit mailing list groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit