From d18d9623b1d5bed5c92ea665dbd24c0a572d356c Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Fri, 2 Nov 2018 22:50:18 -0700
Subject: [PATCH] Roff reader: conditionals: allow .\} to end group.

---
 src/Text/Pandoc/Readers/Roff.hs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/Text/Pandoc/Readers/Roff.hs b/src/Text/Pandoc/Readers/Roff.hs
index 179394e55..2bf2d070e 100644
--- a/src/Text/Pandoc/Readers/Roff.hs
+++ b/src/Text/Pandoc/Readers/Roff.hs
@@ -513,9 +513,9 @@ lexConditional mname = do
   skipMany spacetab
   st <- getState -- save state, so we can reset it
   ifPart <- lexGroup <|> ((try (char '\\' >> newline)) >> manToken)
-       <|> do modifyState $ \st -> st{ afterConditional = True }
+       <|> do modifyState $ \s -> s{ afterConditional = True }
               t <- manToken
-              modifyState $ \st -> st{ afterConditional = False }
+              modifyState $ \s -> s{ afterConditional = False }
               return t
   case mbtest of
     Nothing    -> do
@@ -548,7 +548,8 @@ lexGroup = do
   mconcat <$> manyTill manToken groupend
   where
     groupstart = try $ string "\\{\\" >> newline
-    groupend   = try $ string "\\}" >> eofline
+    groupend   = try $ optional (char '.' >> many spacetab) >>
+                       string "\\}" >> eofline
 
 lexIncludeFile :: PandocMonad m => [Arg] -> RoffLexer m RoffTokens
 lexIncludeFile args = do