mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
validate-docx.sh: print list of files that fail validation.
This commit is contained in:
+10
-1
@@ -3,8 +3,10 @@
|
||||
# to look at more files than just document.xml.
|
||||
# Further modified by jgm for portability.
|
||||
tmpdir=$(mktemp -d)
|
||||
error_files=""
|
||||
errors=0
|
||||
for file in "$@"; do
|
||||
file_errors=0
|
||||
echo "*** Checking $file"
|
||||
rm -rf "$tmpdir"
|
||||
unzip -q -o -j "$file" -d "$tmpdir"
|
||||
@@ -15,7 +17,14 @@ for file in "$@"; do
|
||||
for i in "$tmpdir"/*-pretty.xml; do
|
||||
xmllint -noout -nonet \
|
||||
-schema "${XSD}" \
|
||||
"${i}" 2>&1 || errors=$((errors + 1))
|
||||
"${i}" 2>&1 || file_errors=$((file_errors + 1))
|
||||
done
|
||||
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