From 8dfb6885b4ca139f27de89b37393a0570defeee6 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Fri, 1 Jan 2010 13:17:58 +0000 Subject: `Fl' has each argument be in a separate scope (thanks Ingo Schwarze). Situation of `Fl [arg]* "" [arg]*' is fixed: empty arguments are ignored. Note that OpenBSD crashes when this happens. Situation of `Fl' is fixed wrt trailing whitespace. --- mdoc_html.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'mdoc_html.c') diff --git a/mdoc_html.c b/mdoc_html.c index 3fd57d1f..fef64209 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.49 2009/12/02 10:16:55 kristaps Exp $ */ +/* $Id: mdoc_html.c,v 1.50 2010/01/01 13:17:58 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -659,12 +659,33 @@ mdoc_fl_pre(MDOC_ARGS) { struct htmlpair tag; + /* `Cm' has no leading hyphen. */ + + if (MDOC_Cm == n->tok) { + PAIR_CLASS_INIT(&tag, "flag"); + print_otag(h, TAG_SPAN, 1, &tag); + return(1); + } + + /* A zero-length child shouldn't get a dash. */ + + if (n->child) { + assert(MDOC_TEXT == n->child->type); + assert(n->child->string); + if ('\0' == *n->child->string) + return(0); + } + PAIR_CLASS_INIT(&tag, "flag"); print_otag(h, TAG_SPAN, 1, &tag); - if (MDOC_Fl == n->tok) { - print_text(h, "\\-"); + + print_text(h, "\\-"); + + /* A blank `Fl' should incur a subsequent space. */ + + if (n->child) h->flags |= HTML_NOSPACE; - } + return(1); } -- cgit v1.2.3