[yelp-tools] yelp-check: Check media correctly in subdirs, #727557



commit 0191878e599e5b0a809ff1a7a2cbaa56728a0961
Author: Shaun McCance <shaunm gnome org>
Date:   Fri Apr 3 08:42:26 2015 -0400

    yelp-check: Check media correctly in subdirs, #727557

 tools/yelp-check.in |   13 +++++++++++--
 xslt/media.xsl      |    3 +++
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/tools/yelp-check.in b/tools/yelp-check.in
index 124d796..324775e 100755
--- a/tools/yelp-check.in
+++ b/tools/yelp-check.in
@@ -482,7 +482,15 @@ yelp_links () {
 yelp_media_page () {
     ext=`echo "$1" | sed -e 's/.*\.//'`
     bname=`basename "$1" ".$ext"`
-    xsltproc --stringparam basename "$bname" "$xsl_media" "$1"
+    dname=$(dirname "$xml")
+    if [ x"$dname" = "." ]; then
+        dname=""
+    else
+        dname="$dname"/
+    fi;
+    xsltproc --stringparam basename "$bname" \
+             --stringparam dirname "$dname" \
+             "$xsl_media" "$1"
 }
 
 yelp_media () {
@@ -499,8 +507,9 @@ yelp_media () {
             yelp_media_page "$xml"
         fi
     done | while read line; do
+        dname=$(dirname $(echo "$line" | cut -d' ' -f1))
         src=$(urldecode $(echo "$line" | cut -d' ' -f2))
-        if [ ! -f "$src" ]; then
+        if [ ! -f "$dname"/"$src" ]; then
             echo $line
         fi
     done
diff --git a/xslt/media.xsl b/xslt/media.xsl
index c000ea9..7a3b155 100644
--- a/xslt/media.xsl
+++ b/xslt/media.xsl
@@ -10,6 +10,7 @@
 <xsl:output method="text"/>
 
 <xsl:param name="basename"/>
+<xsl:param name="dirname"/>
 
 <xsl:template match="/*[namespace-uri(.) = ''] | /db:*">
   <xsl:for-each select="
@@ -25,6 +26,7 @@
         </xsl:when>
       </xsl:choose>
     </xsl:variable>
+    <xsl:value-of select="$dirname"/>
     <xsl:value-of select="$basename"/>
     <xsl:text>: </xsl:text>
     <xsl:value-of select="$src"/>
@@ -35,6 +37,7 @@
 <xsl:template match="/mal:page">
   <xsl:variable name="id" select="@id"/>  
   <xsl:for-each select="//mal:media | //uix:thumb | //ui:thumb | //e:mouseover">
+    <xsl:value-of select="$dirname"/>
     <xsl:value-of select="$id"/>
     <xsl:text>: </xsl:text>
     <xsl:value-of select="@src"/>


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