diff options
-rw-r--r-- | regress/usr.bin/mandoc/eqn/matrix/Makefile | 6 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/eqn/matrix/empty.in | 17 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/eqn/matrix/empty.out_ascii | 9 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/eqn/matrix/empty.out_html | 1 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/eqn/unary/sqrt.in | 4 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/eqn/unary/sqrt.out_ascii | 4 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/eqn/unary/sqrt.out_html | 2 | ||||
-rw-r--r-- | usr.bin/mandoc/eqn_term.c | 13 |
8 files changed, 43 insertions, 13 deletions
diff --git a/regress/usr.bin/mandoc/eqn/matrix/Makefile b/regress/usr.bin/mandoc/eqn/matrix/Makefile index 5951f81cb67..113b9ac5c0b 100644 --- a/regress/usr.bin/mandoc/eqn/matrix/Makefile +++ b/regress/usr.bin/mandoc/eqn/matrix/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.1 2015/01/01 12:53:46 schwarze Exp $ +# $OpenBSD: Makefile,v 1.2 2017/02/12 14:13:23 schwarze Exp $ -REGRESS_TARGETS = basic -HTML_TARGETS = basic +REGRESS_TARGETS = basic empty +HTML_TARGETS = basic empty .include <bsd.regress.mk> diff --git a/regress/usr.bin/mandoc/eqn/matrix/empty.in b/regress/usr.bin/mandoc/eqn/matrix/empty.in new file mode 100644 index 00000000000..fda70b2f86a --- /dev/null +++ b/regress/usr.bin/mandoc/eqn/matrix/empty.in @@ -0,0 +1,17 @@ +.Dd February 12, 2017 +.Dt MATRIX-EMPTY 1 +.Os OpenBSD +.Sh NAME +.Nm matrix-empty +.Nd empty matrixes +.Sh DESCRIPTION +initial text +.EQ +left ( +matrix { } +right ) +left ( +matrix +right ) +.EN +final text diff --git a/regress/usr.bin/mandoc/eqn/matrix/empty.out_ascii b/regress/usr.bin/mandoc/eqn/matrix/empty.out_ascii new file mode 100644 index 00000000000..ca555848bb1 --- /dev/null +++ b/regress/usr.bin/mandoc/eqn/matrix/empty.out_ascii @@ -0,0 +1,9 @@ +MATRIX-EMPTY(1) General Commands Manual MATRIX-EMPTY(1) + +NNAAMMEE + mmaattrriixx--eemmppttyy - empty matrixes + +DDEESSCCRRIIPPTTIIOONN + initial text () () final text + +OpenBSD February 12, 2017 OpenBSD diff --git a/regress/usr.bin/mandoc/eqn/matrix/empty.out_html b/regress/usr.bin/mandoc/eqn/matrix/empty.out_html new file mode 100644 index 00000000000..4578d361172 --- /dev/null +++ b/regress/usr.bin/mandoc/eqn/matrix/empty.out_html @@ -0,0 +1 @@ +<mrow><mfenced open="(" close=")"><mrow></mrow></mfenced><mfenced open="(" close=")"><mrow></mrow></mfenced></mrow> diff --git a/regress/usr.bin/mandoc/eqn/unary/sqrt.in b/regress/usr.bin/mandoc/eqn/unary/sqrt.in index 359c3d7b664..b416da7c2cf 100644 --- a/regress/usr.bin/mandoc/eqn/unary/sqrt.in +++ b/regress/usr.bin/mandoc/eqn/unary/sqrt.in @@ -1,4 +1,4 @@ -.Dd October 10, 2014 +.Dd February 12, 2017 .Dt UNARY-SQRT 1 .Os OpenBSD .Sh NAME @@ -7,6 +7,6 @@ .Sh DESCRIPTION initial text .EQ -r = sqrt { x sup 2 + y sup 2 } +r = sqrt { x sup 2 + y sup 2 } + sqrt { } + sqrt .EN final text diff --git a/regress/usr.bin/mandoc/eqn/unary/sqrt.out_ascii b/regress/usr.bin/mandoc/eqn/unary/sqrt.out_ascii index 104df229b53..f109b77055a 100644 --- a/regress/usr.bin/mandoc/eqn/unary/sqrt.out_ascii +++ b/regress/usr.bin/mandoc/eqn/unary/sqrt.out_ascii @@ -4,6 +4,6 @@ NNAAMMEE uunnaarryy--ssqqrrtt - square root DDEESSCCRRIIPPTTIIOONN - initial text r = sqrt(x^2 + y^2) final text + initial text r = sqrt(x^2 + y^2) + sqrt() + sqrt final text -OpenBSD October 10, 2014 OpenBSD +OpenBSD February 12, 2017 OpenBSD diff --git a/regress/usr.bin/mandoc/eqn/unary/sqrt.out_html b/regress/usr.bin/mandoc/eqn/unary/sqrt.out_html index b868474dfb7..a828ff1dc48 100644 --- a/regress/usr.bin/mandoc/eqn/unary/sqrt.out_html +++ b/regress/usr.bin/mandoc/eqn/unary/sqrt.out_html @@ -1 +1 @@ -<mrow><mi>r</mi><mi>=</mi><msqrt><mrow><msup><mi>x</mi><mi>2</mi></msup><mi>+</mi><msup><mi>y</mi><mi>2</mi></msup></mrow></msqrt></mrow> +<mrow><mi>r</mi><mi>=</mi><msqrt><mrow><msup><mi>x</mi><mi>2</mi></msup><mi>+</mi><msup><mi>y</mi><mi>2</mi></msup></mrow></msqrt><mi>+</mi><msqrt><mrow></mrow></msqrt><mi>+</mi><msqrt></msqrt></mrow> diff --git a/usr.bin/mandoc/eqn_term.c b/usr.bin/mandoc/eqn_term.c index e9a579ca351..de10ee26b9c 100644 --- a/usr.bin/mandoc/eqn_term.c +++ b/usr.bin/mandoc/eqn_term.c @@ -1,7 +1,7 @@ -/* $OpenBSD: eqn_term.c,v 1.4 2015/01/01 15:34:43 schwarze Exp $ */ +/* $OpenBSD: eqn_term.c,v 1.5 2017/02/12 14:13:23 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -66,8 +66,10 @@ eqn_box(struct termp *p, const struct eqn_box *bp) if (bp->pos == EQNPOS_SQRT) { term_word(p, "sqrt"); - p->flags |= TERMP_NOSPACE; - eqn_box(p, bp->first); + if (bp->first != NULL) { + p->flags |= TERMP_NOSPACE; + eqn_box(p, bp->first); + } } else if (bp->type == EQN_SUBEXPR) { child = bp->first; eqn_box(p, child); @@ -91,7 +93,8 @@ eqn_box(struct termp *p, const struct eqn_box *bp) } } else { child = bp->first; - if (bp->type == EQN_MATRIX && child->type == EQN_LIST) + if (bp->type == EQN_MATRIX && + child != NULL && child->type == EQN_LIST) child = child->first; while (child != NULL) { eqn_box(p, |