summaryrefslogtreecommitdiffstats
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
commite3df96e26436bd256a2aa5a33e49f9166ff6d4b6 (patch)
tree45cda180303addde16f0252611e2e4f7c28a619d /html.c
parentb115f948b8e55e6c3cef4bfa81f62c190af37a59 (diff)
downloadmandoc-e3df96e26436bd256a2aa5a33e49f9166ff6d4b6.tar.gz
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.c42
1 files changed, 5 insertions, 37 deletions
diff --git a/html.c b/html.c
index 5c042581..381a60ed 100644
--- a/html.c
+++ b/html.c
@@ -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;
}