From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: Suppress spacing before certain kinds of lists.
Date: Wed, 23 Aug 2017 15:03:20 -0500 (EST) [thread overview]
Message-ID: <17565971907597721292.enqueue@fantadrom.bsd.lv> (raw)
Log Message:
-----------
Suppress spacing before certain kinds of lists.
One benefit is a reduced probablity that a blank appears between
a function name and the opening parenthesis introducing the arguments.
The heuristics isn't perfect and may occasionally suppress a blank
that wouldn't do harm.
Modified Files:
--------------
mandoc:
eqn_term.c
gmdiff
mandoc/regress/eqn/matrix:
basic.out_ascii
Revision Data
-------------
Index: eqn_term.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/eqn_term.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -Leqn_term.c -Leqn_term.c -u -p -r1.13 -r1.14
--- eqn_term.c
+++ eqn_term.c
@@ -20,6 +20,7 @@
#include <sys/types.h>
#include <assert.h>
+#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -67,7 +68,16 @@ eqn_box(struct termp *p, const struct eq
((bp->parent->type == EQN_LIST && bp->expectargs == 1) ||
(bp->parent->type == EQN_SUBEXPR &&
bp->pos != EQNPOS_SQRT)))))) {
- if (bp->parent->type == EQN_SUBEXPR && bp->prev != NULL)
+ if ((bp->parent->type == EQN_SUBEXPR && bp->prev != NULL) ||
+ (bp->type == EQN_LIST &&
+ bp->first != NULL &&
+ bp->first->type != EQN_PILE &&
+ bp->first->type != EQN_MATRIX &&
+ bp->prev != NULL &&
+ (bp->prev->type == EQN_LIST ||
+ (bp->prev->type == EQN_TEXT &&
+ (*bp->prev->text == '\\' ||
+ isalpha((unsigned char)*bp->prev->text))))))
p->flags |= TERMP_NOSPACE;
term_word(p, bp->left != NULL ? bp->left : "(");
p->flags |= TERMP_NOSPACE;
@@ -98,9 +108,9 @@ eqn_box(struct termp *p, const struct eq
term_word(p, bp->pos == EQNPOS_OVER ? "/" :
(bp->pos == EQNPOS_SUP ||
bp->pos == EQNPOS_TO) ? "^" : "_");
- p->flags |= TERMP_NOSPACE;
child = child->next;
if (child != NULL) {
+ p->flags |= TERMP_NOSPACE;
eqn_box(p, child);
if (bp->pos == EQNPOS_FROMTO ||
bp->pos == EQNPOS_SUBSUP) {
Index: gmdiff
===================================================================
RCS file: /home/cvs/mandoc/mandoc/gmdiff,v
retrieving revision 1.8
retrieving revision 1.9
diff -Lgmdiff -Lgmdiff -u -p -r1.8 -r1.9
--- gmdiff
+++ gmdiff
@@ -34,7 +34,7 @@ elif [ "X$1" = "X-u" ]; then
ROFF="groff -ket -ww -Tutf8 -P -c"
MOPT="-Werror -Tutf8 $MOPT"
else
- ROFF="groff -et -ww -Tascii -P -c"
+ ROFF="groff -et -ww -mtty-char -Tascii -P -c"
MOPT="-Werror -Tascii $MOPT"
fi
Index: basic.out_ascii
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/eqn/matrix/basic.out_ascii,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lregress/eqn/matrix/basic.out_ascii -Lregress/eqn/matrix/basic.out_ascii -u -p -r1.3 -r1.4
--- regress/eqn/matrix/basic.out_ascii
+++ regress/eqn/matrix/basic.out_ascii
@@ -4,6 +4,6 @@ N\bNA\bAM\bME\bE
m\bma\bat\btr\bri\bix\bx-\b-b\bba\bas\bsi\bic\bc - matrixes in equations
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
- initial text ((_\ba_11 _\ba_21) (_\ba_12 _\ba_22)) (_\bb_1 _\bb_2) [sin s\bsi\bin\bn] final text
+ initial text ((_\ba_11 _\ba_21) (_\ba_12 _\ba_22)) (_\bb_1 _\bb_2)[sin s\bsi\bin\bn] final text
OpenBSD July 4, 2017 OpenBSD
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
reply other threads:[~2017-08-23 20:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=17565971907597721292.enqueue@fantadrom.bsd.lv \
--to=schwarze@mandoc.bsd.lv \
--cc=source@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).