[yelp-tools] yelp-build epub: Fixed extra dir prefix on media



commit f37331e70dd1268127445b5715f8defdee004517
Author: Shaun McCance <shaunm gnome org>
Date:   Fri Jul 5 10:54:54 2013 -0400

    yelp-build epub: Fixed extra dir prefix on media
    
    I'd added an extra "yelp/" dir to hold yelp's autogenerated files
    for epub builds, but due to the way I'd structured the code, the
    copied media files were also put in that directory. Except the
    references to them in the XHTML didn't use the extra prefix.

 tools/yelp-build.in |   42 ++++++++++++++++++++++++------------------
 1 files changed, 24 insertions(+), 18 deletions(-)
---
diff --git a/tools/yelp-build.in b/tools/yelp-build.in
index 1d70145..4baa589 100755
--- a/tools/yelp-build.in
+++ b/tools/yelp-build.in
@@ -404,7 +404,7 @@ yelp_html_mal2html () {
         echo '</xsl:template>'
         echo '<xsl:template match="/">'
         echo '<xsl:for-each select="cache:cache/mal:page">'
-       echo ' <xsl:variable name="dir">'
+        echo ' <xsl:variable name="dir">'
         echo '  <xsl:call-template name="dirname">'
         echo '   <xsl:with-param name="str" select="substring-after(@cache:href, '\''file://'\'')"/>'
         echo '  </xsl:call-template>'
@@ -412,10 +412,10 @@ yelp_html_mal2html () {
         echo ' <xsl:variable name="node" select="document(@cache:href)/mal:page"/>'
         # Media
         echo ' <xsl:for-each select="$node//mal:media | $node//e:mouseover">'
-       echo '  <xsl:if test="not(contains(@src, '\'':'\''))">'
-        echo '   <xsl:value-of select="concat($dir, @src, '"' '"')"/>'
+        echo '  <xsl:if test="not(contains(@src, '\'':'\''))">'
+        echo '   <xsl:value-of select="concat('"'-'"', $dir, @src, '"' '"')"/>'
         echo '   <xsl:value-of select="concat(@src, '"'&#x000A;'"')"/>'
-       echo '  </xsl:if>'
+        echo '  </xsl:if>'
         echo ' </xsl:for-each>'
         # Syntax highlighting
         echo ' <xsl:for-each select="$node//mal:code[ mime]">'
@@ -426,7 +426,7 @@ yelp_html_mal2html () {
         echo '   <xsl:value-of select="exsl:node-set($out)/*/html:pre[last()]/@class"/>'
         echo '  </xsl:variable>'
         echo '  <xsl:if test="starts-with($class, '\''contents syntax brush-'\'')">'
-        echo '   <xsl:text>'"${yelp_js_dir}"'/jquery.syntax.brush.</xsl:text>'
+        echo '   <xsl:text>+'"${yelp_js_dir}"'/jquery.syntax.brush.</xsl:text>'
         echo '   <xsl:value-of select="substring-after($class, '\''contents syntax brush-'\'')"/>'
         echo '   <xsl:text>.js ./&#x000A;</xsl:text>'
         echo '  </xsl:if>'
@@ -435,24 +435,24 @@ yelp_html_mal2html () {
         echo ' <xsl:for-each select="$node//mal:note">'
         echo '  <xsl:variable name="style" select="concat('\'' '\'', @style, '\'' '\'')"/>'
         echo '  <xsl:choose>'
-        echo '   <xsl:when test="contains($style, '\'' advanced '\'')">'
-        echo '    <xsl:text>'"${yelp_icon_dir}"'/yelp-note-advanced.png ./&#x000A;</xsl:text>'
-        echo '   </xsl:when>'
+        # echo '   <xsl:when test="contains($style, '\'' advanced '\'')">'
+        # echo '    <xsl:text>+'"${yelp_icon_dir}"'/yelp-note-advanced.png ./&#x000A;</xsl:text>'
+        # echo '   </xsl:when>'
         echo '   <xsl:when test="contains($style, '\'' bug '\'')">'
-        echo '    <xsl:text>'"${yelp_icon_dir}"'/yelp-note-bug.png ./&#x000A;</xsl:text>'
+        echo '    <xsl:text>+'"${yelp_icon_dir}"'/yelp-note-bug.png ./&#x000A;</xsl:text>'
         echo '   </xsl:when>'
         echo '   <xsl:when test="contains($style, '\'' important '\'')">'
-        echo '    <xsl:text>'"${yelp_icon_dir}"'/yelp-note-important.png ./&#x000A;</xsl:text>'
+        echo '    <xsl:text>+'"${yelp_icon_dir}"'/yelp-note-important.png ./&#x000A;</xsl:text>'
         echo '   </xsl:when>'
         echo '   <xsl:when test="contains($style, '\'' sidebar '\'')"/>'
         echo '   <xsl:when test="contains($style, '\'' tip '\'')">'
-        echo '    <xsl:text>'"${yelp_icon_dir}"'/yelp-note-tip.png ./&#x000A;</xsl:text>'
+        echo '    <xsl:text>+'"${yelp_icon_dir}"'/yelp-note-tip.png ./&#x000A;</xsl:text>'
         echo '   </xsl:when>'
         echo '   <xsl:when test="contains($style, '\'' warning '\'')">'
-        echo '    <xsl:text>'"${yelp_icon_dir}"'/yelp-note-warning.png ./&#x000A;</xsl:text>'
+        echo '    <xsl:text>+'"${yelp_icon_dir}"'/yelp-note-warning.png ./&#x000A;</xsl:text>'
         echo '   </xsl:when>'
         echo '   <xsl:otherwise>'
-        echo '    <xsl:text>'"${yelp_icon_dir}"'/yelp-note.png ./&#x000A;</xsl:text>'
+        echo '    <xsl:text>+'"${yelp_icon_dir}"'/yelp-note.png ./&#x000A;</xsl:text>'
         echo '   </xsl:otherwise>'
         echo '  </xsl:choose>'
         echo ' </xsl:for-each>'
@@ -461,15 +461,21 @@ yelp_html_mal2html () {
         echo '</xsl:stylesheet>'
     ) | xsltproc --xinclude - "$html_tmp_infile" | sort | uniq |
     while read line; do
-       line_src=`echo "$line" | cut -d' ' -f1`
+        use_internal_datadir=`expr substr "$line" 1 1`
+        line=`expr substr "$line" 2 1000`
+        line_src=`echo "$line" | cut -d' ' -f1`
         line_src=`echo "$line_src" | urldecode`
-       line_dest="$html_out/$html_internal_datadir"`echo "$line" | cut -d' ' -f2`
+        if [ "x$use_internal_datadir" = "x+" ]; then
+            line_dest="$html_out/$html_internal_datadir"`echo "$line" | cut -d' ' -f2`
+        else
+            line_dest="$html_out/"`echo "$line" | cut -d' ' -f2`
+        fi
         line_dest=`echo "$line_dest" | urldecode`
-       if [ "$line_src" != "$line_dest" ]; then
+        if [ "$line_src" != "$line_dest" ]; then
             line_dir=`dirname "$line_dest"`
             mkdir_p "$line_dir"
-           cp "$line_src" "$line_dest"
-       fi
+            cp "$line_src" "$line_dest"
+        fi
     done
     cp "${yelp_js_dir}/jquery.js" "$html_out/$html_internal_datadir"
     cp "${yelp_js_dir}/jquery.syntax.js" "$html_out/$html_internal_datadir"


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