summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-07-02 03:47:08 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-07-02 03:47:08 +0000
commit3115104f4eeeff892c9b0b8c11ecaacf0960f527 (patch)
treec3e7c968ea48434a303d7f566d1004625abf834c
parent6378c10bd3dfa31237a2c50f0038d144c1b7597c (diff)
Implement the obsolete macros .En .Es .Fr .Ot for backward compatibility,
since this is hardly more complicated than explicitly ignoring them as we did in the past. Of course, do not use them!
-rw-r--r--regress/usr.bin/mandoc/mdoc/Eo/Makefile6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Eo/obsolete.in20
-rw-r--r--regress/usr.bin/mandoc/mdoc/Eo/obsolete.out_ascii14
-rw-r--r--regress/usr.bin/mandoc/mdoc/Eo/obsolete.out_lint6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fo/Makefile6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fo/obsolete.in12
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fo/obsolete.out_ascii11
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fo/obsolete.out_lint2
-rw-r--r--share/man/man7/mdoc.749
-rw-r--r--usr.bin/mandoc/libmdoc.h3
-rw-r--r--usr.bin/mandoc/mandoc.h4
-rw-r--r--usr.bin/mandoc/mdoc.c4
-rw-r--r--usr.bin/mandoc/mdoc.h3
-rw-r--r--usr.bin/mandoc/mdoc_argv.c8
-rw-r--r--usr.bin/mandoc/mdoc_html.c33
-rw-r--r--usr.bin/mandoc/mdoc_macro.c21
-rw-r--r--usr.bin/mandoc/mdoc_man.c47
-rw-r--r--usr.bin/mandoc/mdoc_term.c35
-rw-r--r--usr.bin/mandoc/mdoc_validate.c43
-rw-r--r--usr.bin/mandoc/read.c4
20 files changed, 259 insertions, 72 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/Eo/Makefile b/regress/usr.bin/mandoc/mdoc/Eo/Makefile
index 9483beafc90..caa50a0c9e1 100644
--- a/regress/usr.bin/mandoc/mdoc/Eo/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Eo/Makefile
@@ -1,5 +1,7 @@
-# $OpenBSD: Makefile,v 1.1 2012/07/09 22:36:04 schwarze Exp $
+# $OpenBSD: Makefile,v 1.2 2014/07/02 03:47:07 schwarze Exp $
-REGRESS_TARGETS = empty
+REGRESS_TARGETS = empty obsolete
+
+LINT_TARGETS = obsolete
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Eo/obsolete.in b/regress/usr.bin/mandoc/mdoc/Eo/obsolete.in
new file mode 100644
index 00000000000..fe0bb087f2d
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Eo/obsolete.in
@@ -0,0 +1,20 @@
+.Dd July 2, 2014
+.Dt EO-OBSOLETE 1
+.Os OpenBSD
+.Sh NAME
+.Nm Eo-obsolete
+.Nd obsolete enclosure macros
+.Sh DESCRIPTION
+.En no prior \&Es
+.Pp
+.Es << >> surplus
+initial text
+.En enclosed words with Fl flags
+middle text
+.En more enclosed words
+final text
+.Pp
+.Es
+initial text
+.En after empty \&Es
+final text
diff --git a/regress/usr.bin/mandoc/mdoc/Eo/obsolete.out_ascii b/regress/usr.bin/mandoc/mdoc/Eo/obsolete.out_ascii
new file mode 100644
index 00000000000..2dd5b76d86c
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Eo/obsolete.out_ascii
@@ -0,0 +1,14 @@
+EO-OBSOLETE(1) OpenBSD Reference Manual EO-OBSOLETE(1)
+
+NNAAMMEE
+ EEoo--oobbssoolleettee - obsolete enclosure macros
+
+DDEESSCCRRIIPPTTIIOONN
+ no prior Es
+
+ surplus initial text <<enclosed words with --ffllaaggss>> middle text <<more
+ enclosed words>> final text
+
+ initial text after empty Es final text
+
+OpenBSD July 2, 2014 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Eo/obsolete.out_lint b/regress/usr.bin/mandoc/mdoc/Eo/obsolete.out_lint
new file mode 100644
index 00000000000..02d585d7dbd
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Eo/obsolete.out_lint
@@ -0,0 +1,6 @@
+mandoc: obsolete.in:8:2: WARNING: obsolete macro: En
+mandoc: obsolete.in:10:5: WARNING: obsolete macro: Es
+mandoc: obsolete.in:12:2: WARNING: obsolete macro: En
+mandoc: obsolete.in:14:2: WARNING: obsolete macro: En
+mandoc: obsolete.in:17:4: WARNING: obsolete macro: Es
+mandoc: obsolete.in:19:2: WARNING: obsolete macro: En
diff --git a/regress/usr.bin/mandoc/mdoc/Fo/Makefile b/regress/usr.bin/mandoc/mdoc/Fo/Makefile
index 88adf0c6490..e64899c66be 100644
--- a/regress/usr.bin/mandoc/mdoc/Fo/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Fo/Makefile
@@ -1,6 +1,8 @@
-# $OpenBSD: Makefile,v 1.7 2013/12/25 00:39:14 schwarze Exp $
+# $OpenBSD: Makefile,v 1.8 2014/07/02 03:47:07 schwarze Exp $
-REGRESS_TARGETS = basic section break noarg font eos
+REGRESS_TARGETS = basic section break noarg font eos obsolete
+
+LINT_TARGETS = obsolete
# groff does not handle .nr nS
diff --git a/regress/usr.bin/mandoc/mdoc/Fo/obsolete.in b/regress/usr.bin/mandoc/mdoc/Fo/obsolete.in
new file mode 100644
index 00000000000..4901cbd596a
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fo/obsolete.in
@@ -0,0 +1,12 @@
+.Dd July 2, 2014
+.Dt FO-OBSOLETE 1
+.Os OpenBSD
+.Sh NAME
+.Nm Fo-obsolete
+.Nd obsolete function macros
+.Sh DESCRIPTION
+old function type
+.Ot fortran
+.Pp
+function return value
+.Fr value
diff --git a/regress/usr.bin/mandoc/mdoc/Fo/obsolete.out_ascii b/regress/usr.bin/mandoc/mdoc/Fo/obsolete.out_ascii
new file mode 100644
index 00000000000..a6254c3a796
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fo/obsolete.out_ascii
@@ -0,0 +1,11 @@
+FO-OBSOLETE(1) OpenBSD Reference Manual FO-OBSOLETE(1)
+
+NNAAMMEE
+ FFoo--oobbssoolleettee - obsolete function macros
+
+DDEESSCCRRIIPPTTIIOONN
+ old function type _f_o_r_t_r_a_n
+
+ function return value _v_a_l_u_e
+
+OpenBSD July 2, 2014 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Fo/obsolete.out_lint b/regress/usr.bin/mandoc/mdoc/Fo/obsolete.out_lint
new file mode 100644
index 00000000000..c1ad3d858d6
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fo/obsolete.out_lint
@@ -0,0 +1,2 @@
+mandoc: obsolete.in:9:2: WARNING: obsolete macro: Ot
+mandoc: obsolete.in:12:2: WARNING: obsolete macro: Fr
diff --git a/share/man/man7/mdoc.7 b/share/man/man7/mdoc.7
index 0e03eb61b35..22bc0f5aa56 100644
--- a/share/man/man7/mdoc.7
+++ b/share/man/man7/mdoc.7
@@ -1,4 +1,4 @@
-.\" $OpenBSD: mdoc.7,v 1.112 2014/06/24 21:42:20 schwarze Exp $
+.\" $OpenBSD: mdoc.7,v 1.113 2014/07/02 03:47:07 schwarze Exp $
.\"
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2010, 2011, 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: June 24 2014 $
+.Dd $Mdocdate: July 2 2014 $
.Dt MDOC 7
.Os
.Sh NAME
@@ -1502,8 +1502,14 @@ See also
and
.Sx \&Sy .
.Ss \&En
-This macro is obsolete and ignored by
-.Xr mandoc 1 .
+This macro is obsolete.
+Use
+.Sx \&Eo
+or any of the other enclosure macros.
+.Pp
+It encloses its argument in the delimiters specified by the last
+.Sx \&Es
+macro.
.Ss \&Eo
An arbitrary enclosure.
Its syntax is as follows:
@@ -1529,8 +1535,14 @@ See also
.Sx \&Dv
for general constants.
.Ss \&Es
-This macro is obsolete and ignored by
-.Xr mandoc 1 .
+This macro is obsolete.
+Use
+.Sx \&Eo
+or any of the other enclosure macros.
+.Pp
+It takes two arguments, defining the delimiters to be used by subsequent
+.Sx \&En
+macros.
.Ss \&Ev
Environmental variables such as those specified in
.Xr environ 7 .
@@ -1710,13 +1722,10 @@ See also
and
.Sx \&Ft .
.Ss \&Fr
-This macro is obsolete and ignored by
-.Xr mandoc 1 .
-.Pp
-It was used to show function return values.
-The syntax was:
+This macro is obsolete.
+No replacement markup is needed.
.Pp
-.Dl Pf . Sx \&Fr Ar value
+It was used to show numerical function return values in an italic font.
.Ss \&Ft
A function type.
Its syntax is as follows:
@@ -2129,8 +2138,12 @@ See also
and
.Sx \&Dt .
.Ss \&Ot
-This macro is obsolete and ignored by
-.Xr mandoc 1 .
+This macro is obsolete.
+Use
+.Sx \&Ft
+instead; with
+.Xr mandoc 1 ,
+both have the same effect.
.Pp
Historical
.Nm
@@ -2905,6 +2918,7 @@ end of the line.
.It Sx \&D1 Ta \&No Ta \&Yes
.It Sx \&Dl Ta \&No Ta Yes
.It Sx \&Dq Ta Yes Ta Yes
+.It Sx \&En Ta Yes Ta Yes
.It Sx \&Op Ta Yes Ta Yes
.It Sx \&Pq Ta Yes Ta Yes
.It Sx \&Ql Ta Yes Ta Yes
@@ -2982,16 +2996,15 @@ then the macro accepts an arbitrary number of arguments.
.It Sx \&Dv Ta Yes Ta Yes Ta >0
.It Sx \&Dx Ta Yes Ta Yes Ta n
.It Sx \&Em Ta Yes Ta Yes Ta >0
-.It Sx \&En Ta \&No Ta \&No Ta 0
.It Sx \&Er Ta Yes Ta Yes Ta >0
-.It Sx \&Es Ta \&No Ta \&No Ta 0
+.It Sx \&Es Ta Yes Ta Yes Ta 2
.It Sx \&Ev Ta Yes Ta Yes Ta >0
.It Sx \&Ex Ta \&No Ta \&No Ta n
.It Sx \&Fa Ta Yes Ta Yes Ta >0
.It Sx \&Fd Ta \&No Ta \&No Ta >0
.It Sx \&Fl Ta Yes Ta Yes Ta n
.It Sx \&Fn Ta Yes Ta Yes Ta >0
-.It Sx \&Fr Ta \&No Ta \&No Ta n
+.It Sx \&Fr Ta Yes Ta Yes Ta >0
.It Sx \&Ft Ta Yes Ta Yes Ta >0
.It Sx \&Fx Ta Yes Ta Yes Ta n
.It Sx \&Hf Ta \&No Ta \&No Ta n
@@ -3008,7 +3021,7 @@ then the macro accepts an arbitrary number of arguments.
.It Sx \&Ns Ta Yes Ta Yes Ta 0
.It Sx \&Nx Ta Yes Ta Yes Ta n
.It Sx \&Os Ta \&No Ta \&No Ta n
-.It Sx \&Ot Ta \&No Ta \&No Ta n
+.It Sx \&Ot Ta Yes Ta Yes Ta >0
.It Sx \&Ox Ta Yes Ta Yes Ta n
.It Sx \&Pa Ta Yes Ta Yes Ta n
.It Sx \&Pf Ta Yes Ta Yes Ta 1
diff --git a/usr.bin/mandoc/libmdoc.h b/usr.bin/mandoc/libmdoc.h
index 698a22a860c..363751ceb91 100644
--- a/usr.bin/mandoc/libmdoc.h
+++ b/usr.bin/mandoc/libmdoc.h
@@ -1,4 +1,4 @@
-/* $Id: libmdoc.h,v 1.54 2014/04/20 16:44:44 schwarze Exp $ */
+/* $Id: libmdoc.h,v 1.55 2014/07/02 03:47:07 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -41,6 +41,7 @@ struct mdoc {
enum mdoc_next next; /* where to put the next node */
struct mdoc_node *last; /* the last node parsed */
struct mdoc_node *first; /* the first node parsed */
+ struct mdoc_node *last_es; /* the most recent Es node */
struct mdoc_meta meta; /* document meta-data */
enum mdoc_sec lastnamed;
enum mdoc_sec lastsec;
diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h
index b800670779f..f5be4374b90 100644
--- a/usr.bin/mandoc/mandoc.h
+++ b/usr.bin/mandoc/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.69 2014/07/01 22:36:35 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.70 2014/07/02 03:47:07 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -71,7 +71,7 @@ enum mandocerr {
MANDOCERR_SEC_MSEC, /* unexpected section: title for ... only */
/* related to macros and nesting */
- MANDOCERR_MACROOBS, /* skipping obsolete macro */
+ MANDOCERR_MACRO_OBS, /* obsolete macro: macro */
MANDOCERR_IGNPAR, /* skipping paragraph macro */
MANDOCERR_MOVEPAR, /* moving paragraph macro out of list */
MANDOCERR_IGNNS, /* skipping no-space macro */
diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c
index 9efbee769d2..2203a693f96 100644
--- a/usr.bin/mandoc/mdoc.c
+++ b/usr.bin/mandoc/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.106 2014/07/01 22:36:35 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.107 2014/07/02 03:47:07 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -512,6 +512,8 @@ mdoc_block_alloc(struct mdoc *mdoc, int line, int pos,
/* FALLTHROUGH */
case MDOC_Bl:
/* FALLTHROUGH */
+ case MDOC_En:
+ /* FALLTHROUGH */
case MDOC_Rs:
p->norm = mandoc_calloc(1, sizeof(union mdoc_data));
break;
diff --git a/usr.bin/mandoc/mdoc.h b/usr.bin/mandoc/mdoc.h
index 0f60cb4e47c..caa51ecc62d 100644
--- a/usr.bin/mandoc/mdoc.h
+++ b/usr.bin/mandoc/mdoc.h
@@ -1,4 +1,4 @@
-/* $Id: mdoc.h,v 1.53 2014/04/20 16:44:44 schwarze Exp $ */
+/* $Id: mdoc.h,v 1.54 2014/07/02 03:47:07 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -338,6 +338,7 @@ union mdoc_data {
struct mdoc_bd Bd;
struct mdoc_bf Bf;
struct mdoc_bl Bl;
+ struct mdoc_node *Es;
struct mdoc_rs Rs;
};
diff --git a/usr.bin/mandoc/mdoc_argv.c b/usr.bin/mandoc/mdoc_argv.c
index e805aaa7dce..d33ac8a6539 100644
--- a/usr.bin/mandoc/mdoc_argv.c
+++ b/usr.bin/mandoc/mdoc_argv.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_argv.c,v 1.50 2014/04/23 21:06:33 schwarze Exp $ */
+/* $Id: mdoc_argv.c,v 1.51 2014/07/02 03:47:07 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012 Ingo Schwarze <schwarze@openbsd.org>
@@ -175,7 +175,7 @@ static const struct mdocarg mdocargs[MDOC_MAX] = {
{ ARGSFL_NONE, NULL }, /* Nd */
{ ARGSFL_DELIM, NULL }, /* Nm */
{ ARGSFL_DELIM, NULL }, /* Op */
- { ARGSFL_NONE, NULL }, /* Ot */
+ { ARGSFL_DELIM, NULL }, /* Ot */
{ ARGSFL_DELIM, NULL }, /* Pa */
{ ARGSFL_NONE, args_Ex }, /* Rv */
{ ARGSFL_DELIM, NULL }, /* St */
@@ -245,7 +245,7 @@ static const struct mdocarg mdocargs[MDOC_MAX] = {
{ ARGSFL_NONE, NULL }, /* Ek */
{ ARGSFL_NONE, NULL }, /* Bt */
{ ARGSFL_NONE, NULL }, /* Hf */
- { ARGSFL_NONE, NULL }, /* Fr */
+ { ARGSFL_DELIM, NULL }, /* Fr */
{ ARGSFL_NONE, NULL }, /* Ud */
{ ARGSFL_DELIM, NULL }, /* Lb */
{ ARGSFL_NONE, NULL }, /* Lp */
@@ -256,7 +256,7 @@ static const struct mdocarg mdocargs[MDOC_MAX] = {
{ ARGSFL_DELIM, NULL }, /* Brc */
{ ARGSFL_NONE, NULL }, /* %C */
{ ARGSFL_NONE, NULL }, /* Es */
- { ARGSFL_NONE, NULL }, /* En */
+ { ARGSFL_DELIM, NULL }, /* En */
{ ARGSFL_DELIM, NULL }, /* Dx */
{ ARGSFL_NONE, NULL }, /* %Q */
{ ARGSFL_NONE, NULL }, /* br */
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c
index 7ceb9e2396b..e4f3856642e 100644
--- a/usr.bin/mandoc/mdoc_html.c
+++ b/usr.bin/mandoc/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.73 2014/04/23 16:07:06 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.74 2014/07/02 03:47:07 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -93,7 +93,6 @@ static int mdoc_it_pre(MDOC_ARGS);
static int mdoc_lb_pre(MDOC_ARGS);
static int mdoc_li_pre(MDOC_ARGS);
static int mdoc_lk_pre(MDOC_ARGS);
-static int mdoc_ll_pre(MDOC_ARGS);
static int mdoc_mt_pre(MDOC_ARGS);
static int mdoc_ms_pre(MDOC_ARGS);
static int mdoc_nd_pre(MDOC_ARGS);
@@ -107,6 +106,7 @@ static int mdoc_quote_pre(MDOC_ARGS);
static int mdoc_rs_pre(MDOC_ARGS);
static int mdoc_rv_pre(MDOC_ARGS);
static int mdoc_sh_pre(MDOC_ARGS);
+static int mdoc_skip_pre(MDOC_ARGS);
static int mdoc_sm_pre(MDOC_ARGS);
static int mdoc_sp_pre(MDOC_ARGS);
static int mdoc_ss_pre(MDOC_ARGS);
@@ -153,7 +153,7 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = {
{mdoc_nd_pre, NULL}, /* Nd */
{mdoc_nm_pre, NULL}, /* Nm */
{mdoc_quote_pre, mdoc_quote_post}, /* Op */
- {NULL, NULL}, /* Ot */
+ {mdoc_ft_pre, NULL}, /* Ot */
{mdoc_pa_pre, NULL}, /* Pa */
{mdoc_rv_pre, NULL}, /* Rv */
{NULL, NULL}, /* St */
@@ -223,7 +223,7 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = {
{NULL, NULL}, /* Ek */
{mdoc_bt_pre, NULL}, /* Bt */
{NULL, NULL}, /* Hf */
- {NULL, NULL}, /* Fr */
+ {mdoc_em_pre, NULL}, /* Fr */
{mdoc_ud_pre, NULL}, /* Ud */
{mdoc_lb_pre, NULL}, /* Lb */
{mdoc_pp_pre, NULL}, /* Lp */
@@ -233,15 +233,15 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = {
{mdoc_quote_pre, mdoc_quote_post}, /* Bro */
{NULL, NULL}, /* Brc */
{mdoc__x_pre, mdoc__x_post}, /* %C */
- {NULL, NULL}, /* Es */ /* TODO */
- {NULL, NULL}, /* En */ /* TODO */
+ {mdoc_skip_pre, NULL}, /* Es */
+ {mdoc_quote_pre, mdoc_quote_post}, /* En */
{mdoc_xx_pre, NULL}, /* Dx */
{mdoc__x_pre, mdoc__x_post}, /* %Q */
{mdoc_sp_pre, NULL}, /* br */
{mdoc_sp_pre, NULL}, /* sp */
{mdoc__x_pre, mdoc__x_post}, /* %U */
{NULL, NULL}, /* Ta */
- {mdoc_ll_pre, NULL}, /* ll */
+ {mdoc_skip_pre, NULL}, /* ll */
};
static const char * const lists[LIST_MAX] = {
@@ -1541,7 +1541,7 @@ mdoc_sm_pre(MDOC_ARGS)
}
static int
-mdoc_ll_pre(MDOC_ARGS)
+mdoc_skip_pre(MDOC_ARGS)
{
return(0);
@@ -2081,6 +2081,12 @@ mdoc_quote_pre(MDOC_ARGS)
PAIR_CLASS_INIT(&tag, "opt");
print_otag(h, TAG_SPAN, 1, &tag);
break;
+ case MDOC_En:
+ if (NULL == n->norm->Es ||
+ NULL == n->norm->Es->child)
+ return(1);
+ print_text(h, n->norm->Es->child->string);
+ break;
case MDOC_Eo:
break;
case MDOC_Do:
@@ -2124,7 +2130,8 @@ mdoc_quote_post(MDOC_ARGS)
if (MDOC_BODY != n->type)
return;
- h->flags |= HTML_NOSPACE;
+ if (MDOC_En != n->tok)
+ h->flags |= HTML_NOSPACE;
switch (n->tok) {
case MDOC_Ao:
@@ -2146,6 +2153,14 @@ mdoc_quote_post(MDOC_ARGS)
case MDOC_Bq:
print_text(h, "\\(rB");
break;
+ case MDOC_En:
+ if (NULL != n->norm->Es &&
+ NULL != n->norm->Es->child &&
+ NULL != n->norm->Es->child->next) {
+ h->flags |= HTML_NOSPACE;
+ print_text(h, n->norm->Es->child->next->string);
+ }
+ break;
case MDOC_Eo:
break;
case MDOC_Qo:
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c
index f83a7502f43..7e7a282e21c 100644
--- a/usr.bin/mandoc/mdoc_macro.c
+++ b/usr.bin/mandoc/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.88 2014/04/20 16:44:44 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.89 2014/07/02 03:47:07 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -44,7 +44,6 @@ static int ctx_synopsis(MACRO_PROT_ARGS);
static int in_line_eoln(MACRO_PROT_ARGS);
static int in_line_argn(MACRO_PROT_ARGS);
static int in_line(MACRO_PROT_ARGS);
-static int obsolete(MACRO_PROT_ARGS);
static int phrase_ta(MACRO_PROT_ARGS);
static int dword(struct mdoc *, int, int, const char *,
@@ -100,7 +99,7 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
{ blk_full, MDOC_JOIN }, /* Nd */
{ ctx_synopsis, MDOC_CALLABLE | MDOC_PARSED }, /* Nm */
{ blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Op */
- { obsolete, 0 }, /* Ot */
+ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ot */
{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Pa */
{ in_line_eoln, 0 }, /* Rv */
{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* St */
@@ -187,7 +186,7 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
{ blk_exp_close, MDOC_EXPLICIT | MDOC_JOIN }, /* Ek */
{ in_line_eoln, 0 }, /* Bt */
{ in_line_eoln, 0 }, /* Hf */
- { obsolete, 0 }, /* Fr */
+ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Fr */
{ in_line_eoln, 0 }, /* Ud */
{ in_line, 0 }, /* Lb */
{ in_line_eoln, 0 }, /* Lp */
@@ -199,8 +198,8 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
{ blk_exp_close, MDOC_CALLABLE | MDOC_PARSED |
MDOC_EXPLICIT | MDOC_JOIN }, /* Brc */
{ in_line_eoln, MDOC_JOIN }, /* %C */
- { obsolete, 0 }, /* Es */
- { obsolete, 0 }, /* En */
+ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Es */
+ { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* En */
{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Dx */
{ in_line_eoln, MDOC_JOIN }, /* %Q */
{ in_line_eoln, 0 }, /* br */
@@ -1524,6 +1523,8 @@ in_line_argn(MACRO_PROT_ARGS)
break;
case MDOC_Bx:
/* FALLTHROUGH */
+ case MDOC_Es:
+ /* FALLTHROUGH */
case MDOC_Xr:
maxargs = 2;
break;
@@ -1711,14 +1712,6 @@ ctx_synopsis(MACRO_PROT_ARGS)
return(blk_part_imp(mdoc, tok, line, ppos, pos, buf));
}
-static int
-obsolete(MACRO_PROT_ARGS)
-{
-
- mdoc_pmsg(mdoc, line, ppos, MANDOCERR_MACROOBS);
- return(1);
-}
-
/*
* Phrases occur within `Bl -column' entries, separated by `Ta' or tabs.
* They're unusual because they're basically free-form text until a
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c
index 813a28a2b6a..1e4792e0a8a 100644
--- a/usr.bin/mandoc/mdoc_man.c
+++ b/usr.bin/mandoc/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.62 2014/04/20 19:39:35 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.63 2014/07/02 03:47:07 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -47,6 +47,7 @@ static void post_bf(DECL_ARGS);
static void post_bk(DECL_ARGS);
static void post_bl(DECL_ARGS);
static void post_dl(DECL_ARGS);
+static void post_en(DECL_ARGS);
static void post_enc(DECL_ARGS);
static void post_eo(DECL_ARGS);
static void post_fa(DECL_ARGS);
@@ -74,8 +75,10 @@ static int pre_bl(DECL_ARGS);
static int pre_br(DECL_ARGS);
static int pre_bx(DECL_ARGS);
static int pre_dl(DECL_ARGS);
+static int pre_en(DECL_ARGS);
static int pre_enc(DECL_ARGS);
static int pre_em(DECL_ARGS);
+static int pre_es(DECL_ARGS);
static int pre_fa(DECL_ARGS);
static int pre_fd(DECL_ARGS);
static int pre_fl(DECL_ARGS);
@@ -146,7 +149,7 @@ static const struct manact manacts[MDOC_MAX + 1] = {
{ cond_head, pre_enc, NULL, "\\- ", NULL }, /* Nd */
{ NULL, pre_nm, post_nm, NULL, NULL }, /* Nm */
{ cond_body, pre_enc, post_enc, "[", "]" }, /* Op */
- { NULL, NULL, NULL, NULL, NULL }, /* Ot */
+ { NULL, pre_ft, post_font, NULL, NULL }, /* Ot */
{ NULL, pre_em, post_font, NULL, NULL }, /* Pa */
{ NULL, pre_enc, post_enc, "The \\fB",
"\\fP\nfunction returns the value 0 if successful;\n"
@@ -220,7 +223,7 @@ static const struct manact manacts[MDOC_MAX + 1] = {
{ NULL, NULL, NULL, NULL, NULL }, /* Ek */
{ NULL, pre_ux, NULL, "is currently in beta test.", NULL }, /* Bt */
{ NULL, NULL, NULL, NULL, NULL }, /* Hf */
- { NULL, NULL, NULL, NULL, NULL }, /* Fr */
+ { NULL, pre_em, post_font, NULL, NULL }, /* Fr */
{ NULL, pre_ux, NULL, "currently under development.", NULL }, /* Ud */
{ NULL, NULL, post_lb, NULL, NULL }, /* Lb */
{ NULL, pre_pp, NULL, NULL, NULL }, /* Lp */
@@ -230,8 +233,8 @@ static const struct manact manacts[MDOC_MAX + 1] = {
{ cond_body, pre_enc, post_enc, "{", "}" }, /* Bro */
{ NULL, NULL, NULL, NULL, NULL }, /* Brc */
{ NULL, NULL, post_percent, NULL, NULL }, /* %C */
- { NULL, NULL, NULL, NULL, NULL }, /* Es */
- { NULL, NULL, NULL, NULL, NULL }, /* En */
+ { NULL, pre_es, NULL, NULL, NULL }, /* Es */
+ { cond_body, pre_en, post_en, NULL, NULL }, /* En */
{ NULL, pre_ux, NULL, "DragonFly", NULL }, /* Dx */
{ NULL, NULL, post_percent, NULL, NULL }, /* %Q */
{ NULL, pre_br, NULL, NULL, NULL }, /* br */
@@ -1031,6 +1034,33 @@ pre_em(DECL_ARGS)
return(1);
}
+static int
+pre_en(DECL_ARGS)
+{
+
+ if (NULL == n->norm->Es ||
+ NULL == n->norm->Es->child)
+ return(1);
+
+ print_word(n->norm->Es->child->string);
+ outflags &= ~MMAN_spc;
+ return(1);
+}
+
+static void
+post_en(DECL_ARGS)
+{
+
+ if (NULL == n->norm->Es ||
+ NULL == n->norm->Es->child ||
+ NULL == n->norm->Es->child->next)
+ return;
+
+ outflags &= ~MMAN_spc;
+ print_word(n->norm->Es->child->next->string);
+ return;
+}
+
static void
post_eo(DECL_ARGS)
{
@@ -1040,6 +1070,13 @@ post_eo(DECL_ARGS)
}
static int
+pre_es(DECL_ARGS)
+{
+
+ return(0);
+}
+
+static int
pre_fa(DECL_ARGS)
{
int am_Fa;
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index 8dde546e930..55b37af7133 100644
--- a/usr.bin/mandoc/mdoc_term.c
+++ b/usr.bin/mandoc/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.169 2014/04/23 16:07:06 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.170 2014/07/02 03:47:07 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -91,6 +91,7 @@ static int termp_bt_pre(DECL_ARGS);
static int termp_bx_pre(DECL_ARGS);
static int termp_cd_pre(DECL_ARGS);
static int termp_d1_pre(DECL_ARGS);
+static int termp_es_pre(DECL_ARGS);
static int termp_ex_pre(DECL_ARGS);
static int termp_fa_pre(DECL_ARGS);
static int termp_fd_pre(DECL_ARGS);
@@ -154,7 +155,7 @@ static const struct termact termacts[MDOC_MAX] = {
{ termp_nd_pre, NULL }, /* Nd */
{ termp_nm_pre, termp_nm_post }, /* Nm */
{ termp_quote_pre, termp_quote_post }, /* Op */
- { NULL, NULL }, /* Ot */
+ { termp_ft_pre, NULL }, /* Ot */
{ termp_under_pre, NULL }, /* Pa */
{ termp_rv_pre, NULL }, /* Rv */
{ NULL, NULL }, /* St */
@@ -224,7 +225,7 @@ static const struct termact termacts[MDOC_MAX] = {
{ NULL, NULL }, /* Ek */
{ termp_bt_pre, NULL }, /* Bt */
{ NULL, NULL }, /* Hf */
- { NULL, NULL }, /* Fr */
+ { termp_under_pre, NULL }, /* Fr */
{ termp_ud_pre, NULL }, /* Ud */
{ NULL, termp_lb_post }, /* Lb */
{ termp_sp_pre, NULL }, /* Lp */
@@ -234,8 +235,8 @@ static const struct termact termacts[MDOC_MAX] = {
{ termp_quote_pre, termp_quote_post }, /* Bro */
{ NULL, NULL }, /* Brc */
{ NULL, termp____post }, /* %C */
- { NULL, NULL }, /* Es */ /* TODO */
- { NULL, NULL }, /* En */ /* TODO */
+ { termp_es_pre, NULL }, /* Es */
+ { termp_quote_pre, termp_quote_post }, /* En */
{ termp_xx_pre, NULL }, /* Dx */
{ NULL, termp____post }, /* %Q */
{ termp_sp_pre, NULL }, /* br */
@@ -1825,6 +1826,13 @@ termp_sp_pre(DECL_ARGS)
}
static int
+termp_es_pre(DECL_ARGS)
+{
+
+ return(0);
+}
+
+static int
termp_quote_pre(DECL_ARGS)
{
@@ -1856,6 +1864,12 @@ termp_quote_pre(DECL_ARGS)
case MDOC_Dq:
term_word(p, "\\(lq");
break;
+ case MDOC_En:
+ if (NULL == n->norm->Es ||
+ NULL == n->norm->Es->child)
+ return(1);
+ term_word(p, n->norm->Es->child->string);
+ break;
case MDOC_Eo:
break;
case MDOC_Po:
@@ -1893,7 +1907,8 @@ termp_quote_post(DECL_ARGS)
if (MDOC_BODY != n->type && MDOC_ELEM != n->type)
return;
- p->flags |= TERMP_NOSPACE;
+ if (MDOC_En != n->tok)
+ p->flags |= TERMP_NOSPACE;
switch (n->tok) {
case MDOC_Ao:
@@ -1920,6 +1935,14 @@ termp_quote_post(DECL_ARGS)
case MDOC_Dq:
term_word(p, "\\(rq");
break;
+ case MDOC_En:
+ if (NULL != n->norm->Es &&
+ NULL != n->norm->Es->child &&
+ NULL != n->norm->Es->child->next) {
+ p->flags |= TERMP_NOSPACE;
+ term_word(p, n->norm->Es->child->next->string);
+ }
+ break;
case MDOC_Eo:
break;
case MDOC_Po:
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index 98e4c9c76d2..7feb696959a 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.135 2014/07/01 22:36:35 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.136 2014/07/02 03:47:07 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -94,6 +94,8 @@ static int post_bx(POST_ARGS);
static int post_defaults(POST_ARGS);
static int post_dd(POST_ARGS);
static int post_dt(POST_ARGS);
+static int post_en(POST_ARGS);
+static int post_es(POST_ARGS);
static int post_eoln(POST_ARGS);
static int post_hyph(POST_ARGS);
static int post_ignpar(POST_ARGS);
@@ -121,6 +123,7 @@ static int pre_display(PRE_ARGS);
static int pre_dt(PRE_ARGS);
static int pre_it(PRE_ARGS);
static int pre_literal(PRE_ARGS);
+static int pre_obsolete(PRE_ARGS);
static int pre_os(PRE_ARGS);
static int pre_par(PRE_ARGS);
static int pre_sh(PRE_ARGS);
@@ -141,6 +144,8 @@ static v_post posts_d1[] = { bwarn_ge1, post_hyph, NULL };
static v_post posts_dd[] = { post_dd, post_prol, NULL };
static v_post posts_dl[] = { post_literal, bwarn_ge1, NULL };
static v_post posts_dt[] = { post_dt, post_prol, NULL };
+static v_post posts_en[] = { post_en, NULL };
+static v_post posts_es[] = { post_es, NULL };
static v_post posts_fo[] = { hwarn_eq1, bwarn_ge1, NULL };
static v_post posts_hyph[] = { post_hyph, NULL };
static v_post posts_hyphtext[] = { ewarn_ge1, post_hyph, NULL };
@@ -169,6 +174,7 @@ static v_pre pres_dl[] = { pre_literal, pre_display, NULL };
static v_pre pres_dd[] = { pre_dd, NULL };
static v_pre pres_dt[] = { pre_dt, NULL };
static v_pre pres_it[] = { pre_it, pre_par, NULL };
+static v_pre pres_obsolete[] = { pre_obsolete, NULL };
static v_pre pres_os[] = { pre_os, NULL };
static v_pre pres_pp[] = { pre_par, NULL };
static v_pre pres_sh[] = { pre_sh, NULL };
@@ -210,7 +216,7 @@ static const struct valids mdoc_valids[MDOC_MAX] = {
{ NULL, posts_nd }, /* Nd */
{ NULL, posts_nm }, /* Nm */
{ NULL, NULL }, /* Op */
- { NULL, NULL }, /* Ot */
+ { pres_obsolete, NULL }, /* Ot */
{ NULL, posts_defaults }, /* Pa */
{ pres_std, posts_std }, /* Rv */
{ NULL, posts_st }, /* St */
@@ -280,7 +286,7 @@ static const struct valids mdoc_valids[MDOC_MAX] = {
{ NULL, NULL }, /* Ek */
{ NULL, posts_eoln }, /* Bt */
{ NULL, NULL }, /* Hf */
- { NULL, NULL }, /* Fr */
+ { pres_obsolete, NULL }, /* Fr */
{ NULL, posts_eoln }, /* Ud */
{ NULL, posts_lb }, /* Lb */
{ pres_pp, posts_pp }, /* Lp */
@@ -290,8 +296,8 @@ static const struct valids mdoc_valids[MDOC_MAX] = {
{ NULL, NULL }, /* Bro */
{ NULL, NULL }, /* Brc */
{ NULL, posts_text }, /* %C */
- { NULL, NULL }, /* Es */
- { NULL, NULL }, /* En */
+ { pres_obsolete, posts_es }, /* Es */
+ { pres_obsolete, posts_en }, /* En */
{ NULL, NULL }, /* Dx */
{ NULL, posts_text }, /* %Q */
{ NULL, posts_pp }, /* br */
@@ -927,6 +933,16 @@ pre_std(PRE_ARGS)
}
static int
+pre_obsolete(PRE_ARGS)
+{
+
+ if (MDOC_ELEM == n->type || MDOC_BLOCK == n->type)
+ mandoc_msg(MANDOCERR_MACRO_OBS, mdoc->parse,
+ n->line, n->pos, mdoc_macronames[n->tok]);
+ return(1);
+}
+
+static int
pre_dt(PRE_ARGS)
{
@@ -1226,6 +1242,23 @@ post_an(POST_ARGS)
}
static int
+post_en(POST_ARGS)
+{
+
+ if (MDOC_BLOCK == mdoc->last->type)
+ mdoc->last->norm->Es = mdoc->last_es;
+ return(1);
+}
+
+static int
+post_es(POST_ARGS)
+{
+
+ mdoc->last_es = mdoc->last;
+ return(1);
+}
+
+static int
post_it(POST_ARGS)
{
int i, cols;
diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c
index c9955f7b1b5..f5b7db17ad1 100644
--- a/usr.bin/mandoc/read.c
+++ b/usr.bin/mandoc/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.32 2014/07/01 22:36:35 schwarze Exp $ */
+/* $Id: read.c,v 1.33 2014/07/02 03:47:07 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -107,7 +107,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"unexpected section",
/* related to macros and nesting */
- "skipping obsolete macro",
+ "obsolete macro",
"skipping paragraph macro",
"moving paragraph macro out of list",
"skipping no-space macro",