=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_validate.c,v retrieving revision 1.301 retrieving revision 1.302 diff -c -r1.301 -r1.302 *** src/usr.bin/mandoc/mdoc_validate.c 2020/04/24 11:58:02 1.301 --- src/usr.bin/mandoc/mdoc_validate.c 2020/04/26 21:29:45 1.302 *************** *** 1,4 **** ! /* $OpenBSD: mdoc_validate.c,v 1.301 2020/04/24 11:58:02 schwarze Exp $ */ /* * Copyright (c) 2010-2020 Ingo Schwarze * Copyright (c) 2008-2012 Kristaps Dzonsons --- 1,4 ---- ! /* $OpenBSD: mdoc_validate.c,v 1.302 2020/04/26 21:29:45 schwarze Exp $ */ /* * Copyright (c) 2010-2020 Ingo Schwarze * Copyright (c) 2008-2012 Kristaps Dzonsons *************** *** 90,95 **** --- 90,96 ---- static void post_eoln(POST_ARGS); static void post_ex(POST_ARGS); static void post_fa(POST_ARGS); + static void post_fl(POST_ARGS); static void post_fn(POST_ARGS); static void post_fname(POST_ARGS); static void post_fo(POST_ARGS); *************** *** 148,154 **** post_ex, /* Ex */ post_fa, /* Fa */ NULL, /* Fd */ ! post_tag, /* Fl */ post_fn, /* Fn */ post_delim_nb, /* Ft */ post_tag, /* Ic */ --- 149,155 ---- post_ex, /* Ex */ post_fa, /* Fa */ NULL, /* Fd */ ! post_fl, /* Fl */ post_fn, /* Fn */ post_delim_nb, /* Ft */ post_tag, /* Ic */ *************** *** 1610,1615 **** --- 1611,1639 ---- { post_obsolete(mdoc); mdoc->last_es = mdoc->last; + } + + static void + post_fl(POST_ARGS) + { + struct roff_node *n; + char *cp; + + /* + * Transform ".Fl Fl long" to ".Fl \-long", + * resulting for example in better HTML output. + */ + + n = mdoc->last; + if (n->prev != NULL && n->prev->tok == MDOC_Fl && + n->prev->child == NULL && n->child != NULL && + (n->flags & NODE_LINE) == 0) { + mandoc_asprintf(&cp, "\\-%s", n->child->string); + free(n->child->string); + n->child->string = cp; + roff_node_delete(mdoc, n->prev); + } + post_tag(mdoc); } static void