[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 31/62: [ms]: Fix Savannah #64013.
From: |
G. Branden Robinson |
Subject: |
[groff] 31/62: [ms]: Fix Savannah #64013. |
Date: |
Thu, 20 Apr 2023 06:14:33 -0400 (EDT) |
gbranden pushed a commit to branch branden-2023-04-20
in repository groff.
commit 5efa1cece9a9ae1069a7523fa57ab7dd8cc91704
Author: G. Branden Robinson <g.branden.robinson@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 05d8ca18a..b400e931c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2023-04-07 G. Branden Robinson <g.branden.robinson@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.robinson@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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 31/62: [ms]: Fix Savannah #64013.,
G. Branden Robinson <=