#!/bin/bash
# Apply CSS style to 'infodoc.html'
#  a) verify existance of 'idpp', 'infodoc.html', 'infodoc-styles.css'
#  b) copy 'infodoc.html' to infodoc_css.html
#  c) invoke 'idpp' Infodoc Post Processor with 
#     input response file, 'apply_response.txt'
#  d) exit
# 
# Author: Mahlon R. Smith - The Software Samurai
# Date  : 24-Feb-2015

if [ -e ./idpp/idpp ]; then

   if [ -e ./infodoc.html ]; then

      if [ -e ./infodoc-styles.css ]; then

         if [ -e apply_response.txt ]; then
            cp --preserve=all infodoc.html infodoc_css.html
            clear
            ./idpp/idpp -toc --table_border=specify infodoc_css.html <apply_response.txt
               echo '******************************'
               echo '** infodoc_css.html created **'
               echo '******************************'
         else
            echo 'apply_response.txt not found'
         fi
      else
         echo 'infodoc-styles.css not found'
      fi
   else
      echo 'infodoc.html not found'
   fi
else
   echo 'idpp not found'
fi