aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--mandocdb.c6
-rw-r--r--mdoc_html.c32
-rw-r--r--mdoc_man.c25
-rw-r--r--mdoc_term.c28
-rw-r--r--mdoc_validate.c68
5 files changed, 55 insertions, 104 deletions
diff --git a/mandocdb.c b/mandocdb.c
index e498b996..241bbea0 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.235 2017/01/10 21:59:47 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.236 2017/01/10 23:36:34 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -239,13 +239,13 @@ static const struct mdoc_handler mdocs[MDOC_MAX] = {
{ NULL, 0, 0 }, /* Ac */
{ NULL, 0, 0 }, /* Ao */
{ NULL, 0, 0 }, /* Aq */
- { NULL, TYPE_At, 0 }, /* At */
+ { NULL, TYPE_At, NODE_NOSRC }, /* At */
{ NULL, 0, 0 }, /* Bc */
{ NULL, 0, 0 }, /* Bf */
{ NULL, 0, 0 }, /* Bo */
{ NULL, 0, 0 }, /* Bq */
{ NULL, TYPE_Bsx, NODE_NOSRC }, /* Bsx */
- { NULL, TYPE_Bx, 0 }, /* Bx */
+ { NULL, TYPE_Bx, NODE_NOSRC }, /* Bx */
{ NULL, 0, 0 }, /* Db */
{ NULL, 0, 0 }, /* Dc */
{ NULL, 0, 0 }, /* Do */
diff --git a/mdoc_html.c b/mdoc_html.c
index 402a847b..20b344fc 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.245 2017/01/10 21:59:47 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.246 2017/01/10 23:36:34 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -71,7 +71,6 @@ static void mdoc_bk_post(MDOC_ARGS);
static int mdoc_bk_pre(MDOC_ARGS);
static int mdoc_bl_pre(MDOC_ARGS);
static int mdoc_bt_pre(MDOC_ARGS);
-static int mdoc_bx_pre(MDOC_ARGS);
static int mdoc_cd_pre(MDOC_ARGS);
static int mdoc_d1_pre(MDOC_ARGS);
static int mdoc_dv_pre(MDOC_ARGS);
@@ -183,7 +182,7 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = {
{mdoc_quote_pre, mdoc_quote_post}, /* Bo */
{mdoc_quote_pre, mdoc_quote_post}, /* Bq */
{mdoc_xx_pre, NULL}, /* Bsx */
- {mdoc_bx_pre, NULL}, /* Bx */
+ {mdoc_xx_pre, NULL}, /* Bx */
{mdoc_skip_pre, NULL}, /* Db */
{NULL, NULL}, /* Dc */
{mdoc_quote_pre, mdoc_quote_post}, /* Do */
@@ -740,33 +739,6 @@ mdoc_xx_pre(MDOC_ARGS)
}
static int
-mdoc_bx_pre(MDOC_ARGS)
-{
- struct htmlpair tag;
-
- PAIR_CLASS_INIT(&tag, "unix");
- print_otag(h, TAG_SPAN, 1, &tag);
-
- if (NULL != (n = n->child)) {
- print_text(h, n->string);
- h->flags |= HTML_NOSPACE;
- print_text(h, "BSD");
- } else {
- print_text(h, "BSD");
- return 0;
- }
-
- if (NULL != (n = n->next)) {
- h->flags |= HTML_NOSPACE;
- print_text(h, "-");
- h->flags |= HTML_NOSPACE;
- print_text(h, n->string);
- }
-
- return 0;
-}
-
-static int
mdoc_it_pre(MDOC_ARGS)
{
struct roffsu su;
diff --git a/mdoc_man.c b/mdoc_man.c
index 30291909..594ade1f 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.99 2017/01/10 21:59:47 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.100 2017/01/10 23:36:34 schwarze Exp $ */
/*
* Copyright (c) 2011-2017 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -79,7 +79,6 @@ static int pre_bf(DECL_ARGS);
static int pre_bk(DECL_ARGS);
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);
@@ -183,7 +182,7 @@ static const struct manact manacts[MDOC_MAX + 1] = {
{ cond_body, pre_enc, post_enc, "[", "]" }, /* Bo */
{ cond_body, pre_enc, post_enc, "[", "]" }, /* Bq */
{ NULL, NULL, NULL, NULL, NULL }, /* Bsx */
- { NULL, pre_bx, NULL, NULL, NULL }, /* Bx */
+ { NULL, NULL, NULL, NULL, NULL }, /* Bx */
{ NULL, pre_skip, NULL, NULL, NULL }, /* Db */
{ NULL, NULL, NULL, NULL, NULL }, /* Dc */
{ cond_body, pre_enc, post_enc, "\\(Lq", "\\(Rq" }, /* Do */
@@ -1054,26 +1053,6 @@ pre_br(DECL_ARGS)
}
static int
-pre_bx(DECL_ARGS)
-{
-
- n = n->child;
- if (n) {
- print_word(n->string);
- outflags &= ~MMAN_spc;
- n = n->next;
- }
- print_word("BSD");
- if (NULL == n)
- return 0;
- outflags &= ~MMAN_spc;
- print_word("-");
- outflags &= ~MMAN_spc;
- print_word(n->string);
- return 0;
-}
-
-static int
pre_dl(DECL_ARGS)
{
diff --git a/mdoc_term.c b/mdoc_term.c
index 0442165a..9540b326 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.339 2017/01/10 21:59:47 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.340 2017/01/10 23:36:34 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -92,7 +92,6 @@ static int termp_bk_pre(DECL_ARGS);
static int termp_bl_pre(DECL_ARGS);
static int termp_bold_pre(DECL_ARGS);
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_eo_pre(DECL_ARGS);
@@ -191,7 +190,7 @@ static const struct termact termacts[MDOC_MAX] = {
{ termp_quote_pre, termp_quote_post }, /* Bo */
{ termp_quote_pre, termp_quote_post }, /* Bq */
{ termp_xx_pre, termp_xx_post }, /* Bsx */
- { termp_bx_pre, NULL }, /* Bx */
+ { NULL, NULL }, /* Bx */
{ termp_skip_pre, NULL }, /* Db */
{ NULL, NULL }, /* Dc */
{ termp_quote_pre, termp_quote_post }, /* Do */
@@ -1653,29 +1652,6 @@ termp_bd_post(DECL_ARGS)
}
static int
-termp_bx_pre(DECL_ARGS)
-{
-
- if (NULL != (n = n->child)) {
- term_word(p, n->string);
- p->flags |= TERMP_NOSPACE;
- term_word(p, "BSD");
- } else {
- term_word(p, "BSD");
- return 0;
- }
-
- if (NULL != (n = n->next)) {
- p->flags |= TERMP_NOSPACE;
- term_word(p, "-");
- p->flags |= TERMP_NOSPACE;
- term_word(p, n->string);
- }
-
- return 0;
-}
-
-static int
termp_xx_pre(DECL_ARGS)
{
if ((n->aux = p->flags & TERMP_PREKEEP) == 0)
diff --git a/mdoc_validate.c b/mdoc_validate.c
index e58f6030..b54c27c2 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.315 2017/01/10 21:59:47 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.316 2017/01/10 23:36:34 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -965,17 +965,11 @@ post_defaults(POST_ARGS)
static void
post_at(POST_ARGS)
{
- struct roff_node *n;
- const char *std_att;
- char *att;
+ struct roff_node *n, *nch;
+ const char *att;
n = mdoc->last;
- if (n->child == NULL) {
- mdoc->next = ROFF_NEXT_CHILD;
- roff_word_alloc(mdoc, n->line, n->pos, "AT&T UNIX");
- mdoc->last = n;
- return;
- }
+ nch = n->child;
/*
* If we have a child, look it up in the standard keys. If a
@@ -983,17 +977,19 @@ post_at(POST_ARGS)
* prefix "AT&T UNIX " to the existing data.
*/
- n = n->child;
- assert(n->type == ROFFT_TEXT);
- if ((std_att = mdoc_a2att(n->string)) == NULL) {
+ att = NULL;
+ if (nch != NULL && ((att = mdoc_a2att(nch->string)) == NULL))
mandoc_vmsg(MANDOCERR_AT_BAD, mdoc->parse,
- n->line, n->pos, "At %s", n->string);
- mandoc_asprintf(&att, "AT&T UNIX %s", n->string);
- } else
- att = mandoc_strdup(std_att);
+ nch->line, nch->pos, "At %s", nch->string);
- free(n->string);
- n->string = att;
+ mdoc->next = ROFF_NEXT_CHILD;
+ if (att != NULL) {
+ roff_word_alloc(mdoc, nch->line, nch->pos, att);
+ nch->flags |= NODE_NOPRT;
+ } else
+ roff_word_alloc(mdoc, n->line, n->pos, "AT&T UNIX");
+ mdoc->last->flags |= NODE_NOSRC;
+ mdoc->last = n;
}
static void
@@ -2112,7 +2108,36 @@ post_dt(POST_ARGS)
static void
post_bx(POST_ARGS)
{
- struct roff_node *n;
+ struct roff_node *n, *nch;
+
+ n = mdoc->last;
+ nch = n->child;
+
+ if (nch != NULL) {
+ mdoc->last = nch;
+ nch = nch->next;
+ mdoc->next = ROFF_NEXT_SIBLING;
+ roff_elem_alloc(mdoc, n->line, n->pos, MDOC_Ns);
+ mdoc->last->flags |= NODE_NOSRC;
+ mdoc->next = ROFF_NEXT_SIBLING;
+ } else
+ mdoc->next = ROFF_NEXT_CHILD;
+ roff_word_alloc(mdoc, n->line, n->pos, "BSD");
+ mdoc->last->flags |= NODE_NOSRC;
+
+ if (nch == NULL) {
+ mdoc->last = n;
+ return;
+ }
+
+ roff_elem_alloc(mdoc, n->line, n->pos, MDOC_Ns);
+ mdoc->last->flags |= NODE_NOSRC;
+ mdoc->next = ROFF_NEXT_SIBLING;
+ roff_word_alloc(mdoc, n->line, n->pos, "-");
+ mdoc->last->flags |= NODE_NOSRC;
+ roff_elem_alloc(mdoc, n->line, n->pos, MDOC_Ns);
+ mdoc->last->flags |= NODE_NOSRC;
+ mdoc->last = n;
/*
* Make `Bx's second argument always start with an uppercase
@@ -2120,8 +2145,7 @@ post_bx(POST_ARGS)
* uppercase blindly.
*/
- if ((n = mdoc->last->child) != NULL && (n = n->next) != NULL)
- *n->string = (char)toupper((unsigned char)*n->string);
+ *nch->string = (char)toupper((unsigned char)*nch->string);
}
static void