diff options
author | Shaun McCance <shaunm@gnome.org> | 2015-06-19 20:21:55 -0400 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2015-06-19 20:21:55 -0400 |
commit | af4d79bdccb1cf545b9cd38e16ed5a0d1730da67 (patch) | |
tree | 24bb5ed3a33635dd835a3d43c0f77f6be96a136d /tools | |
parent | 4ac06ef504c234144a10f3b5f5fd7cfcb5e138d3 (diff) | |
download | yelp-tools-af4d79bdccb1cf545b9cd38e16ed5a0d1730da67.tar.gz |
yelp-check: Support Mallard Sites for ids
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/yelp-check.in | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/tools/yelp-check.in b/tools/yelp-check.in index 9510f5a..ab0130e 100755 --- a/tools/yelp-check.in +++ b/tools/yelp-check.in @@ -139,6 +139,9 @@ yelp_usage_ids () { echo "" echo " Find pages in a Mallard document whose page ID does not match" echo " the base file name of the page file." + echo "" + echo "Options:" + echo " -s Treat pages as belonging to a Mallard site" ) 1>&2 } yelp_usage_links () { @@ -266,7 +269,7 @@ yelp_check_iter_args () { if [ "x$check_site" = "x1" ]; then yelp_check_iter_site "$arg" else - for page in "$arg"/*.page; do + for page in "${arg%%/}"/*.page; do if [ -e "$page" ]; then $check_page "$page" fi @@ -378,17 +381,19 @@ yelp_ids_page () { echo '</xsl:template>' echo '</xsl:stylesheet>' ) | xsltproc --xinclude - "$1") - if [ "$pageid.page" != `basename "$1"` ]; then + dname=$(dirname "$1") + bname=$(basename "$1") + if [ "x$pageid.page" != "x$bname" ]; then if [ "x$check_site" = "x1" ]; then sdir=$(cd $(dirname "$1") && pwd) sdir=${sdir##${check_site_root}}/ echo $sdir$(basename "$1")": $pageid" - elif [ `dirname "$1"` = '.' ]; then - echo $(basename "$1")": $pageid" + elif [ "x$dname" = 'x.' ]; then + echo "$bname: $pageid" else echo "$1: $pageid" fi - exit 1 + yelp_check_retval=1 fi } @@ -397,17 +402,26 @@ yelp_ids () { yelp_usage_ids exit 1 fi - ret=0 - for xml in "$@"; do - if [ -d "$xml" ]; then - for page in "$xml"/*.page; do - yelp_ids_page "$page" || ret=$? - done - else - yelp_ids_page "$xml" || ret=$? - fi + while [ "$#" != "0" ]; do + case "$1" in + "-s") + check_site="1" + check_site_root=$(pwd) + shift + ;; + *) + break + ;; + esac done - exit $ret + if [ "$#" = "0" -o "x$1" = "x--help" -o "x$1" = "x-h" ]; then + yelp_usage_ids + exit 1 + fi + check_db= + check_page=yelp_ids_page + yelp_check_iter_args "$@" + exit $yelp_check_retval } yelp_links_db () { |