Support for directory names with spaces (follow-up #1)

This commit is contained in:
Laurent Rineau 2011-06-24 12:16:37 +00:00
parent a8c2768327
commit 6bddc23d09
1 changed files with 27 additions and 27 deletions

View File

@ -382,7 +382,7 @@ convert() {
if [[ $PathName == /* ]]; then if [[ $PathName == /* ]]; then
error 3 "LaTeX filename must be given with a relative path." error 3 "LaTeX filename must be given with a relative path."
fi fi
${MakePath} ${TmpDir}/${PathName} ${MakePath} "${TmpDir}"/${PathName}
fi fi
# derive LogFile from rootname, and copy existing 'latex_to_html.hlg' to it # derive LogFile from rootname, and copy existing 'latex_to_html.hlg' to it
@ -394,7 +394,7 @@ convert() {
# check for <rootname>.aux files automatically # check for <rootname>.aux files automatically
ExOpt="" ExOpt=""
if [ -r ${PathName}${RootName}.aux ]; then if [ -r ${PathName}${RootName}.aux ]; then
grep "\\bibcite[{]" ${PathName}${RootName}.aux > ${TmpDir}/${RootName}.auxtmp grep "\\bibcite[{]" ${PathName}${RootName}.aux > "${TmpDir}"/${RootName}.auxtmp
fi fi
# Convert LaTeX into HTML. # Convert LaTeX into HTML.
@ -404,7 +404,7 @@ convert() {
# create minitocs # create minitocs
cd ${TmpDir} cd "${TmpDir}"
find . -name "*.minitoc" | while read minitoc ; do find . -name "*.minitoc" | while read minitoc ; do
targetfilename=${minitoc%.minitoc} targetfilename=${minitoc%.minitoc}
@ -427,7 +427,7 @@ d
# Duplicate directory structure into OutDir # Duplicate directory structure into OutDir
# --------------------------------------------------------------------- # ---------------------------------------------------------------------
lgout -n "duplicating directory structure" lgout -n "duplicating directory structure"
cd ${TmpDir} cd "${TmpDir}"
# make sure we get all subdirectories # make sure we get all subdirectories
AllSubDirs=`find . -type d -print | sed 's/^[.][/]//'` AllSubDirs=`find . -type d -print | sed 's/^[.][/]//'`
AllSubDirsPostfix=`find . -depth -type d -print | sed 's/^[.][/]//'` AllSubDirsPostfix=`find . -depth -type d -print | sed 's/^[.][/]//'`
@ -442,7 +442,7 @@ d
cd $dir cd $dir
cat cc_anchor_rules.stage_1 | sed 's/\[cccbegin\]//g' | sed 's/\[cccend\]//g' > cc_anchor_rules.stage_1.tmp cat cc_anchor_rules.stage_1 | sed 's/\[cccbegin\]//g' | sed 's/\[cccend\]//g' > cc_anchor_rules.stage_1.tmp
mv cc_anchor_rules.stage_1.tmp cc_anchor_rules.stage_1 mv cc_anchor_rules.stage_1.tmp cc_anchor_rules.stage_1
cd ${TmpDir} cd "${TmpDir}"
done done
# Prepare stage 2 crosslink rules # Prepare stage 2 crosslink rules
@ -461,7 +461,7 @@ d
\cat cc_anchor_rules.stage_1 | grep -E -e "^local" | sed 's/^local//' > cc_anchor_rules.stage_0 \cat cc_anchor_rules.stage_1 | grep -E -e "^local" | sed 's/^local//' > cc_anchor_rules.stage_0
\cat cc_anchor_rules.stage_1 | grep -v -E -e "^local" > cc_anchor_rules.stage_1.tmp \cat cc_anchor_rules.stage_1 | grep -v -E -e "^local" > cc_anchor_rules.stage_1.tmp
\mv cc_anchor_rules.stage_1.tmp cc_anchor_rules.stage_1 \mv cc_anchor_rules.stage_1.tmp cc_anchor_rules.stage_1
cd ${TmpDir} cd "${TmpDir}"
fi fi
done done
vout "" vout ""
@ -520,7 +520,7 @@ d
vout "" vout ""
fi fi
done done
cd ${TmpDir} cd "${TmpDir}"
vout "" vout ""
done done
vout "" vout ""
@ -530,16 +530,16 @@ d
# -------------------------- # --------------------------
lgout -n ", " lgout -n ", "
lgout "creating the index" lgout "creating the index"
cat ${TmpDir}/manual.hidx | sed 's/\[cccbegin\]//g' | sed 's/\[cccend\]//g' > ${TmpDir}/manual.hidx.tmp cat "${TmpDir}"/manual.hidx | sed 's/\[cccbegin\]//g' | sed 's/\[cccend\]//g' > "${TmpDir}"/manual.hidx.tmp
mv ${TmpDir}/manual.hidx.tmp ${TmpDir}/manual.hidx mv "${TmpDir}"/manual.hidx.tmp "${TmpDir}"/manual.hidx
vout "makeindex -s ${ConfigHtml}/html_index.mst ${TmpDir}/manual.hidx" vout "makeindex -s ${ConfigHtml}/html_index.mst "${TmpDir}"/manual.hidx"
run_command makeindex -s ${ConfigHtml}/html_index.mst ${TmpDir}/manual.hidx run_command makeindex -s ${ConfigHtml}/html_index.mst "${TmpDir}"/manual.hidx
run_command cc_index_link ${TmpDir}/HREF ${TmpDir}/manual.ind ${TmpDir}/cc_index run_command cc_index_link "${TmpDir}"/HREF "${TmpDir}"/manual.ind "${TmpDir}"/cc_index
\cat ${TmpDir}/cc_index_header ${TmpDir}/cc_index ${TmpDir}/cc_index_footer > ${TmpDir}/manual_index.html \cat "${TmpDir}"/cc_index_header "${TmpDir}"/cc_index "${TmpDir}"/cc_index_footer > "${TmpDir}"/manual_index.html
CurrentLen=0 CurrentLen=0
cd ${TmpDir} cd "${TmpDir}"
# Apply anchor filter to all HTML files creating the crosslinks # Apply anchor filter to all HTML files creating the crosslinks
# --------------------------------------------------------------------- # ---------------------------------------------------------------------
@ -555,7 +555,7 @@ d
cat $filename | cc_remove_unwanted_links > $filename.tmp cat $filename | cc_remove_unwanted_links > $filename.tmp
mv $filename.tmp $filename mv $filename.tmp $filename
done done
cd ${TmpDir} cd "${TmpDir}"
lgout -n "]" lgout -n "]"
done done
@ -566,10 +566,10 @@ d
cp -r ${ConfigHtml}/style ${OutDir} cp -r ${ConfigHtml}/style ${OutDir}
if [ -r ${TmpDir}/latex_to_html.css ]; then if [ -r "${TmpDir}"/latex_to_html.css ]; then
cp ${TmpDir}/latex_to_html.css ${OutDir} cp "${TmpDir}"/latex_to_html.css ${OutDir}
else else
error noexit "CSS file '${TmpDir}/latex_to_html.css' not found, trying default." error noexit "CSS file '"${TmpDir}"/latex_to_html.css' not found, trying default."
if [ -r ${ConfigHtml}/default.css ]; then if [ -r ${ConfigHtml}/default.css ]; then
cp ${ConfigHtml}/default.css ${OutDir}/latex_to_html.css cp ${ConfigHtml}/default.css ${OutDir}/latex_to_html.css
else else
@ -627,10 +627,10 @@ d
lgout "pwd: `pwd`" lgout "pwd: `pwd`"
cp -r ${ConfigHtml}/Biblio ${OutDir} cp -r ${ConfigHtml}/Biblio ${OutDir}
cp ${TmpDir}/comments.xml ${OutDir} cp "${TmpDir}"/comments.xml ${OutDir}
if [ -d ${TmpDir}/benchmarks ] ; then if [ -d "${TmpDir}"/benchmarks ] ; then
mkdir -p ${OutDir}/benchmarks mkdir -p ${OutDir}/benchmarks
cp -r ${TmpDir}/benchmarks/*.tar.gz ${OutDir}/benchmarks cp -r "${TmpDir}"/benchmarks/*.tar.gz ${OutDir}/benchmarks
fi fi
# finish, write timing to logfile and close it # finish, write timing to logfile and close it
@ -842,7 +842,7 @@ done
# Make a subdirectory for the temp_path: # Make a subdirectory for the temp_path:
# -------------------------------------- # --------------------------------------
TmpDir=${TmpPath}/latex_to_html_tmp_${USER}_${RANDOM} TmpDir=${TmpPath}/latex_to_html_tmp_${USER}_${RANDOM}
while [ -d ${TmpDir} ]; do while [ -d "${TmpDir}" ]; do
TmpDir=${TmpPath}/latex_to_html_tmp_${USER}_${RANDOM} TmpDir=${TmpPath}/latex_to_html_tmp_${USER}_${RANDOM}
done done
@ -883,19 +883,19 @@ fi
# Make a subdirectory for the temp_path: # Make a subdirectory for the temp_path:
# -------------------------------------- # --------------------------------------
if [ -d ${TmpDir} ]; then if [ -d "${TmpDir}" ]; then
# with the randomly chosen name above this should not happen anymore # with the randomly chosen name above this should not happen anymore
warning "the dir '$TmpDir' exists already." warning "the dir '$TmpDir' exists already."
warning " It will be removed." warning " It will be removed."
\rm -r ${TmpDir} \rm -r "${TmpDir}"
fi fi
${MakePath} ${TmpDir} ${MakePath} "${TmpDir}"
# Convert # Convert
# ------- # -------
# prepare common options # prepare common options
ExtractOptions="${ExtractOptions} -date \"${LATEX_CONV_DATE}\" -release \"${LATEX_CONV_RELEASE}\" -title \"${LATEX_CONV_TITLE}\" -author \"${LATEX_CONV_AUTHOR}\" ${CppHeader} -config ${ConfigPath} -tmp ${TmpDir}" ExtractOptions="${ExtractOptions} -date \"${LATEX_CONV_DATE}\" -release \"${LATEX_CONV_RELEASE}\" -title \"${LATEX_CONV_TITLE}\" -author \"${LATEX_CONV_AUTHOR}\" ${CppHeader} -config ${ConfigPath} -tmp "${TmpDir}""
# make pathnames absolute pathnames # make pathnames absolute pathnames
CurrentDir=$PWD CurrentDir=$PWD
@ -920,7 +920,7 @@ done
# Cleanup # Cleanup
# ------- # -------
if [ $KeepTmp -eq 0 ]; then if [ $KeepTmp -eq 0 ]; then
\rm -r ${TmpDir} \rm -r "${TmpDir}"
else else
echo "NOTE: The tmp directory '${TmpDir}' was kept." 1>&2 echo "NOTE: The tmp directory '${TmpDir}' was kept." 1>&2
fi fi