gbranden pushed a commit to branch branden-2023-07-05 in repository groff. commit a7db3397fea3932a93fe4480259d600b37ac2f08 Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Fri Apr 7 20:22:46 2023 -0500
[ms]: Fix Savannah #64013. * tmac/s.tmac (@EQ): Revise argument handling. If there is only one argument and it is not a recognized alignment, warn and treat it as an equation label. If there are two arguments but the first is not a recognized alignment, throw a warning diagnostic (but still use default alignment with the second argument as label). An explicitly empty first argument is synonymous with "C". Fixes <https://savannah.gnu.org/bugs/?64013>. Also tested with: .LP .EQ "" (1) x + y = z .EN .EQ (2) \" expect warning pq = 0 .EN .EQ R (3) \" expect warning ab = 1 .EN .EQ E = mc sup 2 .EN --- ChangeLog | 14 ++++++++++++++ tmac/s.tmac | 25 +++++++++++++++++++------ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a32ca853..39fd3b9df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2023-04-07 G. Branden Robinson <g.branden.robin...@gmail.com> + + [ms]: Fix Savannah #64013. + + * tmac/s.tmac (@EQ): Revise argument handling. If there is only + one argument and it is not a recognized alignment, warn and + treat it as an equation label. If there are two arguments but + the first is not a recognized alignment, throw a warning + diagnostic (but still use default alignment with the second + argument as label). An explicitly empty first argument is + synonymous with "C". + + Fixes <https://savannah.gnu.org/bugs/?64013>. + 2023-04-07 G. Branden Robinson <g.branden.robin...@gmail.com> [ms]: Regression-test Savannah #64013. diff --git a/tmac/s.tmac b/tmac/s.tmac index 236594f89..dad2d6371 100644 --- a/tmac/s.tmac +++ b/tmac/s.tmac @@ -1885,14 +1885,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. .if \\n[tbl@within-table] \ . @error .EQ is not allowed within a .TS/.TE table .br +.nr eqn*type -1 .ds eqn*num "\\$2 -.ie '\\$1'L' .nr eqn*type 0 -.el \{\ -. ie '\\$1'I' .nr eqn*type 1 -. el \{\ -. nr eqn*type 2 -. if !'\\$1'C' .ds eqn*num "\\$1 +.if '\\$1'L' .nr eqn*type 0 +.if '\\$1'I' .nr eqn*type 1 +.if '\\$1'C' .nr eqn*type 2 +.if (\\n[eqn*type] < 0) \{\ +. ds eqn*msg .EQ: unrecognized alignment '\\$1'; +. ie (\\n[.$] = 1) \{\ +. if !'\\$1'' \{\ +. as eqn*msg " assuming it is an equation label +. @warning \\*[eqn*msg] +. ds eqn*num "\\$1 +. \} +. \} +. el .if (\\n[.$] > 1) \{\ +. if !'\\$1'' \{\ +. as eqn*msg " centering equation +. @warning \\*[eqn*msg] +. \} . \} +. rm eqn*msg .\} .di eqn*div .in 0 _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit