| 1 |
\subsection{Using Verbatim Environment Contents} |
| 2 |
\begin{function}{\enverbBody} |
| 3 |
\begin{syntax} |
| 4 |
\cs{enverbBody} |
| 5 |
\end{syntax} |
| 6 |
This macro holds the contents of the last scanned \cs{enverb}-body, |
| 7 |
assignments to it by the package are all local. |
| 8 |
\end{function} |
| 9 |
|
| 10 |
\begin{function}{\enverbExecute} |
| 11 |
\begin{syntax} |
| 12 |
\cs{enverbExecute} |
| 13 |
\end{syntax} |
| 14 |
This function executes the current contents of \cs{enverbBody} as though they |
| 15 |
would be part of your input at this place (using |\scantokens|, it is tried as |
| 16 |
good as possible to tackle |\scantokens|'s shortcomings; also it is assumed |
| 17 |
that you didn't change the |eol| key, or else the newlines aren't carried over |
| 18 |
but whatever your |eol| value set is used). The entire contents are |
| 19 |
|\detokenize|d once before |\scantokens| does its magic (shouldn't affect the |
| 20 |
verbatimly read material, but is deemed a sensible safety measure if something |
| 21 |
unexpected happens; this also assumes that anything you placed inside |bol| or |
| 22 |
|eol| is rescanned into the same stuff once |\detokenize|d).\par |
| 23 |
The function isn't fully expandable, the contents are executed at the current |
| 24 |
group level. |
| 25 |
\end{function} |
| 26 |
|
| 27 |
\begin{function}{\enverbListing} |
| 28 |
\begin{syntax} |
| 29 |
\cs{enverbListing} \marg{env} \marg{args} |
| 30 |
\end{syntax} |
| 31 |
This function is meant to reuse the current contents of \cs{enverbBody} inside |
| 32 |
another verbatim environment. The used mechanism is tested to work with |
| 33 |
\env{verbatim}, and environments defined by \pkg{fancyvrb}, \pkg{listings} and |
| 34 |
\pkg{minted} (provided you use the default |eol| setting). \meta{env} is the |
| 35 |
environment name in which the contents should be nested, and \meta{args} is |
| 36 |
material to be placed after the |\begin| statement (just as you input them, |
| 37 |
with the outer braces from this argument removed).\par |
| 38 |
Just like |\enverbExecute| this |\detokenize|s the current content of |
| 39 |
\cs{enverbBody} as well as your \meta{args} and uses |\scantokens|. |
| 40 |
\end{function} |