#!/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  : 30-Nov-2019

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 -ic --response=apply_response.txt infodoc_css.html
#            ./idpp/idpp -c infodoc_css.html    # Full automatic mode
               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