mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
test(Makefile): add validate-docx-golden-test2
Add a validation rule based on OOXML-Validator which uses the Open-XML-SDK shipped and maintained as part of dotnet. This catches a few more issues compared to the .xsd. Unfortunately currently this executable always exits with 0 even when validation failed. That can be fixed later by invoking it from a script. Signed-off-by: Edwin Török <edwin@etorok.net>
This commit is contained in:
committed by
John MacFarlane
parent
333b0dd2ff
commit
3e360f5a3e
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
# based on validate-docx.sh, and adapted for OOXMLValidatorCLI
|
||||
# Modified by edwintorok from https://github.com/devoidfury/docx-validator
|
||||
# to look at more files than just document.xml.
|
||||
# Further modified by jgm for portability.
|
||||
|
||||
tmpdir=$(mktemp -d)
|
||||
error_files=""
|
||||
errors=0
|
||||
VALIDATOR=OOXML-Validator/bin/Release/*/OOXMLValidatorCLI
|
||||
|
||||
for file in "$@"; do
|
||||
file_errors=0
|
||||
echo "*** Checking $file"
|
||||
dotnet $(VALIDATOR) "${file}" 2>&1 || file_errors=1
|
||||
if [ $file_errors -gt 0 ]; then
|
||||
errors=$((file_errors + errors))
|
||||
error_files="$error_files\n$file"
|
||||
fi
|
||||
done
|
||||
if [ $errors -gt 0 ]; then
|
||||
echo "These files failed validation:$error_files"
|
||||
fi
|
||||
exit $errors
|
||||
Reference in New Issue
Block a user