[yelp-tools] yelp-check: Mallard Sites support for validate



commit 370b139e1c4a6a5443cdaf28c8ffc67967e7ee1a
Author: Shaun McCance <shaunm gnome org>
Date:   Mon Jun 15 20:33:22 2015 -0400

    yelp-check: Mallard Sites support for validate

 tools/yelp-check.in |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/tools/yelp-check.in b/tools/yelp-check.in
index c5aa058..61884fa 100755
--- a/tools/yelp-check.in
+++ b/tools/yelp-check.in
@@ -810,6 +810,24 @@ yelp_status () {
     return 0
 }
 
+yelp_validate_db () {
+    version=$(echo "$docbook_version" | xsltproc - "$1")
+    major=$(echo "$version" | cut -c1)
+    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
+        yelp_check_retval="$?"
+        cat "$check_out_file" | grep -v 'validates$'
+        rm "$check_out_file"
+    elif xmllint --nocdata "$1" | grep -q '<!DOCTYPE'; then
+        xmllint --noout --xinclude --noent --postvalid "$1" || yelp_check_retval="$?"
+    else
+        dtd_uri='http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd'
+        xmllint --noout --xinclude --noent --dtdvalid "$dtd_uri" "$1" || yelp_check_retval="$?"
+    fi
+}
+
 yelp_validate_page () {
     # Using temp files because pipes create subshells, making it really
     # hard to return the right exit status in a portable way.
@@ -866,6 +884,11 @@ yelp_validate () {
     check_strict_allow=""
     while [ "$#" != "0" ]; do
         case "$1" in
+            "-s")
+                check_site="1"
+                check_site_root=$(pwd)
+                shift
+                ;;
             "--strict")
                 check_strict="true()"
                 shift
@@ -880,6 +903,11 @@ yelp_validate () {
                 ;;
         esac
     done
+    check_db=yelp_validate_db
+    check_page=yelp_validate_page
+    yelp_check_iter_args $@
+    exit $yelp_check_retval
+
     for xml in "$@"; do
         ext=`echo "$1" | sed -e 's/.*\.//'`
         if [ -d "$xml" ]; then


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