From bd5500ba7f80632143e41a5fc70b29f9722d5f6c Mon Sep 17 00:00:00 2001 From: mb21 Date: Sat, 15 Sep 2018 12:09:13 +0200 Subject: add test yaml-metadata-blocks.md --- test/command/yaml-metadata-blocks.md | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 test/command/yaml-metadata-blocks.md (limited to 'test/command') diff --git a/test/command/yaml-metadata-blocks.md b/test/command/yaml-metadata-blocks.md new file mode 100644 index 000000000..eae69aa3d --- /dev/null +++ b/test/command/yaml-metadata-blocks.md @@ -0,0 +1,48 @@ +``` +% pandoc -s -t native +--- +foobar_: this should be ignored +foo: + bar_: as should this +--- +^D +Pandoc (Meta {unMeta = fromList [("foo",MetaMap (fromList []))]}) +[] +``` +``` +% pandoc -s -t native +--- +# For precedence, see multiple-metadata-blocks.md and vars-and-metadata.md +# For Bools, see also 4819.md +# For Multiline strings, see yaml-with-chomp.md +int: 7 +float: 1.5 +scientific: 3.7e-5 +bool: true +more: False +nothing: null +emtpy: [] +nested: + int: 8 + float: 2.5 + bool: true + more: False + nothing: null + emtpy: [] + scientific: 3.7e-5 +--- +^D +Pandoc (Meta {unMeta = fromList [("bool",MetaBool True),("emtpy",MetaList []),("float",MetaInlines [Str "1.5"]),("int",MetaInlines [Str "7"]),("more",MetaBool False),("nested",MetaMap (fromList [("bool",MetaBool True),("emtpy",MetaList []),("float",MetaInlines [Str "2.5"]),("int",MetaInlines [Str "8"]),("more",MetaBool False),("nothing",MetaInlines [Str "null"]),("scientific",MetaInlines [Str "3.7e-5"])])),("nothing",MetaInlines [Str "null"]),("scientific",MetaInlines [Str "3.7e-5"])]}) +[] +``` +``` +% pandoc -s -t native +--- +array: + - foo: bar + - bool: True +--- +^D +Pandoc (Meta {unMeta = fromList [("array",MetaList [MetaMap (fromList [("foo",MetaInlines [Str "bar"])]),MetaMap (fromList [("bool",MetaBool True)])])]}) +[] +``` -- cgit v1.2.3 From 5347e9454fae70cd2b534ad8e3c02d1cea8c2d93 Mon Sep 17 00:00:00 2001 From: mb21 Date: Sat, 15 Sep 2018 16:47:53 +0200 Subject: add test for --metadata-file --- pandoc.cabal | 1 + test/command/yaml-metadata-blocks.md | 15 +++++++++++++++ test/command/yaml-metadata.yaml | 4 ++++ 3 files changed, 20 insertions(+) create mode 100644 test/command/yaml-metadata.yaml (limited to 'test/command') diff --git a/pandoc.cabal b/pandoc.cabal index 86fe68dcf..591c1960c 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -193,6 +193,7 @@ extra-source-files: test/command/sub-file-chapter-1.tex test/command/sub-file-chapter-2.tex test/command/bar.tex + test/command/yaml-metadata.yaml test/command/3510-subdoc.org test/command/3510-export.latex test/command/3510-src.hs diff --git a/test/command/yaml-metadata-blocks.md b/test/command/yaml-metadata-blocks.md index eae69aa3d..5b73cff72 100644 --- a/test/command/yaml-metadata-blocks.md +++ b/test/command/yaml-metadata-blocks.md @@ -46,3 +46,18 @@ array: Pandoc (Meta {unMeta = fromList [("array",MetaList [MetaMap (fromList [("foo",MetaInlines [Str "bar"])]),MetaMap (fromList [("bool",MetaBool True)])])]}) [] ``` +``` +% pandoc -s -t native --metadata-file command/yaml-metadata.yaml +--- +title: document +--- +^D +Pandoc (Meta {unMeta = fromList [("other",MetaInlines [Emph [Str "markdown"],Space,Str "value"]),("title",MetaInlines [Str "document"])]}) +[] +``` +``` +% pandoc -s -t native --metadata-file command/yaml-metadata.yaml -M title=cmdline +^D +Pandoc (Meta {unMeta = fromList [("other",MetaInlines [Emph [Str "markdown"],Space,Str "value"]),("title",MetaString "cmdline")]}) +[] +``` diff --git a/test/command/yaml-metadata.yaml b/test/command/yaml-metadata.yaml new file mode 100644 index 000000000..9cd0043d3 --- /dev/null +++ b/test/command/yaml-metadata.yaml @@ -0,0 +1,4 @@ +--- +title: file +other: _markdown_ value +--- -- cgit v1.2.3