[yelp-tools] yelp-build: Allow an existing cache file for Mallard->HTML



commit 209ed13c354b7e32a33e1e6a91932006c38af9fc
Author: Shaun McCance <shaunm gnome org>
Date:   Tue Apr 12 09:54:05 2011 -0400

    yelp-build: Allow an existing cache file for Mallard->HTML

 tools/yelp-build.in |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/tools/yelp-build.in b/tools/yelp-build.in
index b2cfeca..4053ae6 100755
--- a/tools/yelp-build.in
+++ b/tools/yelp-build.in
@@ -108,6 +108,7 @@ yelp_usage_html () {
         echo "  or directories containing Mallard page files."
         echo ""
         echo "Options:"
+        echo "  -c CACHE      Use the existing Mallard cache CACHE"
         echo "  -o OUT        Output files in the directory OUT"
         echo "  -x CUSTOM     Import the custom XSLT file CUSTOM"
     ) 1>&2
@@ -417,8 +418,13 @@ yelp_html_page2html () {
 }
 
 yelp_html_mal2html () {
-    html_cache_file=`mktemp`
-    yelp_cache -o "$html_cache_file" "$@"
+    if [ "x$html_cache_file" != "x" ]; then
+        html_cache_file=`(cd $(dirname "$html_cache_file") && pwd)`/`basename "$html_cache_file"`
+    else
+        html_cache_file_is_tmp="yes"
+        html_cache_file=`mktemp`
+        yelp_cache -o "$html_cache_file" "$@"
+    fi
     for xml in "$@"; do
         if [ -d "$xml" ]; then
             for page in "$xml"/*.page; do
@@ -428,13 +434,20 @@ yelp_html_mal2html () {
             yelp_html_page2html "$xml"
         fi
     done
-    rm "$html_cache_file"
+    if [ "x$html_cache_file_is_tmp" = "xyes" ]; then
+        rm "$html_cache_file"
+    fi
 }
 
 yelp_html () {
     html_out="."
     while [ "$#" != "0" ]; do
         case "$1" in
+            "-c")
+                shift
+                html_cache_file="$1"
+                shift
+                ;;
             "-o")
                 shift
                 html_out="$1"



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