aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authormpickering <matthewtpickering@gmail.com>2014-08-20 18:11:37 +0100
committermpickering <matthewtpickering@gmail.com>2014-08-20 18:11:37 +0100
commit2cd049a1bf66f486e7110449854ceb253268fff7 (patch)
tree0e0dfc9ff828c6b290af219a514b6e25252c6623 /src/Text/Pandoc
parent27ea34489a8385701d3245cac10e21df6b59fbcf (diff)
downloadpandoc-2cd049a1bf66f486e7110449854ceb253268fff7.tar.gz
Txt2Tags reader: Header is now parsed only if standalone flag is set
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Txt2Tags.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Txt2Tags.hs b/src/Text/Pandoc/Readers/Txt2Tags.hs
index 3a51b9d84..dc221568c 100644
--- a/src/Text/Pandoc/Readers/Txt2Tags.hs
+++ b/src/Text/Pandoc/Readers/Txt2Tags.hs
@@ -91,7 +91,10 @@ readTxt2TagsNoMacros = readTxt2Tags def
parseT2T :: T2T Pandoc
parseT2T = do
- _ <- (Nothing <$ try blankline) <|> (Just <$> (count 3 anyLine))
+ -- Parse header if standalone flag is set
+ optional ((readerStandalone . stateOptions <$> getState)
+ >>= guard
+ >> (() <$ (try blankline) <|> () <$ (count 3 anyLine)))
config <- manyTill setting (notFollowedBy setting)
-- TODO: Handle settings better
let settings = foldr (\(k,v) -> B.setMeta k (MetaString v)) nullMeta config