aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-10-20 02:33:06 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-10-20 02:33:06 +0000
commit7881c2f8ae736bd068a654503612ac7b0e12a24f (patch)
tree96074f27c5f062010cf24a0d49750a3c4506a722
parent3ec112fadb4e9471c3f9de8c109a8f499000dae4 (diff)
downloadmandoc-7881c2f8ae736bd068a654503612ac7b0e12a24f.tar.gz
mandoc-7881c2f8ae736bd068a654503612ac7b0e12a24f.tar.zst
mandoc-7881c2f8ae736bd068a654503612ac7b0e12a24f.zip
correct spacing before inline equations
-rw-r--r--man.c4
-rw-r--r--man_term.c4
-rw-r--r--mdoc.c4
-rw-r--r--mdoc_term.c4
-rw-r--r--roff.c16
5 files changed, 16 insertions, 16 deletions
diff --git a/man.c b/man.c
index ef6a2c35..849ee7c0 100644
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.139 2014/09/06 23:24:32 schwarze Exp $ */
+/* $Id: man.c,v 1.140 2014/10/20 02:33:06 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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);
diff --git a/man_term.c b/man_term.c
index 3057d326..7153a074 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.151 2014/09/03 05:22:45 schwarze Exp $ */
+/* $Id: man_term.c,v 1.152 2014/10/20 02:33:06 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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:
diff --git a/mdoc.c b/mdoc.c
index 118fdcb5..d295aab2 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.226 2014/10/16 01:11:20 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.227 2014/10/20 02:33:06 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 e650beb5..ee36533f 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.283 2014/10/13 22:00:47 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.284 2014/10/20 02:33:06 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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:
diff --git a/roff.c b/roff.c
index 97ae08d8..a395b83c 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.231 2014/10/16 01:28:38 schwarze Exp $ */
+/* $Id: roff.c,v 1.232 2014/10/20 02:33:06 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;