-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
5.9.1.4-source.tex
37 lines (30 loc) · 2.74 KB
/
5.9.1.4-source.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
\definesubsubsubsection{Source}
\defineidentifier{embed-type-source}{source}
\defineidentifier{embed-property-options}{options <options .+>}
\defineidentifier{embed-property-language}{language <language .+>}
\defineidentifier{embed-property-start}{start <start ~n+>}
\defineidentifier{embed-property-end}{end <end [+]?~n+>}
\defineidentifier{embed-property-encoding}{encoding <encoding .+>}
\definestyle{embed-type-source}{font-family: monospace; white-space: preserve} \\
Embeds the source code pointed to by the \inline$target$ into the document. To do this, the file is read as a text file in the \g{encoding} specified by \ident{embed-property-encoding}. If the \ident{embed-property-encoding} is not given, UTF-8 \g{encoding} is assumed. If an encoding is requested that the \g{implementation} does not support, an \g{error} is \glink{signalling}{signalled}.\\
The file's contents are split into a sequence of lines. If \ident{embed-property-start} is given, as many lines as indicated in its \inline$start$ \g{binding} are discarded from the front. If \ident{embed-property-end} is given, and its \inline$end$ \g{binding} starts with a \unicode{2B}, as many lines as indicated in the \g{binding} are output into the \g{resulting textual component}. If \ident{embed-property-end} is given, but its \g{binding} does not start with \unicode{2B}, the lines until and including the line indicated by the \inline$end$ \g{binding} are output into the \g{resulting textual component}, counting the first line read from the file as the line numbered \inline$1$. \\
A line in this context is determined as follows: each line in the file is delimited by either the beginning of the file, the end of the file, or the nearest Linefeed \unicode{A} characters. This means that unlike a Markless \g{line}, the Linefeed \unicode{A} end of line marker cannot be escaped. \\
The \ident{embed-property-language} and \ident{embed-property-options} options hold parameters that configure the \g{style} of the \g{resulting textual component}. The syntax and effect of the options is \g{implementation dependant}, but it must be the same as for the \ident{code block} \g{directive}. If a language is requested that the \g{implementation} does not have specific support for, a \g{warning} is \glink{signalling}{signalled}. \\
\begin{examples}
\begin{examplesource}
[ source 5.9.1.2-source.tex, language tex, end 2 ]
\end{examplesource}
&$\Rightarrow$&\\
\begin{tabular}{@{}l@{}}
\begin{lstlisting}[style=codestyle,showstringspaces=false]
\definesubsubsubsection{Source}
\defineidentifier{embed-type-source}{source}
\end{lstlisting}
\end{tabular}
\end{examples}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "markless"
%%% TeX-engine: luatex
%%% TeX-command-extra-options: "-shell-escape"
%%% End: