aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEven Brenden <[email protected]>2022-01-21 21:00:45 +0100
committerGitHub <[email protected]>2022-01-21 12:00:45 -0800
commit7df29e495f17b239f0e4b239fda849a1f27d2cf2 (patch)
treeccef8776c544d61ec5055e45f2713585c433c553 /test
parent672b6dc7e6cd5e9a0b614a37d15564a45446d9cb (diff)
Search for metadata files in $DATADIR/metadata (#7851)
If files specified with `--metadata-file` are not found in the working directory, look in `$DATADIR/metadata`. Expose new `readMetadataFile` function from Text.Pandoc.Class [API change]. Expose new `PandocCouldNotFindMetadataFileError` constructor for `PandocError` from Text.Pandoc.Error [API change]. Closes #5876.
Diffstat (limited to 'test')
-rw-r--r--test/command/5876.md58
-rw-r--r--test/command/5876.yaml3
-rw-r--r--test/command/5876/metadata/5876.yaml3
-rw-r--r--test/command/5876/metadata/command/5876.yaml3
4 files changed, 67 insertions, 0 deletions
diff --git a/test/command/5876.md b/test/command/5876.md
new file mode 100644
index 000000000..7671a89cf
--- /dev/null
+++ b/test/command/5876.md
@@ -0,0 +1,58 @@
+```
+% pandoc -s -t native --data-dir=command/5876 --metadata-file=5876.yaml
+Hello
+^D
+Pandoc
+ Meta
+ { unMeta =
+ fromList
+ [ ( "desc"
+ , MetaInlines
+ [ Str "Found"
+ , Space
+ , Str "in"
+ , Space
+ , Str "metadata"
+ , Space
+ , Str "directory."
+ ]
+ )
+ ]
+ }
+ [ Para [ Str "Hello" ] ]
+```
+```
+% pandoc -s -t native --data-dir=command/5876 --metadata-file=command/5876.yaml
+Hello
+^D
+Pandoc
+ Meta
+ { unMeta =
+ fromList
+ [ ( "desc"
+ , MetaInlines
+ [ Str "Found"
+ , Space
+ , Str "in"
+ , Space
+ , Str "working"
+ , Space
+ , Str "directory."
+ ]
+ )
+ ]
+ }
+ [ Para [ Str "Hello" ] ]
+```
+```
+% pandoc -s -t native --data-dir=command/5876 --metadata-file=does-not-exist.yaml
+Hello
+^D
+Could not find metadata file does-not-exist.yaml
+```
+```
+% pandoc -s -t native --metadata-file=does-not-exist.yaml
+Hello
+^D
+Could not find metadata file does-not-exist.yaml
+```
diff --git a/test/command/5876.yaml b/test/command/5876.yaml
new file mode 100644
index 000000000..9e6604922
--- /dev/null
+++ b/test/command/5876.yaml
@@ -0,0 +1,3 @@
+---
+desc: Found in working directory.
+---
diff --git a/test/command/5876/metadata/5876.yaml b/test/command/5876/metadata/5876.yaml
new file mode 100644
index 000000000..d52de910f
--- /dev/null
+++ b/test/command/5876/metadata/5876.yaml
@@ -0,0 +1,3 @@
+---
+desc: Found in metadata directory.
+---
diff --git a/test/command/5876/metadata/command/5876.yaml b/test/command/5876/metadata/command/5876.yaml
new file mode 100644
index 000000000..6bb46d51e
--- /dev/null
+++ b/test/command/5876/metadata/command/5876.yaml
@@ -0,0 +1,3 @@
+---
+desc: Should not be loaded.
+---