diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-12-11 09:45:30 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-12-11 10:57:15 +0200 |
commit | 4413917ca5dfb53a6ca5f2c6fe78a2f948af0c36 (patch) | |
tree | 015dcdca2eebe2bb6f06ea97b4ea5fcbf952becd /pandoc-filter-diagram.md | |
parent | d4a3267c5486ffecada592d7e0889d6cfa5893a3 (diff) | |
download | pandoc-filter-diagram-4413917ca5dfb53a6ca5f2c6fe78a2f948af0c36.tar.gz |
feat(cli): write any errors to stderr, fail if requested
The command line program provided by the crate by default succeeds,
despite any errors. If PANDOC_FILTER_FAIL=1 is set in the environment,
it fails.
Sponsored-by: author
Diffstat (limited to 'pandoc-filter-diagram.md')
-rw-r--r-- | pandoc-filter-diagram.md | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/pandoc-filter-diagram.md b/pandoc-filter-diagram.md index 12520cb..30e3cf5 100644 --- a/pandoc-filter-diagram.md +++ b/pandoc-filter-diagram.md @@ -123,7 +123,7 @@ the HTML output, not referenced as an external image. ~~~scenario given an installed Rust program pandoc-filter-diagram given file plantuml.md -when I run pandoc --filter subplot-filter plantuml.md -o plantuml.html +when I run pandoc --filter pandoc-filter-diagram plantuml.md -o plantuml.html then file plantuml.html matches regex /img src="data:image/svg\+xml;base64,/ ~~~ @@ -252,3 +252,29 @@ blocked: - next ~~~ ~~~~~~~~ + + +# Command line tool + +The crate provides a command line tool `pandoc-filter-diagram`, for +use with the `pandoc --filter` option. By default, it ignores any +errors, but if the `PANDOC_FILTER_FAIL` environment variable is set +to 1, it fails if there were any errors. This scenario verifies that +this happens. The happy cases are already verified by other scenarios, +so this one only verifies handling of bad input. + +~~~scenario +given an installed Rust program pandoc-filter-diagram +given file bad.md +when I run pandoc --filter pandoc-filter-diagram bad.md -o bad.html +then exit code is 0 +when I try to run env PANDOC_FILTER_FAIL=1 pandoc --filter pandoc-filter-diagram bad.md -o bad.html +then command fails +~~~ + +~~~{#bad.md .file .markdown .numberLines} +trigraph "example" { +thing -> other +} +~~~ + |