Properly handle boolean values in writing YAML metadata.
(Markdown writer.) This requires doctemplates >= 0.9. Closes #6388.
This commit is contained in:
parent
8b872301eb
commit
b4b4e32307
5 changed files with 25 additions and 5 deletions
|
@ -410,7 +410,7 @@ library
|
|||
deepseq >= 1.3 && < 1.5,
|
||||
directory >= 1.2.3 && < 1.4,
|
||||
doclayout >= 0.3 && < 0.4,
|
||||
doctemplates >= 0.8.2 && < 0.9,
|
||||
doctemplates >= 0.9 && < 0.10,
|
||||
emojis >= 0.1 && < 0.2,
|
||||
exceptions >= 0.8 && < 0.11,
|
||||
file-embed >= 0.0 && < 0.1,
|
||||
|
@ -767,7 +767,7 @@ test-suite test-pandoc
|
|||
bytestring >= 0.9 && < 0.12,
|
||||
containers >= 0.4.2.1 && < 0.7,
|
||||
directory >= 1.2.3 && < 1.4,
|
||||
doctemplates >= 0.8.2 && < 0.9,
|
||||
doctemplates >= 0.9 && < 0.10,
|
||||
exceptions >= 0.8 && < 0.11,
|
||||
executable-path >= 0.0 && < 0.1,
|
||||
filepath >= 1.1 && < 1.5,
|
||||
|
|
|
@ -174,6 +174,8 @@ valToYaml :: Val Text -> Doc Text
|
|||
valToYaml (ListVal xs) =
|
||||
vcat $ map (\v -> hang 2 "- " (valToYaml v)) xs
|
||||
valToYaml (MapVal c) = contextToYaml c
|
||||
valToYaml (BoolVal True) = "true"
|
||||
valToYaml (BoolVal False) = "false"
|
||||
valToYaml (SimpleVal x)
|
||||
| isEmpty x = empty
|
||||
| otherwise =
|
||||
|
|
|
@ -109,8 +109,7 @@ metaValueToVal blockWriter inlineWriter (MetaMap metamap) =
|
|||
MapVal . Context <$> mapM (metaValueToVal blockWriter inlineWriter) metamap
|
||||
metaValueToVal blockWriter inlineWriter (MetaList xs) = ListVal <$>
|
||||
mapM (metaValueToVal blockWriter inlineWriter) xs
|
||||
metaValueToVal _ _ (MetaBool True) = return $ SimpleVal "true"
|
||||
metaValueToVal _ _ (MetaBool False) = return NullVal
|
||||
metaValueToVal _ _ (MetaBool b) = return $ BoolVal b
|
||||
metaValueToVal _ inlineWriter (MetaString s) =
|
||||
SimpleVal <$> inlineWriter (Builder.toList (Builder.text s))
|
||||
metaValueToVal blockWriter _ (MetaBlocks bs) = SimpleVal <$> blockWriter bs
|
||||
|
|
|
@ -16,7 +16,10 @@ extra-deps:
|
|||
- commonmark-0.1.1.2
|
||||
- commonmark-extensions-0.2.0.4
|
||||
- commonmark-pandoc-0.2.0.1
|
||||
- doctemplates-0.8.3
|
||||
# - doctemplates-0.8.3
|
||||
- doctemplates:
|
||||
git: https://github.com/jgm/doctemplates.git
|
||||
commit: 6cb8d09264f7c1f4b59ac67ff98b1a664a85e36a
|
||||
- citeproc-0.2.0.1
|
||||
# - citeproc:
|
||||
# git: https://github.com/jgm/citeproc.git
|
||||
|
|
16
test/command/6388.md
Normal file
16
test/command/6388.md
Normal file
|
@ -0,0 +1,16 @@
|
|||
```
|
||||
% pandoc -t markdown -s
|
||||
---
|
||||
nvalue: false
|
||||
value: true
|
||||
---
|
||||
|
||||
text
|
||||
^D
|
||||
---
|
||||
nvalue: false
|
||||
value: true
|
||||
---
|
||||
|
||||
text
|
||||
```
|
Loading…
Reference in a new issue