* mdocml: correct spacing before inline equations
@ 2014-10-20 2:33 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-10-20 2:33 UTC (permalink / raw)
To: source
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-10-20 2:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-20 2:33 mdocml: correct spacing before inline equations schwarze
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).