summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2017-02-22 14:16:42 -0500
committerShaun McCance <shaunm@gnome.org>2017-02-22 14:16:42 -0500
commitdecc5890e1e38122f5ed94440d9744ffdc7e375b (patch)
treef1d0593cfde76e422d82b7fe08d8241f9b60c2c6
parent0fa70e34daa8eb59566dbbf9b04c6e915c54f3e8 (diff)
downloadyelp-tools-decc5890e1e38122f5ed94440d9744ffdc7e375b.tar.gz
yelp-check: Add --jing option to validate command to use jing
libxml2 doesn't always give the best error messages for validation failures. With this option, you can choose to use jing instead of xmllint, which might give you better error messages in some cases.
-rwxr-xr-xtools/yelp-check.in17
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/yelp-check.in b/tools/yelp-check.in
index 76732f2..526679d 100755
--- a/tools/yelp-check.in
+++ b/tools/yelp-check.in
@@ -270,6 +270,7 @@ yelp_usage_validate () {
echo " -s Treat pages as belonging to a Mallard site"
echo " --strict Disallow unknown namespaces"
echo " --allow NS Explicitly allow namespace NS in strict mode"
+ echo " --jing Use jing instead of xmllint for RNG validation"
) 1>&2
}
@@ -1060,7 +1061,11 @@ yelp_validate_db () {
if [ "x$major" = "x5" ]; then
check_out_file=`mktemp "${TMPDIR:-/tmp}"/yelp-XXXXXXXX`
rng_uri="http://docbook.org/xml/$version/rng/docbook.rng"
- xmllint --noout --xinclude --noent --relaxng "$rng_uri" "$1" > "$check_out_file" 2>&1
+ if [ "x$check_jing" = "x1" ]; then
+ jing -i "$rng_uri" "$1" > "$check_out_file" 2>&1
+ else
+ xmllint --noout --xinclude --noent --relaxng "$rng_uri" "$1" > "$check_out_file" 2>&1
+ fi
yelp_check_retval="$?"
cat "$check_out_file" | grep -v 'validates$'
rm "$check_out_file"
@@ -1112,7 +1117,11 @@ yelp_validate_page () {
--stringparam rng.strict.allow "$check_strict_allow" \
"$xsl_mal_rng" "$1"
fi
- xmllint --noout --xinclude --noent --relaxng "$check_rng_dir/$check_rng_file" "$1" > "$check_out_file" 2>&1
+ if [ "x$check_jing" = "x1" ]; then
+ jing -i "$check_rng_dir/$check_rng_file" "$1" > "$check_out_file" 2>&1
+ else
+ xmllint --noout --xinclude --noent --relaxng "$check_rng_dir/$check_rng_file" "$1" > "$check_out_file" 2>&1
+ fi
ret="$?"
cat "$check_out_file" | grep -v 'validates$'
rm "$check_out_file"
@@ -1142,6 +1151,10 @@ yelp_validate () {
check_strict_allow="$check_strict_allow $1"
shift
;;
+ "--jing")
+ check_jing="1"
+ shift
+ ;;
*)
break
;;