aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/html.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-03-17 09:16:38 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-03-17 09:16:38 +0000
commit154c74a463b9f4d0c87a3161a60df5ce17c366c9 (patch)
tree71d24bb33de21624f0ddc202816da1a8e7025f9b /html.c
parent92c367a844f2f26d325d4ee6ca032894e94f7a06 (diff)
downloadmandoc-154c74a463b9f4d0c87a3161a60df5ce17c366c9.tar.gz
mandoc-154c74a463b9f4d0c87a3161a60df5ce17c366c9.tar.zst
mandoc-154c74a463b9f4d0c87a3161a60df5ce17c366c9.zip
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.
Diffstat (limited to 'html.c')
-rw-r--r--html.c44
1 files changed, 6 insertions, 38 deletions
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 <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;
}