| 1 |
\PassOptionsToPackage{full}{textcomp} |
| 2 |
\documentclass[exfoo=value, exbar, exfoo=\empty]{l3doc} |
| 3 |
|
| 4 |
% preamble >>= |
| 5 |
\makeatletter |
| 6 |
\let\save@onlypreamble\@onlypreamble |
| 7 |
\let\@onlypreamble\@gobble |
| 8 |
\usepackage[all]{expkv} |
| 9 |
\let\@onlypreamble\save@onlypreamble |
| 10 |
\makeatother |
| 11 |
\usepackage[oldstylenums,nott]{kpfonts} |
| 12 |
\input{glyphtounicode} |
| 13 |
\pdfgentounicode=1 |
| 14 |
\usepackage{xfp} % required for an example |
| 15 |
\usepackage{booktabs} |
| 16 |
\usepackage{array} |
| 17 |
\usepackage{collcell} |
| 18 |
\usepackage{siunitx} |
| 19 |
\DeclareSIUnit\ops{ops} |
| 20 |
\usepackage{xcolor} |
| 21 |
\usepackage{caption} |
| 22 |
\usepackage{microtype} |
| 23 |
\usepackage{accsupp} |
| 24 |
\usepackage{enumitem} |
| 25 |
\usepackage{randtext} |
| 26 |
|
| 27 |
\usepackage{tcolorbox}%>>= |
| 28 |
\newtcolorbox{exresult}[2][] |
| 29 |
{% |
| 30 |
colback=ekvgrey!10!white% |
| 31 |
,colframe=ekvgrey% |
| 32 |
,fontupper=\small |
| 33 |
,width={\dimexpr#2\relax}% |
| 34 |
,#1% |
| 35 |
} |
| 36 |
\newtcbox\exres[1][] |
| 37 |
{ |
| 38 |
colback=ekvgrey!10!white |
| 39 |
,colframe=ekvgrey |
| 40 |
,size=small |
| 41 |
,nobeforeafter |
| 42 |
,tcbox raise base |
| 43 |
,fontupper=\small |
| 44 |
,#1 |
| 45 |
} |
| 46 |
%=<< |
| 47 |
|
| 48 |
\usepackage{listings}%>>= |
| 49 |
\input{preamble-lst.tex} |
| 50 |
%=<< |
| 51 |
|
| 52 |
\let\metaORIG\meta |
| 53 |
\protected\def\meta #1{\texttt{\metaORIG{#1}}} |
| 54 |
\let\margORIG\marg |
| 55 |
\protected\def\marg #1{\texttt{\margORIG{#1}}} |
| 56 |
\let\oargORIG\oarg |
| 57 |
\protected\def\oarg #1{\texttt{\oargORIG{#1}}} |
| 58 |
|
| 59 |
\input{preamble-examples.tex} |
| 60 |
\input{preamble-logos.tex} |
| 61 |
|
| 62 |
\makeatletter |
| 63 |
% shortcuts >>= |
| 64 |
\newcommand\Vkey{\texttt{Val}-\key} |
| 65 |
\newcommand*\Nkey{\texttt{NoVal}-\key} |
| 66 |
\newcommand\kv{\meta{key}=\penalty2000\meta{value}} |
| 67 |
\newcommand\kvarg{\{\kv, \ldots\}} |
| 68 |
\newcommand\key{\meta{key}} |
| 69 |
\newcommand\val{\meta{value}} |
| 70 |
\newcommand\set{\meta{set}} |
| 71 |
\newcommand\prefix{\texorpdfstring{\textit{prefix}}{prefix}} |
| 72 |
\newcommand\prefixes{\textit{prefixes}} |
| 73 |
\newcommand\type{\texorpdfstring{\textit{type}}{type}} |
| 74 |
\newcommand\types{\textit{types}} |
| 75 |
\newcommand\tkn[2]{\texttt{\char`#1}\textsubscript{#2}} |
| 76 |
\newcommand\expansion{\meta{expansion}} |
| 77 |
%\newcommand\expnotation{} |
| 78 |
%\edef\expnotation |
| 79 |
%{\noexpand\texttt{exp\string|}\penalty\@M-\hskip\z@skip notation} |
| 80 |
\newcommand\singlecs[1] |
| 81 |
{% |
| 82 |
The \meta{cs} should be a single control sequence, such as |
| 83 |
\cs[no-index]{#1}. \ignorespaces |
| 84 |
} |
| 85 |
\newcommand\ekvdocsection[8] |
| 86 |
{% |
| 87 |
\clearpage |
| 88 |
\chardef\ekvdoc@insection1 |
| 89 |
\section[{#7}]% |
| 90 |
{% |
| 91 |
#7% |
| 92 |
\hfill |
| 93 |
\begingroup\scriptsize\ttfamily |
| 94 |
\begin{tabular}{@{}r@{}l@{}}% |
| 95 |
#1{\string\input\{expkv#8\}} & \rlap{#2{\ \% plain}}\\ |
| 96 |
#3{\string\usepackage\{expkv#8\}} & \rlap{#4{\ \% LaTeX}}\\ |
| 97 |
#5{\string\usemodule[expkv#8]} & \rlap{#6{\ \% ConTeXt}}\\ |
| 98 |
\end{tabular}% |
| 99 |
\endgroup |
| 100 |
\label{sec:expkv#8}% |
| 101 |
}% |
| 102 |
\chardef\ekvdoc@insection0 |
| 103 |
} |
| 104 |
\chardef\ekvdoc@insection0 |
| 105 |
\newcommand*\genericekv |
| 106 |
{\ekvdocsection{}{\textcolor{gray}}{}{\textcolor{gray}}{}{\textcolor{gray}}} |
| 107 |
\newcommand*\latexekv |
| 108 |
{\ekvdocsection\phantom\phantom{}{\textcolor{gray}}\phantom\phantom} |
| 109 |
%=<< |
| 110 |
|
| 111 |
\hypersetup{linkcolor=red!80!black,urlcolor=purple!80!black} |
| 112 |
|
| 113 |
\input{preamble-prefixes.tex} |
| 114 |
\input{preamble-noidx.tex} |
| 115 |
\input{preamble-enverb.tex} |
| 116 |
|
| 117 |
% vissp >>= |
| 118 |
\ExplSyntaxOn |
| 119 |
\cs_new_protected:Npn \vissp #1 |
| 120 |
{ |
| 121 |
\group_begin: |
| 122 |
\tl_set:Nn \l_tmpa_tl {#1} |
| 123 |
\tl_replace_all:Nnn \l_tmpa_tl { ~ } { \asciispace } |
| 124 |
\l_tmpa_tl |
| 125 |
\group_end: |
| 126 |
} |
| 127 |
\ExplSyntaxOff |
| 128 |
% =<< |
| 129 |
|
| 130 |
\ekvcSplit\expkvorules% >>= |
| 131 |
{ |
| 132 |
cd = \emph{nothing} |
| 133 |
,cu = \emph{nothing} |
| 134 |
,pd = \emph{nothing} |
| 135 |
,pu = \emph{nothing} |
| 136 |
} |
| 137 |
{% |
| 138 |
\begin{description} |
| 139 |
\item[Class:] |
| 140 |
\begin{description} |
| 141 |
\item[defined] #1 |
| 142 |
\item[undefined] #2 |
| 143 |
\end{description} |
| 144 |
\item[Package:] |
| 145 |
\begin{description} |
| 146 |
\item[defined] #3 |
| 147 |
\item[undefined] #4 |
| 148 |
\end{description} |
| 149 |
\end{description}% |
| 150 |
} |
| 151 |
\ekvcSecondaryKeys\expkvorules |
| 152 |
{ |
| 153 |
meta d = {cd={#1},pd={#1}} |
| 154 |
,meta u = {cu={#1},pu={#1}} |
| 155 |
}% =<< |
| 156 |
|
| 157 |
\newcommand*\pmso[1] % poor man's strike out%>>= |
| 158 |
{% |
| 159 |
\leavevmode |
| 160 |
\begingroup |
| 161 |
\sbox0{#1}% |
| 162 |
\rlap{\vrule height .6ex depth -.5ex width \wd0\relax}% |
| 163 |
\usebox0\relax |
| 164 |
\endgroup |
| 165 |
}%=<< |
| 166 |
|
| 167 |
\@ifdefinable\gobbledocstriptag{\def\gobbledocstriptag#1>{}} |
| 168 |
|
| 169 |
\renewcommand*\partname{Part} |
| 170 |
|
| 171 |
% \addsec and friends >>= |
| 172 |
\newcommand*\addsec@[2] |
| 173 |
{% |
| 174 |
\c@secnumdepth=% |
| 175 |
\expanded |
| 176 |
{% |
| 177 |
\m@ne |
| 178 |
\unexpanded{#1{#2}}% |
| 179 |
\c@secnumdepth=\the\c@secnumdepth\relax |
| 180 |
}% |
| 181 |
} |
| 182 |
\newcommand*\addsec {\addsec@\section} |
| 183 |
\newcommand*\addssec {\addsec@\subsection} |
| 184 |
\newcommand*\addsssec{\addsec@\subsubsection} |
| 185 |
% =<< |
| 186 |
|
| 187 |
\newenvironment{syntaxexample}% >>= |
| 188 |
{% |
| 189 |
\quote |
| 190 |
\ttfamily\small\frenchspacing |
| 191 |
\parskip=\z@ |
| 192 |
\def\indent{\leavevmode\phantom{mm}}% |
| 193 |
} |
| 194 |
{\endquote} |
| 195 |
\newenvironment{syntaxexample*} |
| 196 |
{\syntaxexample\obeylines} |
| 197 |
{\endsyntaxexample}% =<< |
| 198 |
|
| 199 |
\newcommand\expkvdocPrintErrors[1][] |
| 200 |
{% |
| 201 |
\protected\long\def\expkvdoc@errfont##1% |
| 202 |
{\texttt{\frenchspacing\textcolor{red!80!black}{##1}}}% |
| 203 |
\protected\long\def\ekv@err@collect##1\par##2% |
| 204 |
{\expkvdoc@errfont{! \detokenize{##2} Error: ##1}#1}% |
| 205 |
\protected\long\def\expkvdoc@errm##1##2% |
| 206 |
{\expkvdoc@errfont{! expkv##1 Error: ##2}#1}% |
| 207 |
\def\ekv@errm{\expkvdoc@errm{}}% |
| 208 |
\def\ekvc@errm{\expkvdoc@errm{-cs}}% |
| 209 |
\def\ekvd@errm{\expkvdoc@errm{-def}}% |
| 210 |
\def\ekvp@errm{\expkvdoc@errm{-pop}}% |
| 211 |
} |
| 212 |
\makeatother |
| 213 |
|
| 214 |
\ExplSyntaxOn |
| 215 |
\str_new:N \g__expkvdoc_module_str |
| 216 |
\cs_new_protected:Npn \expkvdocfile #1% >>= |
| 217 |
{ |
| 218 |
\expkvdoc_for_module:nn {#1} |
| 219 |
{ |
| 220 |
\str_if_eq:nnTF {#1} {main} |
| 221 |
{ \lstset{style=expkv} } |
| 222 |
{ \lstset{style=expkv-#1} } |
| 223 |
\addtocontents{exs} |
| 224 |
{ |
| 225 |
\medskip |
| 226 |
\noindent |
| 227 |
\use:c { expkv \str_if_eq:nnF {#1} {main} { \str_head:n {#1} } } |
| 228 |
\smallskip |
| 229 |
} |
| 230 |
\input{pkg-#1.tex} |
| 231 |
} |
| 232 |
}% =<< |
| 233 |
\cs_new_protected:Npn \expkvdocdtx #1% >>= |
| 234 |
{ |
| 235 |
\expkvdoc_for_module:nn {#1} |
| 236 |
{ |
| 237 |
\str_if_eq:nnTF {#1} {main} |
| 238 |
{ \DocInput{expkv.dtx} } |
| 239 |
{ \DocInput{expkv-#1.dtx} } |
| 240 |
} |
| 241 |
}% =<< |
| 242 |
\cs_new_protected:Npn \expkvdoc_for_module:nn #1#2% >>= |
| 243 |
{ |
| 244 |
\use:e |
| 245 |
{ |
| 246 |
\exp_not:n |
| 247 |
{ |
| 248 |
\str_gset:Nn \g__expkvdoc_module_str {#1} |
| 249 |
#2 |
| 250 |
\str_gset:Nn \g__expkvdoc_module_str |
| 251 |
} |
| 252 |
{ \g__expkvdoc_module_str } |
| 253 |
} |
| 254 |
}% =<< |
| 255 |
\ExplSyntaxOff |
| 256 |
|
| 257 |
\input{preamble-l3doctweaks.tex} |
| 258 |
|
| 259 |
%=<< |
| 260 |
|
| 261 |
% for thanking Niranjan |
| 262 |
% code from https://tex.stackexchange.com/a/635125/117050 |
| 263 |
\def\DevnagVersion{2.17} |
| 264 |
\usepackage{devanagari} |
| 265 |
|
| 266 |
\newif\ifexpkvDocImplementation%\expkvDocImplementationtrue |
| 267 |
|
| 268 |
\begin{document} |
| 269 |
\title{\expkvbundle} |
| 270 |
%\title% >>= |
| 271 |
%{% |
| 272 |
%\texorpdfstring |
| 273 |
%{% |
| 274 |
%\huge\expkvbundle |
| 275 |
%\\[\medskipamount] |
| 276 |
%\Large an {\expFormat}andable |
| 277 |
%\meta{{\kvstyle k}\kern-.05em ey}=% |
| 278 |
%\meta{{\kvstyle v}\kern-.05em alue} |
| 279 |
%implementation and more% |
| 280 |
%} |
| 281 |
%{expkv-bundle - an expandable <key>=<value> implementation and more}% |
| 282 |
%}% =<< |
| 283 |
\author |
| 284 |
{% |
| 285 |
Jonathan P. Spratte% |
| 286 |
\thanks |
| 287 |
{% |
| 288 |
\protect\randomize{[email protected]}; |
| 289 |
Special thanks to {\protect\dn Enr\2jn} (Niranjan) for valuable |
| 290 |
suggestions and additions to this documentation.% |
| 291 |
}% |
| 292 |
} |
| 293 |
\date{2024-12-26} |
| 294 |
\begingroup |
| 295 |
\renewcommand*\thefootnote{\fnsymbol{footnote}} |
| 296 |
\maketitle |
| 297 |
\endgroup |
| 298 |
|
| 299 |
\begin{abstract}%>>= |
| 300 |
\noindent\parfillskip=0pt |
| 301 |
The \expkvbundle\ provides at its core a \emph{fully expandable} \kv\ parser, |
| 302 |
that is \emph{safe} for active commas and equals signs, \emph{reliable} to |
| 303 |
only strip one set of braces after spaces are stripped, and blazingly |
| 304 |
\emph{fast}, as of writing this only \pkg{keyval} is faster. |
| 305 |
\par |
| 306 |
\bigskip |
| 307 |
This parser gets augmented by a family of packages. \expkvc\ allows to easily |
| 308 |
define expandable macros using a \kv\ interface, making the expandable parser |
| 309 |
available to the masses. \expkvd\ provides a \kv\ interface to |
| 310 |
define common \key-types. With \expkvo\ you can parse package |
| 311 |
and class options. \expkvp\ enables you to design your own prefix |
| 312 |
oriented parsers for interface definitions. |
| 313 |
\end{abstract}%=<< |
| 314 |
|
| 315 |
\tableofcontents |
| 316 |
|
| 317 |
\clearpage |
| 318 |
|
| 319 |
\begin{documentation}% >>= |
| 320 |
\ifexpkvDocImplementation\part{Documentation}\fi |
| 321 |
|
| 322 |
\input{introduction.tex} |
| 323 |
\clearpage |
| 324 |
\input{impatient.tex} |
| 325 |
|
| 326 |
\expkvdocfile{main} |
| 327 |
\expkvdocfile{cs} |
| 328 |
\expkvdocfile{def} |
| 329 |
\expkvdocfile{opt} |
| 330 |
\expkvdocfile{pop} |
| 331 |
\clearpage |
| 332 |
\lstset{style=expkv-all} |
| 333 |
\input{comparison.tex} |
| 334 |
\end{documentation}% =<< |
| 335 |
|
| 336 |
\clearpage |
| 337 |
\listofexamples |
| 338 |
|
| 339 |
\ifexpkvDocImplementation |
| 340 |
\clearpage |
| 341 |
\begin{implementation}% >>= |
| 342 |
\part{Implementation} |
| 343 |
\expkvdocdtx{main} |
| 344 |
\clearpage |
| 345 |
\expkvdocdtx{cs} |
| 346 |
\clearpage |
| 347 |
\expkvdocdtx{def} |
| 348 |
\clearpage |
| 349 |
\expkvdocdtx{opt} |
| 350 |
\clearpage |
| 351 |
\expkvdocdtx{pop} |
| 352 |
\end{implementation}% =<< |
| 353 |
\fi |
| 354 |
|
| 355 |
\clearpage |
| 356 |
\PrintIndex |
| 357 |
\end{document} |