#!/bin/csh -f
#
# Earth System Modeling Framework
# Copyright (c) 2002-2025, University Corporation for Atmospheric Research, 
# Massachusetts Institute of Technology, Geophysical Fluid Dynamics 
# Laboratory, University of Michigan, National Centers for Environmental 
# Prediction, Los Alamos National Laboratory, Argonne National Laboratory, 
# NASA Goddard Space Flight Center.
# Licensed under the University of Illinois-NCSA License.
#
# $Id$
#
#===============================================================================
# do_l2h
#===============================================================================
#
# Create html version from latex document.
#
# Usage: do_l2h <comp> <document type>
#
#        <comp> is the name of the component, library, or module used as the
#               basis for document filenames (e.g., coupler)
#
#        <document type> is one of the following:
#               req  - requirements document
#               arch - architecture document
#               des  - detailed design document
#               ref  - reference manual
#               usr  - user's guide
#               phys - algorithmic or physical description
#        
# See the latex2html manual:
# http://laborant.dfki.uni-sb.de:8000/doc/latex2html-manual-html-99_1/
# for a desription of the command-line parameters used in this script.
#
# C. DeLuca                                                       March 15, 2001
#===============================================================================

if($#argv != 2) then
  echo "Usage:  do_l2h <component> <document type>"
  exit
endif

# if needed, pre-process as top-level constituent or standalone document
if (-e $1_$2doc.ctex) then

  # move original out of the way
  if (-e $1_$2doc.tex) then
    mv $1_$2doc.tex $1_$2doc.tex.ORIG
  endif

  # perform pre-processing
  if(($1 == "ESMF")||($1 == "ESMC")) then
    gcc -E -x c -P -DCONSTITUENT $1_$2doc.ctex | grep -v "^#pragma" > $1_$2doc.tex
  else
    gcc -E -x c -P -DSTANDALONE $1_$2doc.ctex | grep -v "^#pragma" > $1_$2doc.tex
  endif

endif



latex2html  -white \
    -toc_depth 5 \
    -split +1 \
    -show_section_numbers \
    -local_icons \
    -address "<A HREF="mailto:esmf_support@ucar.edu">esmf_support@ucar.edu</A>" \
    $1_$2doc.tex







