Add before, after, and exn config directives
[bpt/mlt.git] / doc / manual.tex
index 034e772..ada1809 100644 (file)
@@ -48,6 +48,12 @@ Files consist of a sequence of the following kinds of lines in any order:
        \item {\tt cm {\it file}}: {\it file} is the path to a file that the SML/NJ Compilation Manager understands (i.e., {\tt .cm}, {\tt .sml}, {\tt .sig}, {\tt .grm}, {\tt .lex}). This file is to be made available to templates in the project.
 
        \item {\tt print {\it type} = {\it code}}: This declares that the given {\it code} is an SML expression that evaluates to an appropriate function for printing values of the SML {\it type}. The {\it code} should usually be the name of a function defined in a library or project SML source file.
        \item {\tt cm {\it file}}: {\it file} is the path to a file that the SML/NJ Compilation Manager understands (i.e., {\tt .cm}, {\tt .sml}, {\tt .sig}, {\tt .grm}, {\tt .lex}). This file is to be made available to templates in the project.
 
        \item {\tt print {\it type} = {\it code}}: This declares that the given {\it code} is an SML expression that evaluates to an appropriate function for printing values of the SML {\it type}. The {\it code} should usually be the name of a function defined in a library or project SML source file.
+
+       \item {\tt before {\it template}}: Run {\it template} before every normally-requested template, including its output at the beginning of the final output. This can be used to set up project-wide global state. Performing initialization inside project SML files will not generally be good enough. This is because all of the structure definitions these contain are evaluated at ``compile time,'' causing their code not found inside function definitions to be run only once.
+
+       \item {\tt after {\it template}}: Run {\it template} after every successfully executing template, including its output at the end.
+
+       \item {\tt exn {\it template}}: Run {\it template} when an exception goes uncaught during normal template execution. The function {\tt Web.getExn : unit -> exn} can be used to retrieve the causing exception from within {\it template}. The {\tt before} and {\tt after} templates are not run in the {\tt exn} template when it is executed because of an uncaught exception.
 \end{itemize}
 
 \section{The template language}
 \end{itemize}
 
 \section{The template language}
@@ -84,7 +90,7 @@ In addition to SML's $\sim$ prefix negation operator, there is a \$ operator for
 
 Function application is like SML application.
 
 
 Function application is like SML application.
 
-\subsection{Tuples}
+\subsubsection{Tuples}
 
 Tuple and {\tt ()} expressions are handled identically to how they are in SML.
 
 
 Tuple and {\tt ()} expressions are handled identically to how they are in SML.