[yelp-tools] yelp-check: Add --jing option to validate command to use jing



commit decc5890e1e38122f5ed94440d9744ffdc7e375b
Author: Shaun McCance <shaunm gnome org>
Date:   Wed Feb 22 14:16:42 2017 -0500

    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.

 tools/yelp-check.in |   17 +++++++++++++++--
 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
                 ;;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]