From: Ingo Schwarze <schwarze@usta.de>
To: "Anthony J. Bentley" <anthony@anjbe.name>
Cc: tech@mandoc.bsd.lv
Subject: Re: eqn(7) "delim" is undocumented (maybe)
Date: Wed, 8 Jan 2020 13:21:48 +0100 [thread overview]
Message-ID: <20200108122148.GC49182@athene.usta.de> (raw)
In-Reply-To: <38466-1575794557.527458@DkTY.Emny.Ld6w>
Hi Anthony,
Anthony J. Bentley wrote on Sun, Dec 08, 2019 at 01:42:37AM -0700:
> As an aside, I expected these two examples to render the same, but they
> don't. Should they look the same, or am I misunderstanding how eqn(7)
> works?
>
> .\" "delim off sin(<pi>)"
> .EQ
> delim $$
> delim off
> .EN
> $sin { pi }$
This was is indeed misparsed and consequently misrendered
by mandoc(1); fixed by the following commit.
> .\" "$sin { pi }$"
> .EQ
> delim $$
> .EN
> .EQ
> delim off
> .EN
> $sin { pi }$
Thanks for reporting,
Ingo
Log Message:
-----------
Skip whitespace before tokens, too.
Bug found by bentley@ with input like "delim $$ delim off".
Modified Files:
--------------
mandoc:
eqn.c
mandoc/regress/eqn/delim:
Makefile
basic.in
basic.out_ascii
Added Files:
-----------
mandoc/regress/eqn/delim:
basic.out_utf8
Revision Data
-------------
Index: eqn.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/eqn.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -Leqn.c -Leqn.c -u -p -r1.83 -r1.84
--- eqn.c
+++ eqn.c
@@ -1,7 +1,7 @@
/* $Id$ */
/*
* Copyright (c) 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2014, 2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2014,2015,2017,2018,2020 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -399,6 +399,14 @@ eqn_next(struct eqn_node *ep, enum parse
case '"':
quoted = 1;
break;
+ case ' ':
+ case '\t':
+ case '~':
+ case '^':
+ if (quoted)
+ break;
+ ep->start++;
+ continue;
default:
break;
}
@@ -669,7 +677,7 @@ eqn_parse(struct eqn_node *ep)
if (ep->data == NULL)
return;
- ep->start = ep->end = ep->data + strspn(ep->data, " ^~");
+ ep->start = ep->end = ep->data;
next_tok:
tok = eqn_next(ep, MODE_TOK);
Index: Makefile
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/eqn/delim/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/eqn/delim/Makefile -Lregress/eqn/delim/Makefile -u -p -r1.2 -r1.3
--- regress/eqn/delim/Makefile
+++ regress/eqn/delim/Makefile
@@ -1,6 +1,7 @@
-# $OpenBSD: Makefile,v 1.2 2020/01/08 10:50:54 schwarze Exp $
+# $OpenBSD: Makefile,v 1.3 2020/01/08 12:09:14 schwarze Exp $
REGRESS_TARGETS = basic
+UTF8_TARGETS = basic
GOPTS = -e
SKIP_GROFF =
--- /dev/null
+++ regress/eqn/delim/basic.out_utf8
@@ -0,0 +1,10 @@
+DELIM-BASIC(1) General Commands Manual DELIM-BASIC(1)
+
+N\bNA\bAM\bME\bE
+ d\bde\bel\bli\bim\bm-\b-b\bba\bas\bsi\bic\bc – inline eqn delimiters
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ initial text α inline β γ inline [delta] ε inline ζ inline $eta$ inline θ
+ final text
+
+OpenBSD January 8, 2020 OpenBSD
Index: basic.out_ascii
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/eqn/delim/basic.out_ascii,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lregress/eqn/delim/basic.out_ascii -Lregress/eqn/delim/basic.out_ascii -u -p -r1.4 -r1.5
--- regress/eqn/delim/basic.out_ascii
+++ regress/eqn/delim/basic.out_ascii
@@ -5,6 +5,6 @@ N\bNA\bAM\bME\bE
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
initial text <alpha> inline <beta> <gamma> inline [delta] <epsilon>
- inline <zeta> final text
+ inline <zeta> inline $eta$ inline <theta> final text
OpenBSD January 8, 2020 OpenBSD
Index: basic.in
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/eqn/delim/basic.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lregress/eqn/delim/basic.in -Lregress/eqn/delim/basic.in -u -p -r1.3 -r1.4
--- regress/eqn/delim/basic.in
+++ regress/eqn/delim/basic.in
@@ -1,4 +1,4 @@
-.\" $OpenBSD: basic.in,v 1.3 2020/01/08 10:58:09 schwarze Exp $
+.\" $OpenBSD: basic.in,v 1.4 2020/01/08 12:09:14 schwarze Exp $
.Dd $Mdocdate$
.Dt DELIM-BASIC 1
.Os
@@ -19,4 +19,13 @@ inline [delta]
delim onepsilon
.EN
inline [zeta]
+.EQ
+delim $$
+delim off
+.EN
+inline $eta$
+.EQ
+delim on
+.EN
+inline $theta$
final text
--
To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv
prev parent reply other threads:[~2020-01-08 12:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-08 8:42 Anthony J. Bentley
2020-01-07 18:32 ` Ingo Schwarze
2020-01-10 10:53 ` Anthony J. Bentley
2020-01-08 12:21 ` Ingo Schwarze [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200108122148.GC49182@athene.usta.de \
--to=schwarze@usta.de \
--cc=anthony@anjbe.name \
--cc=tech@mandoc.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).