pandoc 2.2.3.1 → 2.2.3.2
raw patch · 6 files changed
+75/−4 lines, 6 files
Files
- MANUAL.txt +1/−1
- changelog +10/−0
- man/pandoc.1 +1/−1
- pandoc.cabal +1/−1
- src/Text/Pandoc/Readers/Markdown.hs +12/−1
- test/command/4819.md +50/−0
MANUAL.txt view
@@ -1,6 +1,6 @@ % Pandoc User's Guide % John MacFarlane-% August 6, 2018+% August 7, 2018 Synopsis ========
changelog view
@@ -1,3 +1,13 @@+pandoc (2.2.3.2)++ * Markdown reader: Properly handle boolean values in YAML metadata (#4819).+ This fixes a regression in 2.2.3, which cause boolean values to+ be parsed as MetaInlines instead of MetaBool.++ We here record another undocumented (but desirable) change in 2.2.3:+ numerical metadata fields are now parsed as MetaInlines rather than+ MetaString.+ pandoc (2.2.3.1) * Markdown reader: Fix parsing of embedded mappings in YAML metadata
man/pandoc.1 view
@@ -1,5 +1,5 @@ .\"t-.TH PANDOC 1 "August 6, 2018" "pandoc 2.2.3.1"+.TH PANDOC 1 "August 7, 2018" "pandoc 2.2.3.2" .SH NAME pandoc - general markup converter .SH SYNOPSIS
pandoc.cabal view
@@ -1,5 +1,5 @@ name: pandoc-version: 2.2.3.1+version: 2.2.3.2 cabal-version: 2.0 build-type: Custom license: GPL-2
src/Text/Pandoc/Readers/Markdown.hs view
@@ -301,6 +301,14 @@ -- not end in a newline, but a "block" set off with -- `|` or `>` will. +checkBoolean :: Text -> Maybe Bool+checkBoolean t =+ if t == T.pack "true" || t == T.pack "True" || t == T.pack "TRUE"+ then Just True+ else if t == T.pack "false" || t == T.pack "False" || t == T.pack "FALSE"+ then Just False+ else Nothing+ yamlToMeta :: PandocMonad m => YAML.Node -> MarkdownParser m (F MetaValue) yamlToMeta (YAML.Scalar x) =@@ -309,7 +317,10 @@ YAML.SBool b -> return $ return $ MetaBool b YAML.SFloat d -> return $ return $ MetaString (show d) YAML.SInt i -> return $ return $ MetaString (show i)- YAML.SUnknown _ t -> toMetaValue t+ YAML.SUnknown _ t ->+ case checkBoolean t of+ Just b -> return $ return $ MetaBool b+ Nothing -> toMetaValue t YAML.SNull -> return $ return $ MetaString "" yamlToMeta (YAML.Sequence _ xs) = do xs' <- mapM yamlToMeta xs
+ test/command/4819.md view
@@ -0,0 +1,50 @@+```+% pandoc -f markdown -t native -s+---+foo: 42+...+^D+Pandoc (Meta {unMeta = fromList [("foo",MetaInlines [Str "42"])]})+[]+```++```+% pandoc -f markdown -t native -s+---+foo: true+...+^D+Pandoc (Meta {unMeta = fromList [("foo",MetaBool True)]})+[]+```++```+% pandoc -f markdown -t native -s+---+foo: True+...+^D+Pandoc (Meta {unMeta = fromList [("foo",MetaBool True)]})+[]+```++```+% pandoc -f markdown -t native -s+---+foo: FALSE+...+^D+Pandoc (Meta {unMeta = fromList [("foo",MetaBool False)]})+[]+```++```+% pandoc -f markdown -t native -s+---+foo: no+...+^D+Pandoc (Meta {unMeta = fromList [("foo",MetaInlines [Str "no"])]})+[]+```+