diff options
-rw-r--r-- | man.c | 2 | ||||
-rw-r--r-- | man_term.c | 2 | ||||
-rw-r--r-- | mdoc.c | 2 | ||||
-rw-r--r-- | mdoc_term.c | 2 | ||||
-rw-r--r-- | roff.c | 14 |
5 files changed, 11 insertions, 11 deletions
@@ -345,6 +345,8 @@ man_addeqn(struct man *man, const struct eqn *ep) 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); @@ -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: @@ -205,6 +205,8 @@ mdoc_addeqn(struct mdoc *mdoc, const struct eqn *ep) 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); diff --git a/mdoc_term.c b/mdoc_term.c index a7266724..2ca44541 100644 --- a/mdoc_term.c +++ b/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: @@ -1872,19 +1872,11 @@ roff_eqndelim(struct roff *r, char **bufp, size_t *szp, int pos) 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; |