]> git.cameronkatri.com Git - mandoc.git/blobdiff - out.c
Fixed a goddamn subtle error causing MDOC_LITERAL to remain set after a
[mandoc.git] / out.c
diff --git a/out.c b/out.c
index c365d9db2740abc88d384ee963043152821e53d2..2a683fae8ed4e7640ee4a5e898800677aebf1f7e 100644 (file)
--- 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.29 2010/08/29 11:28:09 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;
@@ -295,6 +315,8 @@ a2roffdeco(enum roffdeco *d, const char **word, size_t *sz)
                } else
                        lim = 1;
                break;
+       case ('o'):
+               /* FALLTHROUGH */
        case ('w'):
                if ('\'' == wp[i++]) {
                        term = '\'';