diff options
author | Shaun McCance <shaunm@gnome.org> | 2015-04-03 08:42:26 -0400 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2015-04-03 08:42:26 -0400 |
commit | 0191878e599e5b0a809ff1a7a2cbaa56728a0961 (patch) | |
tree | 0115780d2f63a68bcf048c0d7e995175668c7f69 | |
parent | 65438f09534c4abc5b968626f9b2547dfdd0503d (diff) | |
download | yelp-tools-0191878e599e5b0a809ff1a7a2cbaa56728a0961.tar.gz |
yelp-check: Check media correctly in subdirs, #727557
-rwxr-xr-x | tools/yelp-check.in | 13 | ||||
-rw-r--r-- | 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"/> |