Initial commit: Klammertext source distribution
Curated source subset assembled by klammertext-dev's doc/make_dist.sh: the Klammermachine (mac), the Standard Klammer Set (sks), the commands (com), editor plugins and install guides (doc), a test subset (tst), and lib/bin placeholders. Builds with 'make -C com'. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
126
sks/code/code.k
Normal file
126
sks/code/code.k
Normal file
@@ -0,0 +1,126 @@
|
||||
|
||||
@@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@
|
||||
@@
|
||||
|
||||
@@source_file filename : @eval 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 :
|
||||
@@
|
||||
]#
|
||||
Reference in New Issue
Block a user