From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: correct spacing before inline equations
Date: Sun, 19 Oct 2014 22:33:06 -0400 (EDT) [thread overview]
Message-ID: <201410200233.s9K2X6Ci022989@krisdoz.my.domain> (raw)
Log Message:
-----------
correct spacing before inline equations
Modified Files:
--------------
mdocml:
man.c
man_term.c
mdoc.c
mdoc_term.c
roff.c
Revision Data
-------------
Index: man_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_term.c,v
retrieving revision 1.151
retrieving revision 1.152
diff -Lman_term.c -Lman_term.c -u -p -r1.151 -r1.152
--- man_term.c
+++ man_term.c
@@ -987,6 +987,8 @@ print_man_node(DECL_ARGS)
goto out;
case MAN_EQN:
+ if ( ! (n->flags & MAN_LINE))
+ p->flags |= TERMP_NOSPACE;
term_eqn(p, n->eqn);
return;
case MAN_TBL:
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.283
retrieving revision 1.284
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.283 -r1.284
--- mdoc_term.c
+++ mdoc_term.c
@@ -344,6 +344,8 @@ print_mdoc_node(DECL_ARGS)
p->flags |= TERMP_NOSPACE;
break;
case MDOC_EQN:
+ if ( ! (n->flags & MDOC_LINE))
+ p->flags |= TERMP_NOSPACE;
term_eqn(p, n->eqn);
break;
case MDOC_TBL:
Index: man.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.c,v
retrieving revision 1.139
retrieving revision 1.140
diff -Lman.c -Lman.c -u -p -r1.139 -r1.140
--- man.c
+++ man.c
@@ -345,6 +345,8 @@ man_addeqn(struct man *man, const struct
n = man_node_alloc(man, ep->ln, ep->pos, MAN_EQN, MAN_MAX);
n->eqn = ep;
+ if (ep->ln > man->last->line)
+ n->flags |= MAN_LINE;
if ( ! man_node_append(man, n))
return(0);
Index: mdoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.c,v
retrieving revision 1.226
retrieving revision 1.227
diff -Lmdoc.c -Lmdoc.c -u -p -r1.226 -r1.227
--- mdoc.c
+++ mdoc.c
@@ -205,6 +205,8 @@ mdoc_addeqn(struct mdoc *mdoc, const str
n = node_alloc(mdoc, ep->ln, ep->pos, MDOC_MAX, MDOC_EQN);
n->eqn = ep;
+ if (ep->ln > mdoc->last->line)
+ n->flags |= MDOC_LINE;
if ( ! node_append(mdoc, n))
return(0);
Index: roff.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/roff.c,v
retrieving revision 1.231
retrieving revision 1.232
diff -Lroff.c -Lroff.c -u -p -r1.231 -r1.232
--- roff.c
+++ roff.c
@@ -1872,19 +1872,11 @@ roff_eqndelim(struct roff *r, char **buf
if (cp2 == NULL)
return(ROFF_CONT);
- /* Found a delimiter; get rid of surrounding blanks. */
-
- cp1 = cp2++;
- while (cp2[0] == ' ')
- cp2++;
- while (cp1[-1] == ' ')
- cp1--;
- *cp1 = '\0';
-
/* Replace the delimiter with an equation macro. */
- *szp = mandoc_asprintf(&cp1, "%s\n.E%s%s", *bufp,
- r->eqn == NULL ? "Q\n" : "N\n\\&", cp2) + 1;
+ *cp2++ = '\0';
+ *szp = mandoc_asprintf(&cp1, "%s%s%s", *bufp,
+ r->eqn == NULL ? "\\&\n.EQ\n" : "\n.EN\n\\&", cp2) + 1;
free(*bufp);
*bufp = cp1;
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2014-10-20 2:33 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=201410200233.s9K2X6Ci022989@krisdoz.my.domain \
--to=schwarze@mdocml.bsd.lv \
--cc=source@mdocml.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).