doctemplates 0.2 → 0.2.1
raw patch · 3 files changed
+10/−4 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- doctemplates.cabal +1/−1
- src/Text/DocTemplates.hs +8/−2
- test/Spec.hs +1/−1
doctemplates.cabal view
@@ -1,5 +1,5 @@ name: doctemplates-version: 0.2+version: 0.2.1 synopsis: Pandoc-style document templates description: A simple text templating system used by pandoc. homepage: https://github.com/jgm/doctemplates#readme
src/Text/DocTemplates.hs view
@@ -245,8 +245,14 @@ pEscapedDollar = lit "$" <$ P.try (P.string "$$") pComment :: Parser Template-pComment =- mempty <$ (P.try (P.string "$--") >> P.skipMany (P.satisfy (/='\n')))+pComment = do+ pos <- P.getPosition+ P.try (P.string "$--")+ P.skipMany (P.satisfy (/='\n'))+ -- If the comment begins in the first column, the line ending+ -- will be consumed; otherwise not.+ when (P.sourceColumn pos == 1) $ () <$ P.char '\n'+ return mempty pVar :: Parser Template pVar = var <$> (P.try $ P.char '$' *> pIdent <* P.char '$')
test/Spec.hs view
@@ -35,7 +35,7 @@ `shouldBe` (Right "5 and 7.3" :: Either String Text) it "handles comments" $ do- applyTemplate "hello $--there and $m$\nbar"+ applyTemplate "hello $--there and $m$\n$-- comment\nbar" (object ["m" .= (5 :: Integer)]) `shouldBe` (Right "hello \nbar" :: Either String Text)