diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-09-04 10:02:49 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-09-04 10:02:49 -0700 |
commit | 4967fd42086b2680d4f9be864b1b0c14e35570ce (patch) | |
tree | 4523b87d2dfd62c239c6007c5aac39e147e0e8c9 /src/Text/Pandoc | |
parent | e4cca4cf67af31ce574ef2871d08f0719d4a50a5 (diff) | |
download | pandoc-4967fd42086b2680d4f9be864b1b0c14e35570ce.tar.gz |
Roff reader: more improvements in parsing conditionals.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/Roff.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/Roff.hs b/src/Text/Pandoc/Readers/Roff.hs index 18535353e..078413674 100644 --- a/src/Text/Pandoc/Readers/Roff.hs +++ b/src/Text/Pandoc/Readers/Roff.hs @@ -32,8 +32,7 @@ import Control.Monad (void, mzero, mplus, guard) import Control.Monad.Except (throwError) import Text.Pandoc.Class (getResourcePath, readFileFromDirs, PandocMonad(..), report) -import Data.Char (isLower, toLower, toUpper, chr, - isAscii, isAlphaNum) +import Data.Char (isLower, toLower, toUpper, chr, isAscii, isAlphaNum) import Data.Default (Default) import qualified Data.Map as M import Data.List (intercalate) @@ -488,7 +487,9 @@ lexConditional mname = do else expression skipMany spacetab st <- getState -- save state, so we can reset it - ifPart <- lexGroup <|> ((try (char '\\' >> newline)) >> manToken) + ifPart <- do + optional $ try $ char '\\' >> newline + lexGroup <|> do modifyState $ \s -> s{ afterConditional = True } t <- manToken modifyState $ \s -> s{ afterConditional = False } |