=================================================================== RCS file: /cvs/mandoc/mandocdb.c,v retrieving revision 1.210 retrieving revision 1.211 diff -u -p -r1.210 -r1.211 --- mandoc/mandocdb.c 2015/12/15 17:38:45 1.210 +++ mandoc/mandocdb.c 2016/01/04 14:44:57 1.211 @@ -1,7 +1,7 @@ -/* $Id: mandocdb.c,v 1.210 2015/12/15 17:38:45 schwarze Exp $ */ +/* $Id: mandocdb.c,v 1.211 2016/01/04 14:44:57 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons - * Copyright (c) 2011-2015 Ingo Schwarze + * Copyright (c) 2011-2016 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -156,8 +156,6 @@ static void parse_man(struct mpage *, const struct ro const struct roff_node *); static void parse_mdoc(struct mpage *, const struct roff_meta *, const struct roff_node *); -static int parse_mdoc_body(struct mpage *, const struct roff_meta *, - const struct roff_node *); static int parse_mdoc_head(struct mpage *, const struct roff_meta *, const struct roff_node *); static int parse_mdoc_Fd(struct mpage *, const struct roff_meta *, @@ -173,6 +171,8 @@ static int parse_mdoc_Nm(struct mpage *, const struct const struct roff_node *); static int parse_mdoc_Sh(struct mpage *, const struct roff_meta *, const struct roff_node *); +static int parse_mdoc_Va(struct mpage *, const struct roff_meta *, + const struct roff_node *); static int parse_mdoc_Xr(struct mpage *, const struct roff_meta *, const struct roff_node *); static void putkey(const struct mpage *, char *, uint64_t); @@ -242,8 +242,8 @@ static const struct mdoc_handler mdocs[MDOC_MAX] = { { NULL, TYPE_Pa }, /* Pa */ { NULL, 0 }, /* Rv */ { NULL, TYPE_St }, /* St */ - { NULL, TYPE_Va }, /* Va */ - { parse_mdoc_body, TYPE_Va }, /* Vt */ + { parse_mdoc_Va, TYPE_Va }, /* Va */ + { parse_mdoc_Va, TYPE_Vt }, /* Vt */ { parse_mdoc_Xr, 0 }, /* Xr */ { NULL, 0 }, /* %A */ { NULL, 0 }, /* %B */ @@ -1689,6 +1689,29 @@ parse_mdoc_Fo(struct mpage *mpage, const struct roff_m } static int +parse_mdoc_Va(struct mpage *mpage, const struct roff_meta *meta, + const struct roff_node *n) +{ + char *cp; + + if (n->type != ROFFT_ELEM && n->type != ROFFT_BODY) + return 0; + + if (n->nchild == 1 && n->child->type == ROFFT_TEXT) + return 1; + + cp = NULL; + deroff(&cp, n); + if (cp != NULL) { + putkey(mpage, cp, TYPE_Vt | (n->tok == MDOC_Va || + n->type == ROFFT_BODY ? TYPE_Va : 0)); + free(cp); + } + + return 0; +} + +static int parse_mdoc_Xr(struct mpage *mpage, const struct roff_meta *meta, const struct roff_node *n) { @@ -1754,14 +1777,6 @@ parse_mdoc_head(struct mpage *mpage, const struct roff { return n->type == ROFFT_HEAD; -} - -static int -parse_mdoc_body(struct mpage *mpage, const struct roff_meta *meta, - const struct roff_node *n) -{ - - return n->type == ROFFT_BODY; } /*