<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% \subsubsection{JavaScript}

% \DescribeEnv{javascript}{Code inside a javascript environment is printed on paper, but executed on the web.}

%    \begin{macrocode}
%&lt;*classXimera&gt;
\DefineVerbatimEnvironment{javascript}{Verbatim}{numbers=left,frame=lines,label=JavaScript,labelposition=topline}
%&lt;/classXimera&gt;
%    \end{macrocode}

%    \begin{macrocode}
%&lt;*htXimera&gt;
% for programming javascript
\renewenvironment{javascript}{\NoFonts}{\EndNoFonts}
\ScriptEnv{javascript}{\stepcounter{identification}\ifvmode \IgnorePar\fi \EndP\HCode{&lt;div class="javascript" id="javascript\arabic{identification}"&gt;&lt;script type="text/javascript"&gt;}\HtmlParOff}{\HtmlParOn\HCode{&lt;/script&gt;&lt;/div&gt;}}
%&lt;/htXimera&gt;
%    \end{macrocode}

% \DescribeMacro{\js}{Code inside a |\js| macro is evaluated and replaced with its value.}
%    \begin{macrocode}
%&lt;*classXimera&gt;
\def\js#1{\mbox{\texttt{\detokenize{#1}}}}
%&lt;/classXimera&gt;
%    \end{macrocode}

%    \begin{macrocode}
%&lt;*htXimera&gt;
\def\js#1{\stepcounter{identification}\HCode{&lt;span class="inline-javascript" id="javascript\arabic{identification}"&gt;&lt;script type="text/javascript"&gt; function javascript\arabic{identification}() }\{\HCode{ return \detokenize{#1}; }\}\HCode{&lt;/script&gt;&lt;/span&gt;}}
%&lt;/htXimera&gt;
%    \end{macrocode}

</pre></body></html>