aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-07-02 03:48:07 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-07-02 03:48:07 +0000
commit7b965f63cfd7d1b9474221bad812a9d975b94b46 (patch)
tree8ffe9afac6db5a64ab38eb92dfd41deabe0271ff
parentc9939e9971e983553a2f3f786d124427b6d4e16e (diff)
downloadmandoc-7b965f63cfd7d1b9474221bad812a9d975b94b46.tar.gz
mandoc-7b965f63cfd7d1b9474221bad812a9d975b94b46.tar.zst
mandoc-7b965f63cfd7d1b9474221bad812a9d975b94b46.zip
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--libmdoc.h3
-rw-r--r--mandoc.h4
-rw-r--r--mdoc.749
-rw-r--r--mdoc.c4
-rw-r--r--mdoc.h3
-rw-r--r--mdoc_argv.c8
-rw-r--r--mdoc_html.c33
-rw-r--r--mdoc_macro.c21
-rw-r--r--mdoc_man.c47
-rw-r--r--mdoc_term.c35
-rw-r--r--mdoc_validate.c43
-rw-r--r--read.c4
12 files changed, 186 insertions, 68 deletions
diff --git a/libmdoc.h b/libmdoc.h
index 2fdb77bb..f5b7d7f2 100644
--- a/libmdoc.h
+++ b/libmdoc.h
@@ -1,4 +1,4 @@
-/* $Id: libmdoc.h,v 1.84 2014/04/20 16:46:04 schwarze Exp $ */
+/* $Id: libmdoc.h,v 1.85 2014/07/02 03:48: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/mandoc.h b/mandoc.h
index be2f9f10..f61d28f0 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.125 2014/07/01 22:37:15 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.126 2014/07/02 03:48: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/mdoc.7 b/mdoc.7
index 0706a19b..a4aa1c70 100644
--- a/mdoc.7
+++ b/mdoc.7
@@ -1,4 +1,4 @@
-.\" $Id: mdoc.7,v 1.230 2014/06/24 21:43:08 schwarze Exp $
+.\" $Id: mdoc.7,v 1.231 2014/07/02 03:48: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
@@ -1487,8 +1487,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:
@@ -1514,8 +1520,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 .
@@ -1695,13 +1707,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:
@@ -2114,8 +2123,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
@@ -2890,6 +2903,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
@@ -2967,16 +2981,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
@@ -2993,7 +3006,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/mdoc.c b/mdoc.c
index 04e9d972..c050f00f 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.216 2014/07/01 22:37:15 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.217 2014/07/02 03:48: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>
@@ -516,6 +516,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/mdoc.h b/mdoc.h
index b6f3d96e..6b63b4e7 100644
--- a/mdoc.h
+++ b/mdoc.h
@@ -1,4 +1,4 @@
-/* $Id: mdoc.h,v 1.129 2014/04/20 16:46:05 schwarze Exp $ */
+/* $Id: mdoc.h,v 1.130 2014/07/02 03:48: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/mdoc_argv.c b/mdoc_argv.c
index e411d51a..cd5ab1f2 100644
--- a/mdoc_argv.c
+++ b/mdoc_argv.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_argv.c,v 1.93 2014/04/23 21:06:41 schwarze Exp $ */
+/* $Id: mdoc_argv.c,v 1.94 2014/07/02 03:48:07 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012 Ingo Schwarze <schwarze@openbsd.org>
@@ -179,7 +179,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 */
@@ -249,7 +249,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 */
@@ -260,7 +260,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/mdoc_html.c b/mdoc_html.c
index 2dc15c53..07a2e3ec 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.190 2014/04/23 16:08:33 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.191 2014/07/02 03:48:07 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -97,7 +97,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);
@@ -111,6 +110,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);
@@ -157,7 +157,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 */
@@ -227,7 +227,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 */
@@ -237,15 +237,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] = {
@@ -1545,7 +1545,7 @@ mdoc_sm_pre(MDOC_ARGS)
}
static int
-mdoc_ll_pre(MDOC_ARGS)
+mdoc_skip_pre(MDOC_ARGS)
{
return(0);
@@ -2085,6 +2085,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:
@@ -2128,7 +2134,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:
@@ -2150,6 +2157,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/mdoc_macro.c b/mdoc_macro.c
index 762f59e6..f16572d4 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.131 2014/04/20 16:46:05 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.132 2014/07/02 03:48:07 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -48,7 +48,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 *,
@@ -104,7 +103,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 */
@@ -191,7 +190,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 */
@@ -203,8 +202,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 */
@@ -1528,6 +1527,8 @@ in_line_argn(MACRO_PROT_ARGS)
break;
case MDOC_Bx:
/* FALLTHROUGH */
+ case MDOC_Es:
+ /* FALLTHROUGH */
case MDOC_Xr:
maxargs = 2;
break;
@@ -1715,14 +1716,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/mdoc_man.c b/mdoc_man.c
index 29bede8f..8dcfae74 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.63 2014/04/20 19:40:13 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.64 2014/07/02 03:48:07 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -51,6 +51,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);
@@ -78,8 +79,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);
@@ -150,7 +153,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"
@@ -224,7 +227,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 */
@@ -234,8 +237,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 */
@@ -1035,6 +1038,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)
{
@@ -1044,6 +1074,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/mdoc_term.c b/mdoc_term.c
index 93bb05ea..0039525a 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.267 2014/04/23 16:08:33 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.268 2014/07/02 03:48: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>
@@ -95,6 +95,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);
@@ -158,7 +159,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 */
@@ -228,7 +229,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 */
@@ -238,8 +239,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 */
@@ -1829,6 +1830,13 @@ termp_sp_pre(DECL_ARGS)
}
static int
+termp_es_pre(DECL_ARGS)
+{
+
+ return(0);
+}
+
+static int
termp_quote_pre(DECL_ARGS)
{
@@ -1860,6 +1868,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:
@@ -1897,7 +1911,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:
@@ -1924,6 +1939,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/mdoc_validate.c b/mdoc_validate.c
index 32f141de..01475f95 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.217 2014/07/01 22:37:15 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.218 2014/07/02 03:48:07 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -98,6 +98,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);
@@ -125,6 +127,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);
@@ -145,6 +148,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 };
@@ -173,6 +178,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 };
@@ -214,7 +220,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 */
@@ -284,7 +290,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 */
@@ -294,8 +300,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 */
@@ -931,6 +937,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)
{
@@ -1230,6 +1246,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/read.c b/read.c
index 097a62e8..2f9d79db 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.54 2014/07/01 22:37:15 schwarze Exp $ */
+/* $Id: read.c,v 1.55 2014/07/02 03:48:07 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -115,7 +115,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",