From 154c74a463b9f4d0c87a3161a60df5ce17c366c9 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Thu, 17 Mar 2011 09:16:38 +0000 Subject: Move mdoc_isdelim() into mandoc.h as mandoc_isdelim(). This allows the removal of manual delimiter checks in html.c and term.c. Finally, add the escaped period as a closing delimiter, removing a TODO to this effect. --- html.c | 44 ++++++-------------------------------------- 1 file changed, 6 insertions(+), 38 deletions(-) (limited to 'html.c') diff --git a/html.c b/html.c index c75b5b15..8e333ecb 100644 --- a/html.c +++ b/html.c @@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.128 2011/03/17 08:49:34 kristaps Exp $ */ +/* $Id: html.c,v 1.129 2011/03/17 09:16:38 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze @@ -514,29 +514,9 @@ void print_text(struct html *h, const char *word) { - if (word[0] && '\0' == word[1]) - switch (word[0]) { - case('.'): - /* FALLTHROUGH */ - case(','): - /* FALLTHROUGH */ - case(';'): - /* FALLTHROUGH */ - case(':'): - /* FALLTHROUGH */ - case('?'): - /* FALLTHROUGH */ - case('!'): - /* FALLTHROUGH */ - case(')'): - /* FALLTHROUGH */ - case(']'): - if ( ! (HTML_IGNDELIM & h->flags)) - h->flags |= HTML_NOSPACE; - break; - default: - break; - } + if (DELIM_CLOSE == mandoc_isdelim(word)) + if ( ! (HTML_IGNDELIM & h->flags)) + h->flags |= HTML_NOSPACE; if ( ! (HTML_NOSPACE & h->flags)) { /* Manage keeps! */ @@ -566,20 +546,8 @@ print_text(struct html *h, const char *word) h->flags &= ~HTML_IGNDELIM; - /* - * Note that we don't process the pipe: the parser sees it as - * punctuation, but we don't in terms of typography. - */ - if (word[0] && '\0' == word[1]) - switch (word[0]) { - case('('): - /* FALLTHROUGH */ - case('['): - h->flags |= HTML_NOSPACE; - break; - default: - break; - } + if (DELIM_OPEN == mandoc_isdelim(word)) + h->flags |= HTML_NOSPACE; } -- cgit v1.2.3-56-ge451