aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/out.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-08-24 13:56:51 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-08-24 13:56:51 +0000
commit92d36306307652f916347656b5c31928db651c45 (patch)
tree42c414f7d6f8442b851bfc7b4916ccc14808d38a /out.c
parentd99e0a75f565996f4d42d4f40627fc4951d4e98c (diff)
downloadmandoc-92d36306307652f916347656b5c31928db651c45.tar.gz
mandoc-92d36306307652f916347656b5c31928db651c45.tar.zst
mandoc-92d36306307652f916347656b5c31928db651c45.zip
Handle nested, recursive mathematical subexpressions. This is
definitely not general, but it's good enough for pod2man definitions (after I clean up the roff, which will be addressed in later fixes).
Diffstat (limited to 'out.c')
-rw-r--r--out.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/out.c b/out.c
index c365d9db..8be9514e 100644
--- a/out.c
+++ b/out.c
@@ -1,4 +1,4 @@
-/* $Id: out.c,v 1.27 2010/08/24 13:39:37 kristaps Exp $ */
+/* $Id: out.c,v 1.28 2010/08/24 13:56:51 kristaps Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -279,6 +279,26 @@ a2roffdeco(enum roffdeco *d, const char **word, size_t *sz)
i++;
}
+ /* Handle embedded numerical subexp or escape. */
+
+ if ('(' == wp[i]) {
+ while (wp[i] && ')' != wp[i])
+ if ('\\' == wp[i++]) {
+ /* Handle embedded escape. */
+ *word = &wp[i];
+ i += a2roffdeco(&dd, word, sz);
+ }
+
+ if (')' == wp[i++])
+ break;
+
+ *d = DECO_NONE;
+ return(i - 1);
+ } else if ('\\' == wp[i]) {
+ *word = &wp[++i];
+ i += a2roffdeco(&dd, word, sz);
+ }
+
break;
case ('['):
*d = DECO_SPECIAL;