Files
klammertext/sks/code/code.k

129 lines
3.2 KiB
Plaintext
Raw Normal View History

@@code.k :filename :pattern :caption :number | text.literal :
A source file displayed verbatim
@@
@@code :: @eval code_format.Code(K) @ @@
@@c.k code_text :
A word or phrase displayed verbatim in a line
@@
@@c :: @eval code_format.Code_fragment(K) eval@
@@
# :cwd makes the filename resolve against the DOCUMENT's directory, not
# the directory ktext happens to run in.
@@source_file filename : @eval :cwd *K_input_dir* code_format.Source(K) @ @@
#[
@@code.k text :file :number.bool true :caption : Code listing with formatted comments @@
@@code :
@eval code_format.Code(K) eval@
@@
@@lst spec.figure_id :
@reference *spec* | Listing @
@@
c <text>
code <text> :caption :filename :pattern
# --------------------------------------------------------------------------------
@@codebox.k s :color 1,1,1 :size normalsize :escapechar ^^
:space_break_only.bool false :linenumber.bool false :scale 1.0
:indent :standalone :vcenter :
Verbatim text for source code preserving whitepace, surrounded by a box
that extends to the margins @@
@@codebox.html ::
@code :text *s* @
@@
@@codebox.tex ::
\definecolor{codeboxbgcolor}{rgb}{*color*}
\setlength{\codeboxlinelength}{\linewidth - 6pt}
\vspace*{4pt}
\begin{lstlisting}%
[frame=single,
framerule=1pt,
basicstyle=\*size*\ttfamily,
lineskip=0pt,
linewidth=*scale*\codeboxlinelength,
columns=fullflexible,
keepspaces=true,
framesep=6pt,
xleftmargin=6pt,
escapechar=*escapechar*,
breaklines=true,
prebreak=\hbox{\large$\mapsto$},
%postbreak={\textbf{\hbox{$\rightarrow$}}},
rulecolor=\color{codeboxcolor},
backgroundcolor=\color{codeboxbgcolor},
breakatwhitespace=*space_break_only*,
numbers=none, # #- @if *linenumber* | left | none @ #- ,
numbersep=12pt,
numberstyle=\small\color{Darkred}]
*s*
\end{lstlisting}
@@
@@codebox.txt ::
@code :text *s* @
@@
@@pathname.k s :small.bool false : Pathname @@
@@pathname :: @eval code_format.Pathname(K) eval@ @@
@@annotate.k text :caption :
Comments put in boxes to the right of the code
@@
# @@annotate : @eval code_format.Annotate(K) eval@ @@
# @@annotate : @codebox *text* @ @@
@@annotate :: @code :text *text @ @@
@@listing s : @code :text *s* @ @@
# --------------------------------------------------------------------------------
@@sv.k s : Italic font for variable in @t syntax @ argument @@
@@sv.tex :: ^^textrm"^^textit"*s*$$ @@
@@sv.html :: @ri *s* @ @@
@@svs.k s : Sans-serif font for variable in @t syntax @ argument @@
@@svs.tex :: "^^small^^textsf"^^textit"*s*$$$ @@
@@svs.html :: @s @i *s* @ @ @@
@@svsub.k base | sub : Italic font for subscripted variable in @t syntax @ argument @@
@@svsub.tex :: ^^textrm"^^textit"*base*$$^^textsubscript"*sub*$ @@
@@svsub.html :: <span class="ritalic">*base*</span><sub>*sub*</sub> @@
@@syntax.k s :fontsize normalsize :indent.bool true :
Verbatim text that includes italic font for syntax descriptions @@
@@syntax.html ::
@code :text *s* @ # :indent *indent* @
@@
@@syntax.tex ::
\vspace*{8pt}\begin{LVerbatim}[xleftmargin=0pt, # @if true | 0pt | -24pt @ ,
baselinestretch=1.05, fontsize=\*fontsize*, frame=single, framesep=8pt,
commandchars=\\̈\$, fontfamily = @verbatimfont@, framesep=12pt]
*s*
\end{LVerbatim}
@@
@@svspace.tex length :
^^vspace*"*length*$
@@
@@svspace.html length :
@@
]#