| 1 |
% \subsubsection{Code listing environments} |
| 2 |
% \DescribeEnv{code}{A code answer environment} You cannot use Environ |
| 3 |
% with the fancyvrb/listings package if you want nested environments. |
| 4 |
% |
| 5 |
% \begin{macrocode} |
| 6 |
%<*classXimera> |
| 7 |
\DefineVerbatimEnvironment{code}{Verbatim}{numbers=left,frame=lines,label=Code,labelposition=topline} |
| 8 |
%</classXimera> |
| 9 |
% \end{macrocode} |
| 10 |
% \DescribeEnv{python}{A python answer environment} You cannot use |
| 11 |
% Environ with the fancyvrb/listings package if you want nested |
| 12 |
% environments |
| 13 |
% \begin{macrocode} |
| 14 |
%<*classXimera> |
| 15 |
\DefineVerbatimEnvironment{python}{Verbatim}{numbers=left,frame=lines,label=Python,labelposition=topline} |
| 16 |
%</classXimera> |
| 17 |
% \end{macrocode} |
| 18 |
% \DescribeEnv{javascriptCode}{A JavaScript answer environment} Unfortunately the name |javascript| is already used for the actual, executed (!) JavaScript interactive. |
| 19 |
% environments |
| 20 |
% \begin{macrocode} |
| 21 |
%<*classXimera> |
| 22 |
\DefineVerbatimEnvironment{javascriptCode}{Verbatim}{numbers=left,frame=lines,label=JavaScript,labelposition=topline} |
| 23 |
%</classXimera> |
| 24 |
%<*cfgXimera> |
| 25 |
\renewenvironment{javascriptCode}{\NoFonts}{\EndNoFonts} |
| 26 |
\ScriptEnv{javascriptCode}{\stepcounter{identification}\ifvmode \IgnorePar\fi \EndP\HCode{<div class="javascript-code" id="javascript\arabic{identification}"><script type="text/text">}\HtmlParOff}{\HtmlParOn\HCode{\Hnewline</script></div>}} |
| 27 |
%</cfgXimera> |
| 28 |
% \end{macrocode} |
| 29 |
% On the web, translate verbatim and lstlisting blocks into |<pre>| |
| 30 |
% elements. |
| 31 |
% \begin{macrocode} |
| 32 |
%<*cfgXimera> |
| 33 |
\ConfigureEnv{verbatim}{\HCode{<pre>}}{\HCode{</pre>}}{}{} |
| 34 |
\ConfigureEnv{lstlisting}{\HCode{<pre>}}{\HCode{</pre>}}{}{} |
| 35 |
%</cfgXimera> |
| 36 |
% \end{macrocode} |