File mttroot/mtt/doc/mtt_make_examples artifact ac977b6bd2 part of check-in a0d28fdb76


#! /bin/sh
## This makes all of the standard examples
## It takes a few hours.
## Copyright (C) 2003 by Peter J. Gawthrop

exampledir="$MTT_EXAMPLES"
dirname=`basename ${exampledir}`

tmpbase="$HOME/JUNK"
tmpdir="${tmpbase}/${dirname}"

first() {
    cat<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>MTT Examples</title>
  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#ff0000" bgcolor="#ffff33" link="#000099" vlink="#990099" alink="#ff0000">

<h1 align="center"><font color="#ff0000">MTT Examples</font></h1>
   
<hr width="100%" size="2">
<ul>
EOF
}

entry() {
    cat<<EOF
<li>$1: <a href="./$1_rep/index.html">html, </a><a href="$1_rep.pdf">pdf.</a> 
EOF
}

last() {
    cat<<EOF
</ul>
<hr width="100%" size="2">     
Created on `date` by mtt_make_examples
<hr width="100%" size="2">     
</body>
</html>
EOF
}

## File start
first > index.html

if [ -d "${tmpdir}" ]; then
    echo "${tmpdir} exists -- using"
else
    echo "${tmpdir} does not exist -- copy from ${exampledir}"
    ## Create tmp dir
    mkdir -pv ${tmpdir}
    ## Copy to tmp
    cp -r ${exampledir} ${tmpbase}
fi

## Go to tmp and list DIRS
pushd ${tmpdir}
dirs=`ls | grep -v CVS | grep -v '\.' | grep -v _`

echo Making examples for ${dirs} in ${tmpdir}
for dir in ${dirs}; do
    echo Making examples in $dir
    mtt -q $dir rep pdf
    mtt -q $dir rep html
    entry $dir >> index.html
done

## File end
last>>index.html
popd

MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]