packages feed

doctemplates 0.1.0.2 → 0.2

raw patch · 4 files changed

+14/−2 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

README.md view
@@ -62,3 +62,5 @@ You may optionally specify separators using `$sep$`, as in the example above. +Anything between the sequence `$--` and the end of the line+will be treated as a comment.
doctemplates.cabal view
@@ -1,7 +1,7 @@ name:                doctemplates-version:             0.1.0.2+version:             0.2 synopsis:            Pandoc-style document templates-description:         Please see README.md+description:         A simple text templating system used by pandoc. homepage:            https://github.com/jgm/doctemplates#readme license:             BSD3 license-file:        LICENSE
src/Text/DocTemplates.hs view
@@ -215,6 +215,7 @@                             pFor <|>                             pNewline <|>                             pVar <|>+                            pComment <|>                             pLit <|>                             pEscapedDollar)   return $ sp <> rest@@ -242,6 +243,10 @@  pEscapedDollar :: Parser Template pEscapedDollar = lit "$" <$ P.try (P.string "$$")++pComment :: Parser Template+pComment =+  mempty <$ (P.try (P.string "$--") >> P.skipMany (P.satisfy (/='\n')))  pVar :: Parser Template pVar = var <$> (P.try $ P.char '$' *> pIdent <* P.char '$')
test/Spec.hs view
@@ -34,6 +34,11 @@         (object ["m" .= (5 :: Integer), "n" .= (7.3 :: Double)])         `shouldBe`         (Right "5 and 7.3" :: Either String Text)+    it "handles comments" $ do+      applyTemplate "hello $--there and $m$\nbar"+        (object ["m" .= (5 :: Integer)])+        `shouldBe`+        (Right "hello \nbar" :: Either String Text)     it "fails with an incorrect template" $ do       applyTemplate "$if(x$and$endif$" (object [])         `shouldBe`