summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex/scontents/README.md47
-rw-r--r--Master/texmf-dist/doc/latex/scontents/scontents.pdfbin373717 -> 385642 bytes
-rw-r--r--Master/texmf-dist/source/latex/scontents/scontents.dtx731
-rw-r--r--Master/texmf-dist/source/latex/scontents/scontents.ins10
-rw-r--r--Master/texmf-dist/tex/context/third/scontents/t-scontents.mkiv114
-rw-r--r--Master/texmf-dist/tex/generic/scontents/scontents-code.tex61
-rw-r--r--Master/texmf-dist/tex/generic/scontents/scontents.tex115
-rw-r--r--Master/texmf-dist/tex/latex/scontents/scontents.sty46
8 files changed, 504 insertions, 620 deletions
diff --git a/Master/texmf-dist/doc/latex/scontents/README.md b/Master/texmf-dist/doc/latex/scontents/README.md
index fe1c537bf15..95b0291960e 100644
--- a/Master/texmf-dist/doc/latex/scontents/README.md
+++ b/Master/texmf-dist/doc/latex/scontents/README.md
@@ -1,42 +1,48 @@
## scontents — Stores LaTeX contents in memory or files
-- Version: 1.9
-- Date: 2020-01-21
-- Author: Pablo González
+
+Release v2.0 \[2022-04-04\]
## Description
+
This package allows to store `LaTeX` code, including _"verbatim"_, in <code>&lt;sequences&gt;</code>
using the `l3seq` module of `expl3`. The <code>&lt;stored content&gt;</code> can be used
as many times as desired in the document, additionally you can write to <code>&lt;external files&gt;</code>
or show it in <code>&lt;verbatim style&gt;</code>.
## Requirements
+
The package loads and depends on updated versions of:
- [expl3](https://ctan.org/pkg/expl3)
- [l3keys2e](https://ctan.org/pkg/l3keys2e)
-- [xparse](https://ctan.org/pkg/xparse)
## Installation
-The package `scontents` is present in `TeXLive` and `MiKTeX`, use the
+The package `scontents` is present in `TeX Live` and `MiKTeX`, use the
package manager to install.
-For manual installation, download `scontents.zip` and unzip it,
+For manual installation, download [scontents.zip](http://mirrors.ctan.org/macros/latex/contrib/scontents.zip) and unzip it,
then run:
+
```
-$ pdftex scontents.ins
+$ luatex scontents.ins
```
-and move all files to appropriate locations:
+
+Now the different files must be moved into the different directories in your
+installation `TDS` tree or in your `TEXMFHOME`:
+
```
- scontents.tex -> TDS:tex/generic/scontents/
- scontents-code.tex -> TDS:tex/generic/scontents/
- scontents.sty -> TDS:tex/latex/scontents/
- t-scontents.mkiv -> TDS:tex/context/third/scontents/
- scontents.pdf -> TDS:doc/latex/scontents/
- README.md -> TDS:doc/latex/scontents/
- scontents.dtx -> TDS:source/latex/scontents/
- scontents.ins -> TDS:source/latex/scontents/
+ scontents.tex -> TDS:tex/generic/scontents/scontents.tex
+ scontents-code.tex -> TDS:tex/generic/scontents/scontents-code.tex
+ scontents.sty -> TDS:tex/latex/scontents/scontents.sty
+ t-scontents.mkiv -> TDS:tex/context/third/scontents/t-scontents.mkiv
+ scontents.pdf -> TDS:doc/latex/scontents/scontents.pdf
+ scontents.dtx -> TDS:source/latex/scontents/scontents.dtx
+ scontents.ins -> TDS:source/latex/scontents/scontents.ins
```
-then run `mktexlsr`.
+
+then run `mktexlsr`. To produce the documentation with source code run `luatex scontents.ins` and
+`lualatex scontents.dtx` three times.
+
## Examples
The file <code>&lt;scontents.pdf&gt;</code> contains attached examples, which can be extracted
@@ -45,14 +51,21 @@ from the PDF viewer or from the command line by running:
```
$ pdfdetach -saveall scontents.pdf
```
+
and then you can use the excellent `arara` tool to compile them.
## License
+
The scontents package may be modified and distributed under the terms and
conditions of the [LaTeX Project Public License](https://www.latex-project.org/lppl/), version 1.3c or greater.
## Contents
+
- README.md (this file)
- scontents.pdf (documentation)
- scontents.dtx (master file that produced all files)
- scontents.ins (installer to extract all files)
+
+## Author and copyright
+
+Copyright 2019-2022 by Pablo González L.
diff --git a/Master/texmf-dist/doc/latex/scontents/scontents.pdf b/Master/texmf-dist/doc/latex/scontents/scontents.pdf
index 4b5dfbc9c30..73255df1983 100644
--- a/Master/texmf-dist/doc/latex/scontents/scontents.pdf
+++ b/Master/texmf-dist/doc/latex/scontents/scontents.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/scontents/scontents.dtx b/Master/texmf-dist/source/latex/scontents/scontents.dtx
index f13db2db83a..d82fec48c00 100644
--- a/Master/texmf-dist/source/latex/scontents/scontents.dtx
+++ b/Master/texmf-dist/source/latex/scontents/scontents.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2019-2020 by Pablo González L <pablgonz@educarchile.cl>
+% Copyright (C) 2019-2022 by Pablo González L <pablgonz@educarchile.cl>
%
% This work may be distributed and/or modified under the conditions of the
% LaTeX Project Public License, either version 1.3c of this license or (at
@@ -32,23 +32,27 @@
% so that entries written to both streams end up in the same file.
\usepackage[english]{babel}
\usepackage[top=0.5in,bottom=0.3in,left=2in,right=0.7in,footskip=0.2in,headheight=1cm,headsep=0.27cm]{geometry}
-\usepackage[osf,mono=false,scale=0.95,llscaled=0.95]{libertine}
+\usepackage[osf,nomath,mono=false,ScaleSF=0.95,ScaleRM=0.95]{libertinus-otf}
+% Set Monospace font, fix 'quotes' in verbatim
+\usepackage{sourcecodepro}
+\defaultfontfeatures[\ttfamily]
+ {
+ Numbers = OldStyle,
+ Scale = 0.80,
+ Extension = .otf,
+ }
\setmonofont[
- Numbers = OldStyle,
- Scale = 0.80,
UprightFont = *-Regular,
ItalicFont = *-RegularIt,
BoldFont = *-Semibold,
BoldItalicFont = *-SemiboldIt,
- RawFeature = {+zero,+ss06},
- FontFace = {m}{sc}{LinBiolinum_R.otf},
- Extension = .otf]{SourceCodePro}
-\newfontfamily\sourcecodeprolight{SourceCodePro-Regular.otf}[
+ RawFeature = {+zero,+ss06}]{SourceCodePro}
+\newfontfamily\mysourcecodeprolight{SourceCodePro-Regular.otf}[
Scale = 0.80,FakeStretch =0.75,
FontFace = {m}{it}{Font =SourceCodePro-RegularIt.otf,Color=FF0000}]
\RenewDocumentCommand{\MacroLongFont}{}
{
- \sourcecodeprolight\small
+ \mysourcecodeprolight\small
}
% The character of visible space is now taken from Latin Modern Mono
% to prevent fonts in T1. The original definition for xetex/luatex is
@@ -69,12 +73,13 @@
\newfontfamily\fetamontotf{ffmw10.otf}[
Scale = 0.95,%
RawFeature = {+latn,+rand,+kern,+size},%
- FontFace = {bx}{n}{ffmw10.otf},
+ FontFace = {b}{n}{ffmw10.otf},% fix raplece font
]
\usepackage[svgnames]{xcolor}
\usepackage[sf,bf,compact,medium,pagestyles]{titlesec}
-\usepackage{lastpage,imakeidx,microtype,attachfile2}
-\usepackage{adjustbox,multicol,listings,accsupp,titletoc,hypdestopt}
+\usepackage{lastpage,microtype,attachfile2}
+\usepackage{adjustbox,multicol,listings,accsupp,titletoc}
+\usepackage{imakeidx}
\usepackage{scontents} % main
\usepackage[contents]{colordoc}
% \show\docCodelineNo
@@ -102,6 +107,21 @@
|catcode`| 12|gdef|sxmacro@code#1% \end{macrocode*}[|liii@xmacro@code[#1]|end[macrocode*]]
|endgroup
+% Patching colordoc.sty to work with doc v3 (TeX Live 2022 & lualatex-dev)
+\usepackage{etoolbox}
+\makeatletter
+\@ifpackagelater{doc}{2022-06-01}%
+ {\patchcmd\macro@finish
+ {\ifnot@excluded % \if
+ \edef\@tempa{\noexpand\SpecialIndex{\bslash\macro@namepart}}%
+ \@tempa \fi}%
+ {\maybe@index@macro \macro@namepart}
+ {}{\FAILED}%
+ \let\default@color\current@color
+ }%
+ {}
+\makeatother
+
\EnableCrossrefs
% \PageIndex % \CodelineIndex undoes what \PageIndex does
% \CodelineIndex tries to open another write stream for the index file. We don't
@@ -128,8 +148,8 @@
\ExplSyntaxOff
\indexsetup{level=\section,firstpagestyle=myheader,othercode=\pagestyle{myheader}}
-\makeindex[name=userdoc,options=-s gind.ist,columnsep=15pt,title={Index of Documentation}]
-\makeindex[options=-s gind.ist,columnsep=15pt,title={Index of Implementation}]
+\makeindex[name=userdoc,options={-q -s gind.ist},columnsep=15pt,title={Index of Documentation}]
+\makeindex[options={-q -s gind.ist},columnsep=15pt,title={Index of Implementation}]
% Now, after imakeidx opens the write stream for the index file, we copy
% the reference to \@indexfile:
\makeatletter
@@ -420,7 +440,7 @@
% Reserved words 6 (optcolor)
keywordstyle = [6]{\color{optcolor}},%
keywords = [6]{store-cmd,store-env,print-env,print-cmd,write-env,%
- start,stopt,wrapper,sep,step,before,after,write-out,%
+ start,stopt,wrapper,sep,step,before,after,write-out,write-cmd,%
overwrite,width-tab,force-eol,inner,outer,I,J,M,L,Ascheol},%
% Reserved words 7 (OrangeRed)
keywordstyle = [7]{\color{OrangeRed}},%
@@ -501,18 +521,18 @@
\lstMakeShortInline[language=scontents-doc,basicstyle=\ttfamily]§
% Get file info
-\GetFileInfo{\jobname.sty}
+\GetFileInfo{scontents.sty}
% Config hyperref
\hypersetup{
allcolors = linkcolor,
- colorlinks = true,%
- linktoc = all,%
- pdftitle = {.:: The scontents package --- \fileinfo{} ::.},%
+ colorlinks = true,
+ linktoc = all,
+ pdftitle = {.:: The scontents package --- \fileinfo{} ::.},
pdfauthor = {Pablo González L},
- pdfsubject = {Documentation for \fileversion{} [\filedate] },%
- pdfkeywords = {sequences, contents, external files, expl3, xparse, l3seq, store contents},
- bookmarksopenlevel = 1,%
+ pdfsubject = {Documentation for \fileversion{} [\filedate] },
+ pdfkeywords = {sequences, contents, external files, expl3, l3seq, store contents},
+ bookmarksopenlevel = 1
}
% Configuration titleps and titlesec
@@ -530,7 +550,7 @@
}
\setfoot{\rlap{\hskip\dimexpr-\oddsidemargin-1in\relax%
\parbox{1.93\paperwidth}{\hfil\thepage\,/\,\pageref{LastPage}}}}%
- {\parbox{\textwidth}{\raggedright \textcolor{gray}{\raisebox{-1pt}{\textcopyright}{}2019--2020 by Pablo González}}}%
+ {\parbox{\textwidth}{\raggedright \textcolor{gray}{\raisebox{-1pt}{\textcopyright}{}2019--2022 by Pablo González}}}%
{}%
\sethead{\llap{\raisebox{0.55cm}{\parbox{\dimexpr\oddsidemargin+1in\relax}{\makebox[0pt][l]{\hspace{15pt}\pkglogo\space\fileversion}}}}}
{\raisebox{0.55cm}{\parbox{\textwidth}{\hspace*{-\oddsidemargin}\centering\small\S.\thesection\space\sectiontitle}}}%
@@ -580,12 +600,12 @@
% \scalebox{1.57}{\pkglogo}\\[2pt]
% \Large
% \textsf{Stores \hologo{LaTeX}}{ \fetamontotf{contents} }\\[3pt]
-% \fileversion{} --- \filedate\thanks{
+% \fileversion \quad \filedate\thanks{
% This file describes a documentation for \fileversion, last revised
% \filedate.}\\[25pt]
% \author{
% \large
-% \raisebox{-1pt}{\textcopyright}{}2019--2020 by Pablo González\thanks{
+% \raisebox{-1pt}{\textcopyright}{}2019--2022 by Pablo González\thanks{
% E-mail: \textcolor{OrangeRed}{\textsf{\guillemotleft}}\email{pablgonz@educarchile.cl}\textcolor{OrangeRed}{\textsf{\guillemotright}}.
% }%
% }
@@ -610,12 +630,23 @@
%
% \setlength{\parskip}{3pt}
%
+% \section{Description of the package}
+%
+% \begin{scontents}[store-env=description, print-env=true]
+% The \mypkg*{scontents} package allows to \mymeta{store contents} in \mymeta{sequences}
+% or \mymeta{external files}. In some ways it is similar to the \mypkg{filecontentsdef}
+% package, with the difference in which the \mymeta{content} is stored. The idea behind
+% this package is to get an approach to \hologo{ConTeXt} \enquote{\emph{buffers}} by
+% making use \mymeta{sequences}.
+% \end{scontents}
+%
% \section{Motivation and Acknowledgments}
%
% In \hologo{LaTeX} there is no direct way to record content for later use, although
% you can do this using §\macros§, recording \mymeta[type=rm]{verbatim content} is a
-% problem, usually you can avoid this by creating external files or boxes. The
-% general idea of this package is to try to imitate this implementation
+% problem, usually you can avoid this by creating external files or boxes.
+%
+% The general idea of this package is to try to imitate this implementation
% \enquote{\emph{buffers}} that has \hologo{ConTeXt} which allows you to save content in
% memory, including \emph{verbatim}, to be used later. The package
% \mypkg{filecontentsdef} solves this problem and since \mypkg{expl3} has an
@@ -625,7 +656,7 @@
% Fran\c{c}ois Burnol} who was kind enough to take my requirements into account
% and add the \myenv{filecontentsdefmacro} environment. Also a special thanks to
% Phelype Oleinik who has collaborated and adapted a large part of the code and
-% all \hologo{LaTeX3} team for their great work and to the different members
+% all \hologo{LaTeX} team for their great work and to the different members
% of the \href{https://tex.stackexchange.com}{TeX-SX} community who have provided
% great answers and ideas. Here a note of the main ones:
%
@@ -641,6 +672,10 @@
% \item \href{https://tex.stackexchange.com/q/373647/7832}{Collect contents of an environment (that contains verbatim content)}
% \end{enumerate}
%
+% \thispagestyle{plain}
+% \newpage
+% \pagestyle{myheader}
+%
% \section{License and Requirements}
% \label{sec:licence}
%
@@ -649,30 +684,41 @@
% (\url{http://www.latex-project.org/lppl.txt}). The software has the status
% \enquote{maintained}.
%
-% \medskip
-%
-% The \mypkg*{scontents} package loads \mypkg{expl3}, \mypkg{xparse} and
+% The \mypkg*{scontents} package loads \mypkg{expl3} (minimum version 2020-02-08) and
% \mypkg{l3keys2e}. This package can be used with "plain", "context", "xelatex",
% "lualatex", "pdflatex" and the classical workflow §latex>dvips>ps2pdf§.
%
-% \thispagestyle{plain}
-%
-% \newpage
-%
-% \pagestyle{myheader}
-%
% \section{The \texttt{scontents} package}
% \label{sec:pkgscontents}
%
-% \subsection{Description of the package and load}
+% \subsection{Installation}
%
-% \begin{scontents}[store-env=description, print-env=true]
-% The \mypkg*{scontents} package allows to \mymeta{store contents} in \mymeta{sequences}
-% or \mymeta{external files}. In some ways it is similar to the \mypkg{filecontentsdef}
-% package, with the difference in which the \mymeta{content} is stored. The idea behind
-% this package is to get an approach to \hologo{ConTeXt} \enquote{\emph{buffers}} by
-% making use \mymeta{sequences}.
-% \end{scontents}
+% The package \mypkg*{scontents} is present in \hologo{TeX} Live and \hologo{MiKTeX},
+% use the package manager to install. For manual installation, download
+% \href{https://mirrors.ctan.org/macros/latex/contrib/scontents.zip}{scontents.zip}
+% and unzip it, run \lstinline[language=scontents-doc,basicstyle=\ttfamily]+luatex scontents.ins+
+% and move all files to appropriate locations, then run "mktexlsr". To produce the documentation
+% with source code run \lstinline[language=scontents-doc,basicstyle=\ttfamily]+luatex scontents.ins+ and
+% "lualatex scontents.dtx" three times.
+%
+% \iffalse
+%<*example>
+% \fi
+\begin{examplecode}[frame=single,language={}]
+ scontents.tex > TDS:tex/generic/scontents/
+ scontents-code.tex > TDS:tex/generic/scontents/
+ scontents.sty > TDS:tex/latex/scontents/
+ t-scontents.mkiv > TDS:tex/context/third/scontents/
+ scontents.pdf > TDS:doc/latex/scontents/
+ README.md > TDS:doc/latex/scontents/
+ scontents.dtx > TDS:source/latex/scontents/
+ scontents.ins > TDS:source/latex/scontents/
+\end{examplecode}
+% \iffalse
+%</example>
+% \fi
+%
+% \subsection{Loading and options}
%
% The package is loaded in the usual way:
%
@@ -731,10 +777,10 @@
%
% Some users use horizontal "TAB"s \enquote{\LKeyTab} from keyboard to indented the source
% code of the document and depending on the text editor used, some will use real "TAB"s
-% (\enquote{hard tabs}), others with \enquote{soft tabs}(\verb*| | or \verb*| |)
+% (\enquote{\emph{hard tabs}}), others with \enquote{\emph{soft tabs}}(\verb*| | or \verb*| |)
% or both.
%
-% At first glance it may seem the same, but the way in which "TAB"s (\enquote{hard tabs})
+% At first glance it may seem the same, but the way in which "TAB"s (\enquote{\emph{hard tabs}})
% are processed according to the context in which they are found within
% a file, both in \mymeta{reading}\footnote{Check the answer given by Ulrich Diez
% in \href{https://tex.stackexchange.com/a/508103/7832}{Keyboard TAB
@@ -746,7 +792,7 @@
% are treated as explicit spaces (in most contexts) and is the behavior when
% \mymeta{stored contents}, but when \mymeta{writing files} these are preserved.
%
-% With a \hologo{TeX}Live distribution, the "TAB" character is \enquote{printable}
+% With a \hologo{TeX} Live distribution, the "TAB" character is \enquote{\emph{printable}}
% for "latex", "pdflatex" and "lualatex", but if you use "xelatex" you
% must add the \texttt{\textcolor{optcolor}{-8bit}} option on the command
% line, otherwise you will get \hologo{TeX}-"TAB" (§^^I§) in the \mymeta{output file}.
@@ -796,7 +842,7 @@
% environment and the \mykey{store-cmd} key of the \ics*{Scontents} command. This key is
% only available as a package option or using \ics*{setupsc}.
%
-% \newpage
+% \medskip
%
% \keyexamp{overwrite}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false}
% Sets whether the \mymeta{files} generated by \mykey{write-out} and \mykey{write-env}
@@ -1198,7 +1244,6 @@ This text is in the outer environment (after nested).
% stored in the \mymarg{seq name}. The key \mykey{width-tab} is available for
% this command.
%
-%
% \subsection{The environment \env{verbatimsc}}
% \label{sec:verbatimsc}
%
@@ -1209,14 +1254,11 @@ This text is in the outer environment (after nested).
% contents.
% \end{function}
%
-% One consideration to keep in mind is that this is a \emph{representation}
-% of the \mymeta{stored content} in a \emph{verbatim} environment and not
-% a real \emph{verbatim} environment. The \mypkg{verbatim} package is not
-% compatible with the implementation of the \myenv*{verbatimsc} environment.
+% One consideration to keep in mind is that this is a \enquote{\emph{representation}}
+% of the \mymeta{stored content} in a \enquote{\emph{verbatim}} environment.
%
-%^^A \newpage
-%
-% The \myenv*{verbatimsc} environment can be customized in the following ways:
+% The \myenv*{verbatimsc} environment can be customized in the
+% following ways after loading the \mypkg*{scontents} package:
%
% Using the package \mypkg{fancyvrb}:
% \iffalse
@@ -1227,6 +1269,7 @@ This text is in the outer environment (after nested).
\let\verbatimsc\@undefined
\let\endverbatimsc\@undefined
\makeatother
+\usepackage{fancyvrb}
\DefineVerbatimEnvironment{verbatimsc}{Verbatim}{numbers=left}
\end{examplecode}
% \iffalse
@@ -1624,7 +1667,6 @@ This is from the verbatim environment:
% \textattachfile[color=linkcolor,print=false]{scexamp5.ltx}{\faFile*[regular]}.
% \lstinputlisting[language=scontents-doc,numbers=left]{scexamp5.ltx}
%
-%
% \subsubsection*{Example 6}
%
% \iffalse
@@ -1796,7 +1838,7 @@ and more.+
%<*example>
% \fi
\begin{scontents}[write-out=scexamp9.ltx]
-% arara: xelatex : {shell: true, options: [-8bit]}
+% arara: xelatex: {shell: true, options: [-8bit]}
% arara: clean: { extensions: [ aux, log] }
\documentclass{article}
\usepackage{scontents}
@@ -1852,7 +1894,6 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%
% \newpage
%
-%
% \section{Change history}
% \label{sec:changes}
%
@@ -1864,11 +1905,18 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%
% \setlist[itemize,1]{label=\textendash,wide=0.5em,nosep,noitemsep,leftmargin=10pt}
% \newlength\descrwidth
-% \settowidth{\descrwidth}{\textsf{v1.0, (ctan), 2019-07-30} }
+% \settowidth{\descrwidth}{\textsf{v1.0a, (ctan), 2019-07-30} }
%
% \begin{description}[font=\small\sffamily,wide=0pt,style=multiline,leftmargin=\descrwidth,nosep,noitemsep]
% \item [\fileversion{} (ctan), \filedate]
% \begin{itemize}
+% \item Adapting the |verbatimsc| environment (compatibility |verbatim| package).
+% \item Removed compatibility layer for older \hologo{LaTeX} releases.
+% \item Fix loader in \hologo{plainTeX} and \hologo{ConTeXt}.
+% \item Minor adjustments in the documentation.
+% \end{itemize}
+% \item [v1.9 (ctan), 2020-01-21]
+% \begin{itemize}
% \item Update and improvements in the internal code.
% \item Updating the generic code for |I/O| verification.
% \item Add |write-cmd| and |write-out| keys for |\Scontents*|.
@@ -1916,7 +1964,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \item Added |force-eol|, |verb-font| and |width-tab| keys.
% \item The extra space has been removed when you run |\getstored|.
% \item Internal code has been rewritten more efficiently.
-% \item Remove |\typestored|.
+% \item Remove starred argument for |\typestored|.
% \item Remove |filecontentsdef| dependency.
% \item Changing |\regex_replace_all:| for |\tl_replace_all:|.
% \end{itemize}
@@ -1948,15 +1996,15 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \def\section*#1{\stdsection{#1}}
%
% \begin{thebibliography}{9}
-% \bibitem{expl3} The \hologo{LaTeX3} Project. \enquote{The \textsf{expl3}
+% \bibitem{expl3} The \hologo{LaTeX} Project. \enquote{The \textsf{expl3}
% package}. Available from
% \textsc{ctan}, \url{https://www.ctan.org/pkg/expl3}, 2020.
%
-% \bibitem{xparse} The \hologo{LaTeX3} Project. \enquote{The \textsf{xparse}
+% \bibitem{xparse} The \hologo{LaTeX} Project. \enquote{The \textsf{xparse}
% package}. Available from
% \textsc{ctan}, \url{https://www.ctan.org/pkg/xparse}, 2020.
%
-% \bibitem{l3keys} The \hologo{LaTeX3} Project. \enquote{The \textsf{l3keys2e}
+% \bibitem{l3keys} The \hologo{LaTeX} Project. \enquote{The \textsf{l3keys2e}
% package}. Available from
% \textsc{ctan}, \url{https://www.ctan.org/pkg/l3keys2e}, 2020.
%
@@ -2005,38 +2053,30 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%
% Now we define some common macros to hold the package date and version:
% \begin{macrocode}
-%<loader>\def\ScontentsFileDate{2020-01-21}%
-%<core>\def\ScontentsCoreFileDate{2020-01-21}%
+%<loader>\def\ScontentsFileDate{2022-04-04}%
+%<core>\def\ScontentsCoreFileDate{2022-04-04}%
%<*loader>
-\def\ScontentsFileVersion{1.9}%
+\def\ScontentsFileVersion{2.0}%
\def\ScontentsFileDescription{Stores LaTeX contents in memory or files}%
% \end{macrocode}
%
% The \LaTeX{} loader is fairly simple: just load the dependencies, load the
% core code, and then set interfaces up.
%
-% We also check if the \pkg{verbatim} package is loaded and show a compatibility
-% warning.
% \begin{macrocode}
%<*latex>
-\RequirePackage{expl3,xparse,l3keys2e}[2019/05/28]
+\RequirePackage{l3keys2e}[2020/02/08]
\ProvidesExplPackage
{scontents} {\ScontentsFileDate} {\ScontentsFileVersion} {\ScontentsFileDescription}
-\@ifpackageloaded { verbatim }
- {
- \msg_set:nnn { scontents } { unsupported-verbatim }
- {
- The~implementation~of~the~'verbatimsc'~environment~used~by~
- \iow_char:N \\typestored~is~not~compatible~with~package~'verbatim'.~
- Review~the~documentation~and~redefine~the~'verbatimsc'~environment.
- }
- \msg_warning:nn { scontents } { unsupported-verbatim }
- } { }
%</latex>
% \end{macrocode}
-% The Plain and \hologo{ConTeXt} loaders are similar (probably because I don't
-% know how to make a proper \hologo{ConTeXt} module :-). We define a
-% \LaTeX{}-style §\ver@scontents.sty§ macro with version info (just in case):
+%
+% The \hologo{plainTeX} and \hologo{ConTeXt} loaders are similar
+% (probably because I don't know how to make a proper \hologo{ConTeXt}
+% module :-). We define a \LaTeX{}-style §\ver@scontents.sty§ macro with
+% version info (just in case) and add §\ExplSyntaxOn§ to be able to load
+% \pkg{xparse} later.
+%
% \begin{macrocode}
%<*!latex>
%<context>\writestatus{loading}{User Module scontents v\ScontentsFileVersion}
@@ -2049,8 +2089,8 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%</!latex>
% \end{macrocode}
%
-% In Plain, check that the package isn't being loaded twice (\LaTeX{} and
-% \hologo{ConTeXt} already defend against that):
+% In \hologo{plainTeX}, check that the package isn't being loaded twice
+% (\LaTeX{} and \hologo{ConTeXt} already defend against that):
% \begin{macrocode}
%<*plain>
\msg_gset:nnn { scontents } { already-loaded }
@@ -2064,14 +2104,18 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%</plain>
% \end{macrocode}
%
-% \begin{macro}{\g_@@_end_verbatimsc_tl,\c_@@_end_env_tl}
-% A token list to match when ending \env{verbatimsc} and \env{scontents}
-% environments.
+% \subsection{Definition of variables by format}
+%
+% We define and set variables that must be handled separately in order
+% to work properly with \hologo{plainTeX}, \hologo{ConTeXt} and \LaTeX.
+%
+% \begin{macro}{\g_@@_end_verbatimsc_tl}
+% A global token list \cs{g_@@_end_verbatimsc_tl} match when ending
+% \env{verbatimsc} environment.
%
% \begin{macrocode}
\tl_new:N \g_@@_end_verbatimsc_tl
-\tl_gset_rescan:Nnn
- \g_@@_end_verbatimsc_tl
+\tl_gset_rescan:Nnn \g_@@_end_verbatimsc_tl
{
\char_set_catcode_other:N \\
%<*latex>
@@ -2082,6 +2126,16 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%<latex> { \end{verbatimsc} }
%<plain> { \endverbatimsc }
%<context> { \stopverbatimsc }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\c_@@_end_env_tl,\l_@@_env_name_tl}
+% A token list \cs{c_@@_end_env_tl} match when ending environments
+% defined by \cs{newenvsc}, \cs{l_@@_env_name_tl} storing the name
+% of environments defined by \cs{newenvsc}.
+%
+% \begin{macrocode}
+\tl_new:N \l_@@_env_name_tl
\tl_const:Nx \c_@@_end_env_tl
{
\c_backslash_str
@@ -2099,13 +2153,15 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
\file_input:n { scontents-code.tex }
% \end{macrocode}
%
-% Sometimes we need to detect the format from within a macro:
+% \begin{macro}{\@@_format_case:nnn}
+% Sometimes we need to detect the format from within a macro:
% \begin{macrocode}
\cs_new:Npn \@@_format_case:nnn #1 #2 #3
%<latex> {#1} % LaTeX
%<plain> {#2} % Plain/Generic
%<context> {#3} % ConTeXt
% \end{macrocode}
+% \end{macro}
%
% Checking that the package was loaded with the proper loader code. This code
% was copied from \texttt{expl3-code.tex}.
@@ -2156,10 +2212,45 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
\next
% \end{macrocode}
%
-% \subsection{Definition of common keys}
+% \subsection{Definition of temporary variables}
+%
+% \begin{macro}{\l_@@_macro_tmp_tl,\l_@@_temp_tl,\g_@@_temp_tl,\l_@@_tmpa_int,
+% \l_@@_temp_bool}
+% The token list \cs{l_@@_macro_tmp_tl} is a temporary token list to
+% hold the contents of the macro/environment. \cs{l_@@_temp_tl},
+% \cs{g_@@_temp_tl}, \cs{l_@@_tmpa_int} and \cs{l_@@_temp_bool} are
+% generic temporary vars.
+% \begin{macrocode}
+\tl_new:N \l_@@_macro_tmp_tl
+\tl_new:N \l_@@_temp_tl
+\tl_new:N \g_@@_temp_tl
+\int_new:N \l_@@_tmpa_int
+\bool_new:N \l_@@_temp_bool
+% \end{macrocode}
+% \end{macro}
%
-% We create some common \mymeta{keys} that will be used by the options passed to
-% the package as well as by the environments and commands defined.
+% \subsection{Compatibility layer with \hologo{plainTeX} and \hologo{ConTeXt}}
+%
+% When loading the package outside of \LaTeX{} we can't usually use
+% \pkg{xparse}. However since \pkg{xparse} now \pkg{ltcmd} is part of
+% the \LaTeX{} kernel is loadable in any format.
+%
+% \begin{macrocode}
+%</core>
+%<*loader&!latex>
+\int_set:Nn \l_@@_tmpa_int { \char_value_catcode:n { `\@ } }
+\char_set_catcode_letter:N \@
+\file_input:n { xparse-generic.tex }
+\char_set_catcode:nn { `\@ } { \l_@@_tmpa_int }
+%</loader&!latex>
+%<*core>
+% \end{macrocode}
+%
+% \subsection{Definition of keys for the package}
+%
+% We create some common \mymeta{keys} that will be used by the options
+% passed to the package as well as by the environments and commands
+% defined.
%
% \begin{macrocode}
\keys_define:nn { scontents }
@@ -2198,74 +2289,78 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%<plain|context> { verb-font .initial:n = \tt }
% \end{macrocode}
%
-% In \LaTeX{} mode we load \mypkg{l3keys2e} process the \mymeta{keys} as options
-% passed on to the package, the package \pkg{l3keys2e} will verify the
-% \mymeta{keys} and will return an error when they are \emph{unknown}.
+% In \LaTeX{} mode we load \mypkg{l3keys2e} process the \mymeta{keys}
+% as options passed on to the package, the package \pkg{l3keys2e} will
+% verify the \mymeta{keys} and will return an error when they are
+% \emph{unknown}.
% \begin{macrocode}
%<latex>\ProcessKeysOptions { scontents }
%<*core>
% \end{macrocode}
%
-% \subsection{Internal variables}
+% \subsection{Internal variables and utility functions}
+%
+% \begin{macro}{\l_@@_fname_out_tl,\l_@@_every_line_env_tl,\l_@@_file_iow}
+% The token list \cs{l_@@_fname_out_tl} is used for store the name of
+% the \meta{output file}, when there's one. Its value is set by the
+% keys §write-env§, §write-out§ and §write-cmd§.
+%
+% The token list \cs{l_@@_every_line_env_tl} holds the contents of an
+% environment, \env{scontents} by default, as it's being read.
+% \cs{l_@@_file_iow} is an output stream for saving the contents of an
+% environment (or command) to a file.
%
-% Now we declare the internal variables we will use.
+% This variables is used by the function \cs{@@_file_tl_write_start:n}
+% (see \ref{the:environment:itself}).
%
-% \begin{macro}{\l_@@_macro_tmp_tl,\l_@@_fname_out_tl,\l_@@_temp_tl,
-% \l_@@_file_tl,\g_@@_temp_tl,\l_@@_foreach_name_seq_tl,
-% \l_@@_foreach_before_tl,\l_@@_foreach_after_tl}
-% \cs{l_@@_macro_tmp_tl} is a temporary token list to hold the contents
-% of the macro/environment, \cs{l_@@_fname_out_tl} is used as the name
-% of the output file, when there's one, \cs{l_@@_file_tl} holds the contents
-% of an environment as it's being read, and \cs{l_@@_temp_tl} and
-% \cs{g_@@_temp_tl} are generic temporary token lists.
+% \begin{macrocode}
+\tl_new:N \l_@@_fname_out_tl
+\tl_new:N \l_@@_every_line_env_tl
+\iow_new:N \l_@@_file_iow
+% \end{macrocode}
+% \end{macro}
%
+% \begin{macro}{\l_@@_foreach_name_seq_tl,\l_@@_foreach_before_tl,\l_@@_foreach_after_tl}
% \cs{l_@@_foreach_name_seq_tl} is the name assigned to the sequence on
% which the loop will be made, \cs{l_@@_foreach_before_tl} and \cs{l_@@_foreach_after_tl}
% are token lists in which the assigned material will be placed before
% and after the execution of the §\foreachsc§ loop.
%
% \begin{macrocode}
-\tl_new:N \l_@@_macro_tmp_tl
-\tl_new:N \l_@@_fname_out_tl
-\tl_new:N \l_@@_temp_tl
-\tl_new:N \l_@@_file_tl
-\tl_new:N \g_@@_temp_tl
\tl_new:N \l_@@_foreach_name_seq_tl
\tl_new:N \l_@@_foreach_before_tl
\tl_new:N \l_@@_foreach_after_tl
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\l_@@_seq_item_int,\l_@@_env_nesting_int,\l_@@_tmpa_int,
-% \l_@@_foreach_stop_int}
+% \begin{macro}{\l_@@_seq_item_int,\l_@@_env_nesting_int,\l_@@_foreach_stop_int}
% \cs{l_@@_seq_item_int} stores the index in the sequence of the item
-% requested to \cs{typestored} or \cs{meaningsc}. \cs{l_@@_env_nesting_int}
+% requested to §\typestored§ or §\meaningsc§. \cs{l_@@_env_nesting_int}
% stores the current nesting level of the \env{scontents} environment.
-% \cs{l_@@_foreach_stop_int} will save the value at which the §\foreachsc§
-% loop will stop.
+% \cs{l_@@_foreach_stop_int} will save the value at which the §\foreachsc§
+% loop will stop.
%
% \begin{macrocode}
\int_new:N \l_@@_foreach_stop_int
\int_new:N \l_@@_seq_item_int
\int_new:N \l_@@_env_nesting_int
-\int_new:N \l_@@_tmpa_int
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\l_@@_writing_bool,\l_@@_storing_bool}
+% \begin{macro}{\l_@@_writing_bool,\l_@@_storing_bool,\l_@@_writable_bool}
% The boolean \cs{l_@@_writing_bool} keeps track of whether we should write
% to a file, and \cs{l_@@_storing_bool} determines whether it is in write-only
-% mode when the §write-out§ option is used.
+% mode when the key §write-out§ is used.
%
% \begin{macrocode}
\bool_new:N \l_@@_writing_bool
\bool_set_false:N \l_@@_writing_bool
\bool_new:N \l_@@_storing_bool
\bool_set_true:N \l_@@_storing_bool
+\bool_new:N \l_@@_writable_bool
% \end{macrocode}
% \end{macro}
%
-%
% \begin{macro}{\l_@@_foreach_before_bool,\l_@@_foreach_after_bool,
% \l_@@_foreach_stop_bool,\l_@@_foreach_wrapper_bool}
% Boolean variables used by the §\foreachsc§ loop.
@@ -2279,7 +2374,6 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
\bool_set_false:N \l_@@_foreach_stop_bool
\bool_new:N \l_@@_foreach_wrapper_bool
\bool_set_false:N \l_@@_foreach_wrapper_bool
-\bool_new:N \l_@@_writable_bool
% \end{macrocode}
% \end{macro}
%
@@ -2313,20 +2407,25 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\l_@@_file_iow}
-% An output stream for saving the contents of an environment to a file.
+% \begin{macro}{\l_@@_save_sf_int,\l_@@_save_skip}
+% Internal variables used by functions \cs{@@_bsphack:} and \cs{@@_esphack:}.
%
% \begin{macrocode}
-\iow_new:N \l_@@_file_iow
+\int_new:N \l_@@_save_sf_int
+\skip_new:N \l_@@_save_skip
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_rescan_tokens:n}
-% \cs{tl_rescan:nn} doesn't fit the needs of this package because
-% it does not allow catcode changes inside the argument, so verbatim
-% commands used inside one of \mypkg*{scontents}'s commands/environments
-% will not work. Here we create a private copy of \cs{tex_scantokens:D}
-% which will serve our purposes.
+% \begin{macro}{\@@_rescan_tokens:n,\@@_rescan_tokens:x,\@@_rescan_tokens:V}
+% The function \cs{tl_rescan:nn} provided by \pkg{expl3} doesn't fit
+% the needs of this package because it does not allow catcode changes
+% inside the argument, so verbatim commands used inside one of
+% \mypkg*{scontents}'s commands/environments will not work. Here we
+% create a private copy of \cs{tex_scantokens:D} which will serve our
+% purposes. See the answer by Ulrich Diez in
+% \href{https://tex.stackexchange.com/a/577183/7832}{How do use
+% \{<setup>\} in \textbackslash tl_set_rescan:Nnn to replace
+% \textbackslash scantokens?}
%
% \begin{macrocode}
\cs_new_protected:Npn \@@_rescan_tokens:n #1 { \tex_scantokens:D {#1} }
@@ -2345,7 +2444,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%
% \begin{macro}[int]{\tl_remove_once:NV,\tl_replace_all:Nxx,
% \tl_replace_all:Nxn,\tl_replace_all:Nnx,\tl_if_empty:fTF}
-% Some nonstandard variants.
+% Some nonstandard kernel variants.
%
% \begin{macrocode}
\cs_generate_variant:Nn \tl_remove_once:Nn { NV }
@@ -2406,7 +2505,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
\bool_set_true:N \l_@@_writing_bool
\tl_set:Nn \l_@@_fname_out_tl {#1}
},
- write-env .value_required:n = true,
+ write-cmd .value_required:n = true,
write-out .value_required:n = true,
print-cmd .meta:nn = { scontents } { print-cmd = #1 },
print-cmd .default:n = true,
@@ -2476,7 +2575,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%
% \subsection{Handling undefined keys}
%
-% The \mymeta{keys} are stored in the token list variable \cs{l_keys_key_tl},
+% The \mymeta{keys} are stored in the token list variable \cs{l_keys_key_str},
% and the value (if any) is passed as an argument to each \mymeta{function}.
%
% \subsubsection{Undefined keys for environment \env{scontents}}
@@ -2490,7 +2589,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%
% \begin{macrocode}
\cs_new_protected:Npn \@@_parse_environment_keys:n #1
- { \exp_args:NV \@@_parse_environment_keys:nn \l_keys_key_tl {#1} }
+ { \exp_args:NV \@@_parse_environment_keys:nn \l_keys_key_str {#1} }
\cs_new_protected:Npn \@@_parse_environment_keys:nn #1#2
{
\tl_if_blank:nTF {#2}
@@ -2511,7 +2610,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%
% \begin{macrocode}
\cs_new_protected:Npn \@@_parse_command_keys:n #1
- { \exp_args:NV \@@_parse_command_keys:nn \l_keys_key_tl {#1} }
+ { \exp_args:NV \@@_parse_command_keys:nn \l_keys_key_str {#1} }
\cs_new_protected:Npn \@@_parse_command_keys:nn #1#2
{
\tl_if_blank:nTF {#2}
@@ -2538,7 +2637,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
{ \msg_error:nnnn { scontents } { for-key-value-unknown } {#1} {#2} }
}
\cs_new_protected:Npn \@@_parse_foreach_keys:n #1
- { \exp_args:NV \@@_parse_foreach_keys:nn \l_keys_key_tl {#1} }
+ { \exp_args:NV \@@_parse_foreach_keys:nn \l_keys_key_str {#1} }
% \end{macrocode}
% \end{macro}
%
@@ -2564,7 +2663,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%
% \begin{macrocode}
\cs_new_protected:Npn \@@_parse_type_meaning_key:n #1
- { \exp_args:NV \@@_parse_type_meaning_key:nn \l_keys_key_tl {#1} }
+ { \exp_args:NV \@@_parse_type_meaning_key:nn \l_keys_key_str {#1} }
\cs_new_protected:Npn \@@_parse_type_meaning_key:nn #1#2
{
\tl_if_empty:fTF { \int_to_roman:n { -0 #1 } }
@@ -2582,123 +2681,15 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \end{macrocode}
% \end{macro}
%
-% \subsection{Compatibility layer with Plain}
-%
-% When loading the package outside of \LaTeX{} we can't usually use \pkg{xparse}.
-% However since \pkg{xparse} doesn't actually hold any dependency with \LaTeX{}
-% except for package-loading commands, we can emulate those commands (much like
-% in \pkg{miniltx}) so that \pkg{xparse} is loadable in any format.
-%
-% The bunch of macros below is adapted from the \LaTeX{} kernel (greatly simplified).
-% \begin{macrocode}
-%</core>
-%<*loader&!latex>
-\seq_new:N \l_@@_compat_seq
-\cs_new_protected:Npn \@@_compat_redefine:Npn #1
- {
- \seq_put_right:Nn \l_@@_compat_seq {#1}
- \cs_set_eq:cN { @@_saved_\cs_to_str:N #1: } #1
- \cs_new_protected:Npn #1
- }
-\cs_new_protected:Npn \@@_compat_restore:
- { \seq_map_function:NN \l_@@_compat_seq \@@_compat_restore:N }
-\cs_new_protected:Npn \@@_compat_restore:N #1
- {
- \cs_set_eq:Nc #1 { @@_saved_\cs_to_str:N #1: }
- \cs_undefine:c { @@_saved_\cs_to_str:N #1: }
- }
-\cs_generate_variant:Nn \@@_compat_redefine:Npn { c }
-\cs_new_protected:Npn \@@_optarg:nn #1 #2
- { \peek_charcode_ignore_spaces:NTF [ {#1} {#1[#2]} }
-\cs_new_protected:Npn \@@_stararg:nn #1 #2
- { \peek_charcode_remove_ignore_spaces:NTF * {#1} {#2} }
-\@@_compat_redefine:Npn \RequirePackage
- { \@@_optarg:nn { \@@_require_auxi:wn } { } }
-\cs_new_protected:Npn \@@_require_auxi:wn [#1] #2
- { \@@_optarg:nn { \@@_require_auxii:wnw [{#1}]{#2} } { } }
-\cs_new:Npn \@@_zap_space:ww #1~#2
- {
- #1 \if_meaning:w #2 \q_mark
- \exp_after:wN \use_none:n
- \else:
- \exp_after:wN \@@_zap_space:ww
- \fi: #2
- }
-\cs_new_protected:Npn \@@_require_auxii:wnw [#1] #2 [#3]
- {
- \tl_set:Nx \l_@@_temp_tl { \@@_zap_space:ww #2 ~ \q_mark }
- \clist_map_function:NN \l_@@_temp_tl \@@_require_auxiii:n
- }
-\cs_new_protected:Npn \@@_require_auxiii:n #1
- {
- \str_if_eq:eeF {expl3} {#1}
- { \msg_error:nnn { scontents } { invalid-package } {#1} }
- }
-\msg_new:nnn { scontents } { invalid-package }
- { Package~'#1'~invalid~in~scontents.~This~is~an~error~in~scontents. }
-\@@_compat_redefine:cpn { @ifpackagelater } #1
- { \exp_args:Nc \@@_package_later_aux:Nn { ver@#1.sty } }
-\cs_new_protected:Npn \@@_package_later_aux:Nn #1 #2
- {
- \int_compare:nNnTF
- { \exp_after:wN \@@_parse_version:w #1 //00 \q_mark } <
- { \exp_after:wN \@@_parse_version:w #2 //00 \q_mark }
- }
-\cs_new:Npn \@@_parse_version:w #1 { \@@_parse_version_auxi:w 0#1 }
-\cs_new:Npn \@@_parse_version_auxi:w #1/#2/#3#4#5 \q_mark
- { \@@_parse_version_auxii:w #1-#2-#3#4 \q_mark }
-\cs_new:Npn \@@_parse_version_auxii:w #1-#2-#3#4#5 \q_mark
- { \tl_if_blank:nF {#2} {#1} #2 #3 #4 }
-\@@_compat_redefine:Npn \ProvidesExplPackage #1 #2 #3 #4
- { \@@_provides_aux:nn {#1} { #2 \tl_if_empty:nF {#3} {#3~} #4 } }
-\cs_new_protected:Npn \@@_provides_aux:nn #1 #2
- {
- \tl_gset:cx { ver@#1.sty } {#2}
- \iow_log:n { Package~#1:~#2 }
- \ExplSyntaxOn
- }
-\@@_compat_redefine:Npn \DeclareOption
- { \@@_stararg:nn { \use_none:n } { \use_none:nn } }
-\@@_compat_redefine:Npn \ProcessOptions
- { \@@_stararg:nn { } { } }
-% \end{macrocode}
-%
-% Now that the compatibility layer is defined, we can finally load \pkg{xparse}.
-% \pkg{xparse} expects to be loaded with §\ExplSyntaxOff§ (not much harm would
-% be done otherwise, but just to be on the safe side).
-%
-% Within \pkg{xparse} a §\RequirePackage{expl3}§ is done. We can ignore that since
-% we have already loaded \pkg{expl3}. Next, a §\@ifpackagelater§ test is done:
-% we do that test too to ensure that \pkg{xparse} is compatible with the current
-% running version of \pkg{expl3}. The following §\ProvidesExplPackage§ simply
-% defines §\ver@xparse.sty§ for any other package that might uset it, and then
-% does §\ExplSyntaxOn§. At the end of the package, \pkg{xparse} parses (heh)
-% the package options. Since we don't have those in non-\LaTeX{} formats, they are
-% ignored. Okay, so load \pkg{xparse}:
-% \begin{macrocode}
-\int_set:Nn \l_@@_tmpa_int { \char_value_catcode:n { `\@ } }
-\char_set_catcode_letter:N \@
-\exp_after:wN
-\ExplSyntaxOff
-\file_input:n { xparse.sty }
-\ExplSyntaxOn
-\char_set_catcode:nn { `\@ } { \l_@@_tmpa_int }
-\@@_compat_restore:
-%</loader&!latex>
-%<*core>
-% \end{macrocode}
-% (actually we don't need to do §\ExplSyntaxOn§ there because we don't have
-% \LaTeX{}'s full package loading mechanism, so the \pkg{expl3} syntax remains
-% active after \pkg{xparse} is loaded, but it doesn't harm either).
-%
% \subsection{Programming of the sequences}
%
% The storage of the package is done using |seq| variables. Here we
% set up the macros that will manage the variables.
-% \begin{macro}{\@@_append_contents:nn}
-% \cs{@@_append_contents:nn} creates a seq variable if one didn't
-% exist and appends the contents in the argument to the right of the
-% sequence.
+%
+% \begin{macro}{\@@_append_contents:nn,\@@_append_contents:Vx}
+% The function \cs{@@_append_contents:nn} creates a |seq| variable if
+% one didn't exist and appends the contents in the argument to the
+% right of the sequence.
%
% \begin{macrocode}
\cs_new_protected:Npn \@@_append_contents:nn #1#2
@@ -2714,7 +2705,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \end{macro}
%
% \begin{macro}{\@@_getfrom_seq:nn,\@@_getfrom_seq:nnn}
-% \cs{@@_getfrom_seq:nn} retrieves the saved item from the
+% The function \cs{@@_getfrom_seq:nn} retrieves the saved item from the
% sequence.
%
% \begin{macrocode}
@@ -2739,8 +2730,8 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_lastfrom_seq:n}
-% \cs{@@_lastfrom_seq:n} retrieves the last saved item from the
+% \begin{macro}{\@@_lastfrom_seq:n,\@@_lastfrom_seq:V}
+% The function \cs{@@_lastfrom_seq:n} retrieves the last saved item from the
% sequence when \cs{l_@@_print_env_bool} or \cs{l_@@_print_cmd_bool}
% is true.
%
@@ -2758,7 +2749,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \end{macro}
%
% \begin{macro}{\@@_store_to_seq:NN}
-% The \cs{@@_store_to_seq:NN} writes the recorded contents
+% The function \cs{@@_store_to_seq:NN} writes the recorded contents
% in §#1§ to the log and stores it in §#2§.
%
% \begin{macrocode}
@@ -2770,7 +2761,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \end{macrocode}
% \end{macro}
%
-% \subsection{Construction of environment \env{scontents}}
+% \subsection{The command \cs{newenvsc} and environment \env{scontents}}
%
% In order to be able to define environments that behave similarly to
% \myenv{scontents}, we define a generic environment and make all other
@@ -2778,14 +2769,17 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%
% \subsubsection{The command \cs{newenvsc}}
%
-% \begin{macro}{\newenvsc,\l_@@_env_name_tl,\@@_scontents_setenv:nn}
-% The \cs{newenvsc} command defines two functions \cs[no-index]{@@_\#1_env_begin:}
-% and \cs[no-index]{@@_\#1_env_end:}, which set the current environment's
-% default properties and then call the generic \cs{@@_env_generic_begin:} and
-% \cs{@@_env_generic_end:}.
+% \begin{macro}{\newenvsc,\@@_env_setting:nn,\@@_env_define:nnn}
+% The internal function \cs{@@_env_setting:nn} defines two
+% functions \cs[no-index]{@@_\#1_env_begin:} and
+% \cs[no-index]{@@_\#1_env_end:}, which set the current environment's
+% name in §#1§ and \cs{l_@@_env_name_tl} and default properties in §#2§
+% then call \cs{@@_setup_verb_processor:}, the generic
+% \cs{@@_env_generic_begin:} and \cs{@@_env_generic_end:}.
+%
+% Finally the function \cs{@@_env_define:nnn} will create the environments.
% \begin{macrocode}
-\tl_new:N \l_@@_env_name_tl
-\cs_new_protected:Npn \@@_scontents_setenv:nn #1 #2
+\cs_new_protected:Npn \@@_env_setting:nn #1 #2
{
\cs_new_protected:cpn { @@_#1_env_begin: }
{
@@ -2803,12 +2797,12 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
}
%</core>
%<*loader>
-\NewDocumentCommand { \newenvsc } { m O{} }
+\NewDocumentCommand \newenvsc { m O{} }
{
%<latex|plain> \cs_if_exist:cTF { #1 }
%<context> \cs_if_exist:cTF { start #1 }
{ \msg_error:nnn { scontents } { env-already-defined } {#1} }
- { \@@_scontents_setenv:nn {#1} {#2} }
+ { \@@_env_setting:nn {#1} {#2} }
}
\cs_new_protected:Npn \@@_env_define:nnn #1 #2 #3
{
@@ -2831,11 +2825,10 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%
% \subsubsection{Generic definition of the environment}
%
-% \begin{macro}{
-% \@@_env_generic_begin:,
-% \@@_env_generic_begin:,
-% }
-% Now we define the generic environment \cs{@@_env_generic_begin:}
+% \begin{macro}{\@@_env_generic_begin:,\@@_env_generic_end:}
+%
+% Now we define the generic environment functions
+% \cs{@@_env_generic_begin:} and \cs{@@_env_generic_end:}.
% \begin{macrocode}
\cs_new_protected:Npn \@@_env_generic_begin:
{
@@ -2846,7 +2839,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
{
\@@_stop_environment:
\@@_finish_storing:NNN \l_@@_macro_tmp_tl
- \l_@@_name_seq_env_tl \l_@@_print_env_bool
+ \l_@@_name_seq_env_tl \l_@@_print_env_bool
}
% \end{macrocode}
% \end{macro}
@@ -2860,7 +2853,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \startscontents,
% \stopscontents,
% }
-% Now defining the \myenv{scontents} environment should be easy:
+% Finaly defining the \myenv{scontents} environment should be easy :)
% \begin{macrocode}
%</core>
%<loader>\newenvsc{scontents}
@@ -2870,9 +2863,6 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%
% \subsubsection{key val for environment}
%
-% Define a \myoarg{key \textnormal{\textcolor{gray}{=}} val} for
-% environment \env{scontents}
-%
% \begin{macro}{\@@_grab_optional:n,\@@_grab_optional:w}
% The macro \cs{@@_grab_optional:w} is called from the
% \env{scontents} environment with the tokens following the
@@ -2904,9 +2894,10 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \end{macro}
%
% \subsubsection{The environment itself}
+% \label{the:environment:itself}
%
% \begin{macro}{\@@_start_environment:w,\@@_start_after_option:w,
-% \@@_check_line_process:xn,\@@_stop_environment:}
+% \@@_check_line_process:xn,\@@_stop_environment:}
% Here we make §^^I§, §^^L§ and §^^M§ active characters so that the end of
% line can be \enquote{seen} to be used as a delimiter, and \hologo{TeX} doesn't try to
% eliminate space-like characters.
@@ -2916,19 +2907,21 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% to do the heavy lifting. \cs{@@_grab_optional:w} processes the optional
% argument and calls \cs{@@_start_after_option:w}.
%
-% \cs{@@_start_after_option:w} also checks for trailing tokens after
-% the optional argument and issues an error if any.
+% The function \cs{@@_start_after_option:w} also checks for trailing
+% tokens after the optional argument and issues an error if any.
%
-% In all cases, \cs{@@_check_line_process:xn} ckecks that
+% In all cases, the function \cs{@@_check_line_process:xn} ckecks that
% everything past §\begin{scontents}§ is empty and then process
-% the environment. \cs{@@_check_line_process:xn} calls the
-% \cs{@@_file_tl_write_start:V} function, which will then read the contents
+% the environment.
+%
+% The function \cs{@@_check_line_process:xn} calls the function
+% \cs{@@_file_tl_write_start:V} which will then read the contents
% of the environment and optionally store them in a token list or write to
% an external file.
%
-% When that's done, \cs{@@_file_write_stop:N} does the cleanup. This part of
-% the code is inspired and adapted from the code of the package \pkg{xsimverb}
-% by Clemens Niederberger.
+% When that's done, the function \cs{@@_file_write_stop:N} does the
+% cleanup. This part of the code is inspired and adapted from the code of
+% the package \pkg{xsimverb} by Clemens Niederberger.
%
% \begin{macrocode}
\group_begin:
@@ -2966,8 +2959,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
{ \l_@@_storing_bool }
{ \tl_if_empty_p:N \l_@@_macro_tmp_tl }
{
- \msg_warning:nnx { scontents } { empty-environment }
- { \l_@@_env_name_tl }
+ \msg_warning:nnx { scontents } { empty-environment } { \l_@@_env_name_tl }
}
}
% \end{macrocode}
@@ -3005,7 +2997,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
\iow_open:Nn \l_@@_file_iow {#1}
}
{ \bool_set_false:N \l_@@_writable_bool }
- \tl_clear:N \l_@@_file_tl
+ \tl_clear:N \l_@@_every_line_env_tl
\seq_map_function:NN \l_char_special_seq \char_set_catcode_other:N
\int_step_function:nnnN { 128 } { 1 } { 255 } \char_set_catcode_letter:n
\cs_set_protected:Npx \@@_ret:w ##1 ^^M
@@ -3087,7 +3079,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
\bool_if:NT \l_@@_storing_bool
{
\tl_set:Nn \exp_not:N #1
- { \exp_args:NV \@@_remove_leading_nl:n \l_@@_file_tl }
+ { \exp_args:NV \@@_remove_leading_nl:n \l_@@_every_line_env_tl }
}
}
}
@@ -3111,20 +3103,17 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{
-% \@@_verb_processor_output:n,
-% \@@_verb_processor_output:x,
-% }
-% \cs{@@_verb_processor_output:n} does the output of each line read,
-% to a token list and to a file, depending on the booleans
-% \cs{l_@@_writing_bool} and \cs{l_@@_storing_bool}.
+% \begin{macro}{\@@_verb_processor_output:n,\@@_verb_processor_output:x}
+% The function \cs{@@_verb_processor_output:n} does the output of
+% each line read, to a token list and to a file, depending on the
+% booleans \cs{l_@@_writing_bool} and \cs{l_@@_storing_bool}.
% \begin{macrocode}
\cs_new_protected:Npn \@@_verb_processor_output:n #1
{
\bool_if:NT \l_@@_writable_bool
{ \iow_now:Nn \l_@@_file_iow {#1} }
\bool_if:NT \l_@@_storing_bool
- { \tl_put_right:Nn \l_@@_file_tl { ^^J #1 } }
+ { \tl_put_right:Nn \l_@@_every_line_env_tl { ^^J #1 } }
}
\group_end:
\cs_generate_variant:Nn \@@_verb_processor_output:n { x }
@@ -3169,6 +3158,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
}
\cs_new:Npn \@@_use_none_delimit_by_q_stop:w #1 \q_@@_stop { }
% \end{macrocode}
+%
% In \LaTeX{}, environments start with §\begin{<env>}§, so checking if a
% string contains §\begin{scontents}§ is straightforward. Since no §}§ can
% appear inside §<env>§, then just a macro delimited by §}§ is enough.
@@ -3194,6 +3184,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
\exp_not:N \q_@@_stop
}
% \end{macrocode}
+%
% In other formats, however, we don't have an \enquote{end anchor} to delimit the
% environment name, so a delimited macro won't help. We have to search for
% the entire environment command (usually §\scontents§ and §\startscontents§).
@@ -3263,11 +3254,14 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\verbatimsc,\endverbatimsc}
-% In Plain we emulate \LaTeX's \env{verbatim} environment.
+% \subsection{The environment \env{verbatimsc}}
+%
+% \begin{macro}[int]{\verbatimsc,\endverbatimsc,\@@_verbatimsc_aux:,
+% \@@_vobeyspaces:,\@@_xverb:,\@@_nolig_list:,\@@_xobeysp:}
+% In \hologo{plainTeX} we emulate \LaTeX's \env{verbatim} environment.
+%
% \begin{macrocode}
%<*plain>
-\bool_new:N \l_@@_temp_bool
\cs_new_protected:Npn \verbatimsc
{
\group_begin:
@@ -3279,9 +3273,9 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
\cs_new_protected:Npn \@@_verbatimsc_aux:
{
\skip_vertical:N \parskip
- \int_set:Nn \parindent { 0pt }
+ \dim_zero:N \parindent
\skip_set:Nn \parfillskip { 0pt plus 1fil }
- \int_set:Nn \parskip { 0pt plus0pt minus0pt }
+ \skip_set:Nn \parskip { 0pt plus0pt minus0pt }
\tex_par:D
\bool_set_false:N \l_@@_temp_bool
\cs_set:Npn \par
@@ -3332,20 +3326,28 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \end{macrocode}
% \end{macro}
%
+%
+% \subsection{The command \cs{Scontents}}
+%
+% User command to \mymeta{stored content}, adapted from code by Ulrich
+% Diez in \href{https://tex.stackexchange.com/a/472044/7832}{Stringify
+% input - \textbackslash string on token list}
+% and code by user siracusa in
+% \href{https://tex.stackexchange.com/a/500281/7832}{Convert a macro from
+% Latex2e to expl3}
+%
% \begin{macro}{\@@_bsphack:,\@@_esphack:}
-% \pkg{xparse} also requires \LaTeX's §\dospecials§. In case it doesn't
-% exist (at the time \pkg{scontents} is loaded) we define §\dospecials§
-% to use the \cs{l_char_special_seq}.
+% We emulate §\@bsphack§ and §\@esphack§ for \hologo{plainTeX}.
+% This is necessary to prevent unwanted spaces when the §print-cmd§
+% key is false.
% \begin{macrocode}
%<*core>
-\int_new:N \l_@@_save_sf_int
-\dim_new:N \l_@@_save_skip_dim
\cs_new_protected:Npn \@@_bsphack:
{
\scan_stop:
\mode_if_horizontal:T
{
- \dim_set_eq:NN \l_@@_save_skip_dim \tex_lastskip:D
+ \skip_set_eq:NN \l_@@_save_skip \tex_lastskip:D
\int_set_eq:NN \l_@@_save_sf_int \tex_spacefactor:D
}
}
@@ -3355,9 +3357,9 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
\mode_if_horizontal:T
{
\int_set_eq:NN \tex_spacefactor:D \l_@@_save_sf_int
- \dim_compare:nNnT { \l_@@_save_skip_dim } > { \c_zero_dim }
+ \dim_compare:nNnT { \l_@@_save_skip } > { \c_zero_skip }
{
- \dim_compare:nNnT { \tex_lastskip:D } = { \c_zero_dim }
+ \skip_if_eq:nnT { \tex_lastskip:D } { \c_zero_skip }
{
\nobreak
\skip_horizontal:n { \c_zero_skip }
@@ -3374,32 +3376,20 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \end{macrocode}
% \end{macro}
%
-% \subsection{The command \cs{Scontents}}
-%
-% User command to \mymeta{stored content}, adapted from
-% \url{https://tex.stackexchange.com/a/500281/7832}.
-%
% \begin{macro}{
% \Scontents,
-% \@@_norm_arg:n,
-% \@@_Scontents_auxi:N,
% \@@_Scontents_internal:nn,
+% \@@_norm_arg:n,
% \@@_verb_arg:w,
-% \@@_verb_arg_internal:n,
% }
-% The §\Scontents§ macro starts by parsing an optional argument and
-% then delegates to \cs{@@_verb_arg:w} or \cs{@@_norm_arg:n} depending whether
-% a star (§*§) argument is present.
-%
-% \cs{@@_norm_arg:n} grabs a normal argument, adds it to the |seq| varaible,
-% and optionally prints it.
-%
-% \cs{@@_verb_arg:w} grabs a verbatim argument using \pkg{xparse}'s |+v|
-% argument parser.
+% The §\Scontents§ command starts by parsing an optional argument to
+% the function \cs{@@_Scontents_internal:nn} then delegates to
+% \cs{@@_verb_arg:w} or \cs{@@_norm_arg:n} depending whether a star
+% (§*§) argument is present.
%
% \begin{macrocode}
%<*loader>
-\NewDocumentCommand { \Scontents }{ !s !O{} }
+\NewDocumentCommand \Scontents { !s !O{} }
{ \@@_Scontents_internal:nn {#1} {#2} }
%</loader>
%<*core>
@@ -3414,17 +3404,43 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
{ \@@_verb_arg:w }
{ \@@_norm_arg:n }
}
+% \end{macrocode}
+%
+% The function \cs{@@_norm_arg:n} grabs a normal argument, adds it to
+% the |seq| varaible and optionally prints it.
+%
+% \begin{macrocode}
\cs_new_protected:Npn \@@_norm_arg:n #1
{
\tl_set:Nn \l_@@_temp_tl {#1}
\@@_Scontents_finish:
}
+% \end{macrocode}
+%
+% The function \cs{@@_verb_arg:w} grabs a verbatim argument using
+% \pkg{xparse}'s |+v| argument parser.
+%
+% \begin{macrocode}
%</core>
%<*loader>
-\NewDocumentCommand { \@@_verb_arg:w } { +v }
+\NewDocumentCommand \@@_verb_arg:w { +v }
{ \@@_verb_arg_internal:n {#1} }
%</loader>
%<*core>
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{
+% \@@_verb_arg_internal:n,
+% \@@_Scontents_finish:,
+% \@@_file_write_cmd:nn,
+% \@@_file_write_cmd:VV,
+% }
+%
+% The function \cs{@@_verb_arg_internal:n} replace all §\^^M§ by
+% §\^^J§ then adds it to the |seq| varaible.
+%
+% \begin{macrocode}
\cs_new_protected:Npn \@@_verb_arg_internal:n #1
{
\tl_set:Nn \l_@@_temp_tl {#1}
@@ -3434,8 +3450,10 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
\cs_new_protected:Npn \@@_Scontents_finish:
{
\@@_file_write_cmd:VV \l_@@_fname_out_tl \l_@@_temp_tl
- \@@_finish_storing:NNN \l_@@_temp_tl
- \l_@@_name_seq_cmd_tl \l_@@_print_cmd_bool
+ \@@_finish_storing:NNN
+ \l_@@_temp_tl
+ \l_@@_name_seq_cmd_tl
+ \l_@@_print_cmd_bool
\use:x
{
\group_end:
@@ -3451,6 +3469,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
\iow_close:N \l_@@_file_iow
}
}
+\cs_generate_variant:Nn \@@_file_write_cmd:nn { VV }
\prg_new_protected_conditional:Npnn \@@_file_if_writable:n #1 { T, F, TF }
{
\bool_if:NTF \l_@@_writing_bool
@@ -3474,20 +3493,19 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
}
{ \prg_return_false: }
}
-\cs_generate_variant:Nn \@@_file_write_cmd:nn { VV }
% \end{macrocode}
% \end{macro}
%
% \subsection{The command \cs{getstored}}
%
-% \begin{macro}{\getstored}
+% \begin{macro}{\getstored,\@@_getstored_internal:nn}
% User command §\getstored§ to extract \mymeta{stored content} in |seq|
% (robust).
%
% \begin{macrocode}
%</core>
%<*loader>
-\NewDocumentCommand { \getstored } { O{-1} m }
+\NewDocumentCommand \getstored { O{-1} m }
{ \@@_getstored_internal:nn {#1} {#2} }
%</loader>
%<*core>
@@ -3506,13 +3524,13 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%
% \subsection{The command \cs{foreachsc}}
%
-% \begin{macro}{\foreachsc}
+% \begin{macro}{\foreachsc,\@@_foreachsc_internal:nn,\@@_foreach_add_body:n}
% User command §\foreachsc§ to loop over \mymeta{stored content} in |seq|.
%
% \begin{macrocode}
%</core>
%<*loader>
-\NewDocumentCommand { \foreachsc } { o m }
+\NewDocumentCommand \foreachsc { o m }
{ \@@_foreachsc_internal:nn {#1} {#2} }
%</loader>
%<*core>
@@ -3561,14 +3579,15 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%
% \subsection{The command \cs{typestored}}
%
-% \begin{macro}{\typestored,\@@_verb_print:N,\@@_xverb:w,verbatimsc}
+% \begin{macro}{\typestored,\@@_typestored_internal:nn,\@@_verb_print:N,
+% \@@_xverb:w}
% The §\typestored§ commands fetches a buffer from memory, prints it
% to the log file, and then calls \cs{@@_verb_print:N}.
%
% \begin{macrocode}
%</core>
%<*loader>
-\NewDocumentCommand { \typestored } { o m }
+\NewDocumentCommand \typestored { o m }
{ \@@_typestored_internal:nn {#1} {#2} }
%</loader>
%<*core>
@@ -3616,11 +3635,6 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
\cs_set_eq:NN ^^M \@@_verb_print_EOL:
}
\group_end:
-% \end{macrocode}
-%
-% Finally, the §verbatimsc§ environment is defined.
-%
-% \begin{macrocode}
\cs_new_protected:Npn \@@_xverb:
{
\char_set_catcode_active:n { 9 }
@@ -3628,6 +3642,18 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
\@@_xverb:w
}
%</core>
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{verbatimsc,\startverbatimsc,\stopverbatimsc}
+% Finally the \hologo{LaTeX} and \hologo{ConTeXt} version of
+% §verbatimsc§ environment is defined.
+%
+% The macro §\endverbatim§ in the second argument of the §verbatimsc§
+% environment is only needed for compatibility with the \pkg{verbatim}
+% package.
+%
+% \begin{macrocode}
%<*loader>
%<*!context>
\use:x
@@ -3645,7 +3671,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
\cs_set_eq:cN { @xverbatim } \@@_xverb:
\verbatim
}
- { }
+ { \endverbatim }
%</latex>
%<context>\definetyping[verbatimsc]
%</loader>
@@ -3653,7 +3679,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \end{macrocode}
% \end{macro}
%
-% \subsection{Some auxiliaries}
+% \subsubsection{Some auxiliaries functions}
%
% \begin{macro}{\@@_tabs_to_spaces:}
% In a verbatim context the |TAB| character is made active and set
@@ -3705,9 +3731,8 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \end{macro}
%
% \begin{macro}{
-% \@@_set_active_eq:NN,
-% \@@_make_control_chars_active:,
-% }
+% \@@_set_active_eq:NN, \@@_make_control_chars_active:,
+% \@@_plain_disable_outer_par:}
% Shortcut definitions for common catcode changes.
% The §^^L§ needs a special treatment in non-\LaTeX{} mode
% because in Plain\,\TeX{} it is an §\outer§ token.
@@ -3758,7 +3783,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \begin{macrocode}
%</core>
%<*loader>
-\NewDocumentCommand { \setupsc } { +m }
+\NewDocumentCommand \setupsc { +m }
{ \keys_set:nn { scontents } {#1} }
%</loader>
%<*core>
@@ -3767,13 +3792,13 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
%
% \subsection{The command \cs{meaningsc}}
%
-% \begin{macro}{\meaningsc}
+% \begin{macro}{\meaningsc,\@@_meaningsc_internal:nn,\@@_meaningsc:n}
% User command §\meaningsc§ to see content stored in |seq|.
%
% \begin{macrocode}
%</core>
%<*loader>
-\NewDocumentCommand { \meaningsc } { o m }
+\NewDocumentCommand \meaningsc { o m }
{ \@@_meaningsc_internal:nn {#1} {#2} }
%</loader>
%<*core>
@@ -3810,7 +3835,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \begin{macrocode}
%</core>
%<*loader>
-\NewExpandableDocumentCommand { \countsc } { m }
+\NewExpandableDocumentCommand \countsc { m }
{ \seq_count:c { g_@@_name_#1_seq } }
%</loader>
%<*core>
@@ -3826,7 +3851,7 @@ Read \Verb{\jobname.tsc} (shows TABs as red arrows):
% \begin{macrocode}
%</core>
%<*loader>
-\NewDocumentCommand { \cleanseqsc } { m }
+\NewDocumentCommand \cleanseqsc { m }
{ \seq_clear_new:c { g_@@_name_#1_seq } }
%</loader>
%<*core>
diff --git a/Master/texmf-dist/source/latex/scontents/scontents.ins b/Master/texmf-dist/source/latex/scontents/scontents.ins
index c5770ae4849..32b3e523311 100644
--- a/Master/texmf-dist/source/latex/scontents/scontents.ins
+++ b/Master/texmf-dist/source/latex/scontents/scontents.ins
@@ -1,9 +1,9 @@
-\input l3docstrip.tex
+\input docstrip.tex
\keepsilent
\askforoverwritefalse
\declarepreamble\standard
-Copyright (C) 2019-2020 by Pablo González L <pablgonz@educarchile.cl>
+Copyright (C) 2019-2022 by Pablo González L <pablgonz@educarchile.cl>
This work may be distributed and/or modified under the conditions of the
LaTeX Project Public License, either version 1.3c of this license or (at
@@ -33,11 +33,11 @@ and the derived files scontents.sty,
\declarepreamble\context
\string\module
[ file=t-scontents,
- version=1.9,
+ version=2.0,
title=\string\CONTEXT\ User Module,
subtitle=Storing Contents,
author=Pablo González,
- date=2020-01-21,
+ date=2022-04-04,
copyright=Pablo González,
email=pablgonz@educarchile.cl,
license=LPPL]
@@ -60,7 +60,7 @@ and the derived files scontents.sty,
\Msg{* To finish the installation you have to move the files into a }
\Msg{* directory searched by TeX. See README.md for instructions.}
\Msg{*}
-\Msg{* To produce the documentation with source code run xelatex }%
+\Msg{* To produce the documentation with source code run lualatex }%
\Msg{* thrice on file scontents.dtx }%
\Msg{*}
\Msg{* Happy TeXing!}
diff --git a/Master/texmf-dist/tex/context/third/scontents/t-scontents.mkiv b/Master/texmf-dist/tex/context/third/scontents/t-scontents.mkiv
index 907c9b63b69..d87d8eda772 100644
--- a/Master/texmf-dist/tex/context/third/scontents/t-scontents.mkiv
+++ b/Master/texmf-dist/tex/context/third/scontents/t-scontents.mkiv
@@ -6,7 +6,7 @@
%%
%% scontents.dtx (with options: `loader,context')
%%
-%% Copyright (C) 2019-2020 by Pablo González L <pablgonz@educarchile.cl>
+%% Copyright (C) 2019-2022 by Pablo González L <pablgonz@educarchile.cl>
%%
%% This work may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3c of this license or (at
@@ -33,16 +33,16 @@
%% scontents.dtx (with options: `loader,context')
%D \module
%D [ file=t-scontents,
-%D version=1.9,
+%D version=2.0,
%D title=\CONTEXT\ User Module,
%D subtitle=Storing Contents,
%D author=Pablo González,
-%D date=2020-01-21,
+%D date=2022-04-04,
%D copyright=Pablo González,
%D email=pablgonz@educarchile.cl,
%D license=LPPL]
-\def\ScontentsFileDate{2020-01-21}%
-\def\ScontentsFileVersion{1.9}%
+\def\ScontentsFileDate{2022-04-04}%
+\def\ScontentsFileVersion{2.0}%
\def\ScontentsFileDescription{Stores LaTeX contents in memory or files}%
\writestatus{loading}{User Module scontents v\ScontentsFileVersion}
\unprotect
@@ -52,12 +52,12 @@
v\ScontentsFileVersion\space \ScontentsFileDescription }
\iow_log:x { Package: ~ scontents ~ \use:c { ver @ scontents . sty } }
\tl_new:N \g__scontents_end_verbatimsc_tl
-\tl_gset_rescan:Nnn
- \g__scontents_end_verbatimsc_tl
+\tl_gset_rescan:Nnn \g__scontents_end_verbatimsc_tl
{
\char_set_catcode_other:N \\
}
{ \stopverbatimsc }
+\tl_new:N \l__scontents_env_name_tl
\tl_const:Nx \c__scontents_end_env_tl
{
\c_backslash_str
@@ -67,89 +67,17 @@
\file_input:n { scontents-code.tex }
\cs_new:Npn \__scontents_format_case:nnn #1 #2 #3
{#3} % ConTeXt
-\keys_define:nn { scontents }
- { verb-font .initial:n = \tt }
-\seq_new:N \l__scontents_compat_seq
-\cs_new_protected:Npn \__scontents_compat_redefine:Npn #1
- {
- \seq_put_right:Nn \l__scontents_compat_seq {#1}
- \cs_set_eq:cN { __scontents_saved_\cs_to_str:N #1: } #1
- \cs_new_protected:Npn #1
- }
-\cs_new_protected:Npn \__scontents_compat_restore:
- { \seq_map_function:NN \l__scontents_compat_seq \__scontents_compat_restore:N }
-\cs_new_protected:Npn \__scontents_compat_restore:N #1
- {
- \cs_set_eq:Nc #1 { __scontents_saved_\cs_to_str:N #1: }
- \cs_undefine:c { __scontents_saved_\cs_to_str:N #1: }
- }
-\cs_generate_variant:Nn \__scontents_compat_redefine:Npn { c }
-\cs_new_protected:Npn \__scontents_optarg:nn #1 #2
- { \peek_charcode_ignore_spaces:NTF [ {#1} {#1[#2]} }
-\cs_new_protected:Npn \__scontents_stararg:nn #1 #2
- { \peek_charcode_remove_ignore_spaces:NTF * {#1} {#2} }
-\__scontents_compat_redefine:Npn \RequirePackage
- { \__scontents_optarg:nn { \__scontents_require_auxi:wn } { } }
-\cs_new_protected:Npn \__scontents_require_auxi:wn [#1] #2
- { \__scontents_optarg:nn { \__scontents_require_auxii:wnw [{#1}]{#2} } { } }
-\cs_new:Npn \__scontents_zap_space:ww #1~#2
- {
- #1 \if_meaning:w #2 \q_mark
- \exp_after:wN \use_none:n
- \else:
- \exp_after:wN \__scontents_zap_space:ww
- \fi: #2
- }
-\cs_new_protected:Npn \__scontents_require_auxii:wnw [#1] #2 [#3]
- {
- \tl_set:Nx \l__scontents_temp_tl { \__scontents_zap_space:ww #2 ~ \q_mark }
- \clist_map_function:NN \l__scontents_temp_tl \__scontents_require_auxiii:n
- }
-\cs_new_protected:Npn \__scontents_require_auxiii:n #1
- {
- \str_if_eq:eeF {expl3} {#1}
- { \msg_error:nnn { scontents } { invalid-package } {#1} }
- }
-\msg_new:nnn { scontents } { invalid-package }
- { Package~'#1'~invalid~in~scontents.~This~is~an~error~in~scontents. }
-\__scontents_compat_redefine:cpn { @ifpackagelater } #1
- { \exp_args:Nc \__scontents_package_later_aux:Nn { ver@#1.sty } }
-\cs_new_protected:Npn \__scontents_package_later_aux:Nn #1 #2
- {
- \int_compare:nNnTF
- { \exp_after:wN \__scontents_parse_version:w #1 //00 \q_mark } <
- { \exp_after:wN \__scontents_parse_version:w #2 //00 \q_mark }
- }
-\cs_new:Npn \__scontents_parse_version:w #1 { \__scontents_parse_version_auxi:w 0#1 }
-\cs_new:Npn \__scontents_parse_version_auxi:w #1/#2/#3#4#5 \q_mark
- { \__scontents_parse_version_auxii:w #1-#2-#3#4 \q_mark }
-\cs_new:Npn \__scontents_parse_version_auxii:w #1-#2-#3#4#5 \q_mark
- { \tl_if_blank:nF {#2} {#1} #2 #3 #4 }
-\__scontents_compat_redefine:Npn \ProvidesExplPackage #1 #2 #3 #4
- { \__scontents_provides_aux:nn {#1} { #2 \tl_if_empty:nF {#3} {#3~} #4 } }
-\cs_new_protected:Npn \__scontents_provides_aux:nn #1 #2
- {
- \tl_gset:cx { ver@#1.sty } {#2}
- \iow_log:n { Package~#1:~#2 }
- \ExplSyntaxOn
- }
-\__scontents_compat_redefine:Npn \DeclareOption
- { \__scontents_stararg:nn { \use_none:n } { \use_none:nn } }
-\__scontents_compat_redefine:Npn \ProcessOptions
- { \__scontents_stararg:nn { } { } }
\int_set:Nn \l__scontents_tmpa_int { \char_value_catcode:n { `\@ } }
\char_set_catcode_letter:N \@
-\exp_after:wN
-\ExplSyntaxOff
-\file_input:n { xparse.sty }
-\ExplSyntaxOn
+\file_input:n { xparse-generic.tex }
\char_set_catcode:nn { `\@ } { \l__scontents_tmpa_int }
-\__scontents_compat_restore:
-\NewDocumentCommand { \newenvsc } { m O{} }
+\keys_define:nn { scontents }
+ { verb-font .initial:n = \tt }
+\NewDocumentCommand \newenvsc { m O{} }
{
\cs_if_exist:cTF { start #1 }
{ \msg_error:nnn { scontents } { env-already-defined } {#1} }
- { \__scontents_scontents_setenv:nn {#1} {#2} }
+ { \__scontents_env_setting:nn {#1} {#2} }
}
\cs_new_protected:Npn \__scontents_env_define:nnn #1 #2 #3
{
@@ -174,28 +102,28 @@
\cs_new:Npn \dospecials
{ \seq_map_function:NN \l_char_special_seq \do }
}
-\NewDocumentCommand { \Scontents }{ !s !O{} }
+\NewDocumentCommand \Scontents { !s !O{} }
{ \__scontents_Scontents_internal:nn {#1} {#2} }
-\NewDocumentCommand { \__scontents_verb_arg:w } { +v }
+\NewDocumentCommand \__scontents_verb_arg:w { +v }
{ \__scontents_verb_arg_internal:n {#1} }
-\NewDocumentCommand { \getstored } { O{-1} m }
+\NewDocumentCommand \getstored { O{-1} m }
{ \__scontents_getstored_internal:nn {#1} {#2} }
-\NewDocumentCommand { \foreachsc } { o m }
+\NewDocumentCommand \foreachsc { o m }
{ \__scontents_foreachsc_internal:nn {#1} {#2} }
-\NewDocumentCommand { \typestored } { o m }
+\NewDocumentCommand \typestored { o m }
{ \__scontents_typestored_internal:nn {#1} {#2} }
\definetyping[verbatimsc]
\group_begin:
\cs_new_protected:Npn \__scontents_plain_disable_outer_par:
{ }
\group_end:
-\NewDocumentCommand { \setupsc } { +m }
+\NewDocumentCommand \setupsc { +m }
{ \keys_set:nn { scontents } {#1} }
-\NewDocumentCommand { \meaningsc } { o m }
+\NewDocumentCommand \meaningsc { o m }
{ \__scontents_meaningsc_internal:nn {#1} {#2} }
-\NewExpandableDocumentCommand { \countsc } { m }
+\NewExpandableDocumentCommand \countsc { m }
{ \seq_count:c { g__scontents_name_#1_seq } }
-\NewDocumentCommand { \cleanseqsc } { m }
+\NewDocumentCommand \cleanseqsc { m }
{ \seq_clear_new:c { g__scontents_name_#1_seq } }
\ExplSyntaxOff
\endinput
diff --git a/Master/texmf-dist/tex/generic/scontents/scontents-code.tex b/Master/texmf-dist/tex/generic/scontents/scontents-code.tex
index 2901886b2e0..01c115c058c 100644
--- a/Master/texmf-dist/tex/generic/scontents/scontents-code.tex
+++ b/Master/texmf-dist/tex/generic/scontents/scontents-code.tex
@@ -6,7 +6,7 @@
%%
%% scontents.dtx (with options: `core')
%%
-%% Copyright (C) 2019-2020 by Pablo González L <pablgonz@educarchile.cl>
+%% Copyright (C) 2019-2022 by Pablo González L <pablgonz@educarchile.cl>
%%
%% This work may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3c of this license or (at
@@ -27,7 +27,7 @@
%% t-scontents.mkiv and
%% scontents-code.tex.
%%
-\def\ScontentsCoreFileDate{2020-01-21}%
+\def\ScontentsCoreFileDate{2022-04-04}%
\begingroup
\catcode32=10
\endlinechar=32
@@ -70,6 +70,11 @@
\fi
\fi
\next
+\tl_new:N \l__scontents_macro_tmp_tl
+\tl_new:N \l__scontents_temp_tl
+\tl_new:N \g__scontents_temp_tl
+\int_new:N \l__scontents_tmpa_int
+\bool_new:N \l__scontents_temp_bool
\keys_define:nn { scontents }
{
store-env .tl_set:N = \l__scontents_name_seq_env_tl,
@@ -100,22 +105,20 @@
store-all .meta:n = { store-env = #1 , store-cmd = #1 },
store-all .value_required:n = true
}
-\tl_new:N \l__scontents_macro_tmp_tl
\tl_new:N \l__scontents_fname_out_tl
-\tl_new:N \l__scontents_temp_tl
-\tl_new:N \l__scontents_file_tl
-\tl_new:N \g__scontents_temp_tl
+\tl_new:N \l__scontents_every_line_env_tl
+\iow_new:N \l__scontents_file_iow
\tl_new:N \l__scontents_foreach_name_seq_tl
\tl_new:N \l__scontents_foreach_before_tl
\tl_new:N \l__scontents_foreach_after_tl
\int_new:N \l__scontents_foreach_stop_int
\int_new:N \l__scontents_seq_item_int
\int_new:N \l__scontents_env_nesting_int
-\int_new:N \l__scontents_tmpa_int
\bool_new:N \l__scontents_writing_bool
\bool_set_false:N \l__scontents_writing_bool
\bool_new:N \l__scontents_storing_bool
\bool_set_true:N \l__scontents_storing_bool
+\bool_new:N \l__scontents_writable_bool
\bool_new:N \l__scontents_foreach_before_bool
\bool_set_false:N \l__scontents_foreach_before_bool
\bool_new:N \l__scontents_foreach_after_bool
@@ -124,13 +127,13 @@
\bool_set_false:N \l__scontents_foreach_stop_bool
\bool_new:N \l__scontents_foreach_wrapper_bool
\bool_set_false:N \l__scontents_foreach_wrapper_bool
-\bool_new:N \l__scontents_writable_bool
\seq_new:N \l__scontents_foreach_print_seq
\str_const:Nx \c__scontents_hidden_space_str
{ \c_percent_str \c_circumflex_str \c_circumflex_str A scheol \c_percent_str }
\quark_new:N \q__scontents_stop
\quark_new:N \q__scontents_mark
-\iow_new:N \l__scontents_file_iow
+\int_new:N \l__scontents_save_sf_int
+\skip_new:N \l__scontents_save_skip
\cs_new_protected:Npn \__scontents_rescan_tokens:n #1 { \tex_scantokens:D {#1} }
\cs_generate_variant:Nn \__scontents_rescan_tokens:n { V, x }
\cs_new:Npx \__scontents_tab: { \c_space_tl }
@@ -172,7 +175,7 @@
\bool_set_true:N \l__scontents_writing_bool
\tl_set:Nn \l__scontents_fname_out_tl {#1}
},
- write-env .value_required:n = true,
+ write-cmd .value_required:n = true,
write-out .value_required:n = true,
print-cmd .meta:nn = { scontents } { print-cmd = #1 },
print-cmd .default:n = true,
@@ -223,7 +226,7 @@
unknown .code:n = { \__scontents_parse_type_meaning_key:n {#1} }
}
\cs_new_protected:Npn \__scontents_parse_environment_keys:n #1
- { \exp_args:NV \__scontents_parse_environment_keys:nn \l_keys_key_tl {#1} }
+ { \exp_args:NV \__scontents_parse_environment_keys:nn \l_keys_key_str {#1} }
\cs_new_protected:Npn \__scontents_parse_environment_keys:nn #1#2
{
\tl_if_blank:nTF {#2}
@@ -231,7 +234,7 @@
{ \msg_error:nnnn { scontents } { env-key-value-unknown } {#1} {#2} }
}
\cs_new_protected:Npn \__scontents_parse_command_keys:n #1
- { \exp_args:NV \__scontents_parse_command_keys:nn \l_keys_key_tl {#1} }
+ { \exp_args:NV \__scontents_parse_command_keys:nn \l_keys_key_str {#1} }
\cs_new_protected:Npn \__scontents_parse_command_keys:nn #1#2
{
\tl_if_blank:nTF {#2}
@@ -245,9 +248,9 @@
{ \msg_error:nnnn { scontents } { for-key-value-unknown } {#1} {#2} }
}
\cs_new_protected:Npn \__scontents_parse_foreach_keys:n #1
- { \exp_args:NV \__scontents_parse_foreach_keys:nn \l_keys_key_tl {#1} }
+ { \exp_args:NV \__scontents_parse_foreach_keys:nn \l_keys_key_str {#1} }
\cs_new_protected:Npn \__scontents_parse_type_meaning_key:n #1
- { \exp_args:NV \__scontents_parse_type_meaning_key:nn \l_keys_key_tl {#1} }
+ { \exp_args:NV \__scontents_parse_type_meaning_key:nn \l_keys_key_str {#1} }
\cs_new_protected:Npn \__scontents_parse_type_meaning_key:nn #1#2
{
\tl_if_empty:fTF { \int_to_roman:n { -0 #1 } }
@@ -303,8 +306,7 @@
\tl_log:N #1
\__scontents_append_contents:Vx #2 { \exp_not:V #1 }
}
-\tl_new:N \l__scontents_env_name_tl
-\cs_new_protected:Npn \__scontents_scontents_setenv:nn #1 #2
+\cs_new_protected:Npn \__scontents_env_setting:nn #1 #2
{
\cs_new_protected:cpn { __scontents_#1_env_begin: }
{
@@ -329,7 +331,7 @@
{
\__scontents_stop_environment:
\__scontents_finish_storing:NNN \l__scontents_macro_tmp_tl
- \l__scontents_name_seq_env_tl \l__scontents_print_env_bool
+ \l__scontents_name_seq_env_tl \l__scontents_print_env_bool
}
\cs_new_protected:Npn \__scontents_grab_optional:n #1
{
@@ -376,8 +378,7 @@
{ \l__scontents_storing_bool }
{ \tl_if_empty_p:N \l__scontents_macro_tmp_tl }
{
- \msg_warning:nnx { scontents } { empty-environment }
- { \l__scontents_env_name_tl }
+ \msg_warning:nnx { scontents } { empty-environment } { \l__scontents_env_name_tl }
}
}
\cs_new_protected:Npn \__scontents_file_tl_write_start:n #1
@@ -389,7 +390,7 @@
\iow_open:Nn \l__scontents_file_iow {#1}
}
{ \bool_set_false:N \l__scontents_writable_bool }
- \tl_clear:N \l__scontents_file_tl
+ \tl_clear:N \l__scontents_every_line_env_tl
\seq_map_function:NN \l_char_special_seq \char_set_catcode_other:N
\int_step_function:nnnN { 128 } { 1 } { 255 } \char_set_catcode_letter:n
\cs_set_protected:Npx \__scontents_ret:w ##1 ^^M
@@ -471,7 +472,7 @@
\bool_if:NT \l__scontents_storing_bool
{
\tl_set:Nn \exp_not:N #1
- { \exp_args:NV \__scontents_remove_leading_nl:n \l__scontents_file_tl }
+ { \exp_args:NV \__scontents_remove_leading_nl:n \l__scontents_every_line_env_tl }
}
}
}
@@ -497,7 +498,7 @@
\bool_if:NT \l__scontents_writable_bool
{ \iow_now:Nn \l__scontents_file_iow {#1} }
\bool_if:NT \l__scontents_storing_bool
- { \tl_put_right:Nn \l__scontents_file_tl { ^^J #1 } }
+ { \tl_put_right:Nn \l__scontents_every_line_env_tl { ^^J #1 } }
}
\group_end:
\cs_generate_variant:Nn \__scontents_verb_processor_output:n { x }
@@ -589,14 +590,12 @@
\cs_new:Npn \dospecials
{ \seq_map_function:NN \l_char_special_seq \do }
}
-\int_new:N \l__scontents_save_sf_int
-\dim_new:N \l__scontents_save_skip_dim
\cs_new_protected:Npn \__scontents_bsphack:
{
\scan_stop:
\mode_if_horizontal:T
{
- \dim_set_eq:NN \l__scontents_save_skip_dim \tex_lastskip:D
+ \skip_set_eq:NN \l__scontents_save_skip \tex_lastskip:D
\int_set_eq:NN \l__scontents_save_sf_int \tex_spacefactor:D
}
}
@@ -606,9 +605,9 @@
\mode_if_horizontal:T
{
\int_set_eq:NN \tex_spacefactor:D \l__scontents_save_sf_int
- \dim_compare:nNnT { \l__scontents_save_skip_dim } > { \c_zero_dim }
+ \dim_compare:nNnT { \l__scontents_save_skip } > { \c_zero_skip }
{
- \dim_compare:nNnT { \tex_lastskip:D } = { \c_zero_dim }
+ \skip_if_eq:nnT { \tex_lastskip:D } { \c_zero_skip }
{
\nobreak
\skip_horizontal:n { \c_zero_skip }
@@ -642,8 +641,10 @@
\cs_new_protected:Npn \__scontents_Scontents_finish:
{
\__scontents_file_write_cmd:VV \l__scontents_fname_out_tl \l__scontents_temp_tl
- \__scontents_finish_storing:NNN \l__scontents_temp_tl
- \l__scontents_name_seq_cmd_tl \l__scontents_print_cmd_bool
+ \__scontents_finish_storing:NNN
+ \l__scontents_temp_tl
+ \l__scontents_name_seq_cmd_tl
+ \l__scontents_print_cmd_bool
\use:x
{
\group_end:
@@ -659,6 +660,7 @@
\iow_close:N \l__scontents_file_iow
}
}
+\cs_generate_variant:Nn \__scontents_file_write_cmd:nn { VV }
\prg_new_protected_conditional:Npnn \__scontents_file_if_writable:n #1 { T, F, TF }
{
\bool_if:NTF \l__scontents_writing_bool
@@ -682,7 +684,6 @@
}
{ \prg_return_false: }
}
-\cs_generate_variant:Nn \__scontents_file_write_cmd:nn { VV }
\cs_new_protected:Npn \__scontents_getstored_internal:nn #1 #2
{
\group_begin:
diff --git a/Master/texmf-dist/tex/generic/scontents/scontents.tex b/Master/texmf-dist/tex/generic/scontents/scontents.tex
index 805c0430047..333f195ab95 100644
--- a/Master/texmf-dist/tex/generic/scontents/scontents.tex
+++ b/Master/texmf-dist/tex/generic/scontents/scontents.tex
@@ -6,7 +6,7 @@
%%
%% scontents.dtx (with options: `loader,plain')
%%
-%% Copyright (C) 2019-2020 by Pablo González L <pablgonz@educarchile.cl>
+%% Copyright (C) 2019-2022 by Pablo González L <pablgonz@educarchile.cl>
%%
%% This work may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3c of this license or (at
@@ -27,8 +27,8 @@
%% t-scontents.mkiv and
%% scontents-code.tex.
%%
-\def\ScontentsFileDate{2020-01-21}%
-\def\ScontentsFileVersion{1.9}%
+\def\ScontentsFileDate{2022-04-04}%
+\def\ScontentsFileVersion{2.0}%
\def\ScontentsFileDescription{Stores LaTeX contents in memory or files}%
\input expl3-generic.tex
\ExplSyntaxOn
@@ -44,12 +44,12 @@
\file_input_stop:
}
\tl_new:N \g__scontents_end_verbatimsc_tl
-\tl_gset_rescan:Nnn
- \g__scontents_end_verbatimsc_tl
+\tl_gset_rescan:Nnn \g__scontents_end_verbatimsc_tl
{
\char_set_catcode_other:N \\
}
{ \endverbatimsc }
+\tl_new:N \l__scontents_env_name_tl
\tl_const:Nx \c__scontents_end_env_tl
{
\c_backslash_str
@@ -59,89 +59,17 @@
\file_input:n { scontents-code.tex }
\cs_new:Npn \__scontents_format_case:nnn #1 #2 #3
{#2} % Plain/Generic
-\keys_define:nn { scontents }
- { verb-font .initial:n = \tt }
-\seq_new:N \l__scontents_compat_seq
-\cs_new_protected:Npn \__scontents_compat_redefine:Npn #1
- {
- \seq_put_right:Nn \l__scontents_compat_seq {#1}
- \cs_set_eq:cN { __scontents_saved_\cs_to_str:N #1: } #1
- \cs_new_protected:Npn #1
- }
-\cs_new_protected:Npn \__scontents_compat_restore:
- { \seq_map_function:NN \l__scontents_compat_seq \__scontents_compat_restore:N }
-\cs_new_protected:Npn \__scontents_compat_restore:N #1
- {
- \cs_set_eq:Nc #1 { __scontents_saved_\cs_to_str:N #1: }
- \cs_undefine:c { __scontents_saved_\cs_to_str:N #1: }
- }
-\cs_generate_variant:Nn \__scontents_compat_redefine:Npn { c }
-\cs_new_protected:Npn \__scontents_optarg:nn #1 #2
- { \peek_charcode_ignore_spaces:NTF [ {#1} {#1[#2]} }
-\cs_new_protected:Npn \__scontents_stararg:nn #1 #2
- { \peek_charcode_remove_ignore_spaces:NTF * {#1} {#2} }
-\__scontents_compat_redefine:Npn \RequirePackage
- { \__scontents_optarg:nn { \__scontents_require_auxi:wn } { } }
-\cs_new_protected:Npn \__scontents_require_auxi:wn [#1] #2
- { \__scontents_optarg:nn { \__scontents_require_auxii:wnw [{#1}]{#2} } { } }
-\cs_new:Npn \__scontents_zap_space:ww #1~#2
- {
- #1 \if_meaning:w #2 \q_mark
- \exp_after:wN \use_none:n
- \else:
- \exp_after:wN \__scontents_zap_space:ww
- \fi: #2
- }
-\cs_new_protected:Npn \__scontents_require_auxii:wnw [#1] #2 [#3]
- {
- \tl_set:Nx \l__scontents_temp_tl { \__scontents_zap_space:ww #2 ~ \q_mark }
- \clist_map_function:NN \l__scontents_temp_tl \__scontents_require_auxiii:n
- }
-\cs_new_protected:Npn \__scontents_require_auxiii:n #1
- {
- \str_if_eq:eeF {expl3} {#1}
- { \msg_error:nnn { scontents } { invalid-package } {#1} }
- }
-\msg_new:nnn { scontents } { invalid-package }
- { Package~'#1'~invalid~in~scontents.~This~is~an~error~in~scontents. }
-\__scontents_compat_redefine:cpn { @ifpackagelater } #1
- { \exp_args:Nc \__scontents_package_later_aux:Nn { ver@#1.sty } }
-\cs_new_protected:Npn \__scontents_package_later_aux:Nn #1 #2
- {
- \int_compare:nNnTF
- { \exp_after:wN \__scontents_parse_version:w #1 //00 \q_mark } <
- { \exp_after:wN \__scontents_parse_version:w #2 //00 \q_mark }
- }
-\cs_new:Npn \__scontents_parse_version:w #1 { \__scontents_parse_version_auxi:w 0#1 }
-\cs_new:Npn \__scontents_parse_version_auxi:w #1/#2/#3#4#5 \q_mark
- { \__scontents_parse_version_auxii:w #1-#2-#3#4 \q_mark }
-\cs_new:Npn \__scontents_parse_version_auxii:w #1-#2-#3#4#5 \q_mark
- { \tl_if_blank:nF {#2} {#1} #2 #3 #4 }
-\__scontents_compat_redefine:Npn \ProvidesExplPackage #1 #2 #3 #4
- { \__scontents_provides_aux:nn {#1} { #2 \tl_if_empty:nF {#3} {#3~} #4 } }
-\cs_new_protected:Npn \__scontents_provides_aux:nn #1 #2
- {
- \tl_gset:cx { ver@#1.sty } {#2}
- \iow_log:n { Package~#1:~#2 }
- \ExplSyntaxOn
- }
-\__scontents_compat_redefine:Npn \DeclareOption
- { \__scontents_stararg:nn { \use_none:n } { \use_none:nn } }
-\__scontents_compat_redefine:Npn \ProcessOptions
- { \__scontents_stararg:nn { } { } }
\int_set:Nn \l__scontents_tmpa_int { \char_value_catcode:n { `\@ } }
\char_set_catcode_letter:N \@
-\exp_after:wN
-\ExplSyntaxOff
-\file_input:n { xparse.sty }
-\ExplSyntaxOn
+\file_input:n { xparse-generic.tex }
\char_set_catcode:nn { `\@ } { \l__scontents_tmpa_int }
-\__scontents_compat_restore:
-\NewDocumentCommand { \newenvsc } { m O{} }
+\keys_define:nn { scontents }
+ { verb-font .initial:n = \tt }
+\NewDocumentCommand \newenvsc { m O{} }
{
\cs_if_exist:cTF { #1 }
{ \msg_error:nnn { scontents } { env-already-defined } {#1} }
- { \__scontents_scontents_setenv:nn {#1} {#2} }
+ { \__scontents_env_setting:nn {#1} {#2} }
}
\cs_new_protected:Npn \__scontents_env_define:nnn #1 #2 #3
{
@@ -160,7 +88,6 @@
{ \__scontents_grab_optional:n {#1} }
\cs_new_protected:Npn \__scontents_analyse_nesting_format:n
{ \__scontents_analyse_nesting_generic:nn { } }
-\bool_new:N \l__scontents_temp_bool
\cs_new_protected:Npn \verbatimsc
{
\group_begin:
@@ -172,9 +99,9 @@
\cs_new_protected:Npn \__scontents_verbatimsc_aux:
{
\skip_vertical:N \parskip
- \int_set:Nn \parindent { 0pt }
+ \dim_zero:N \parindent
\skip_set:Nn \parfillskip { 0pt plus 1fil }
- \int_set:Nn \parskip { 0pt plus0pt minus0pt }
+ \skip_set:Nn \parskip { 0pt plus0pt minus0pt }
\tex_par:D
\bool_set_false:N \l__scontents_temp_bool
\cs_set:Npn \par
@@ -211,15 +138,15 @@
\cs_new:Npn \dospecials
{ \seq_map_function:NN \l_char_special_seq \do }
}
-\NewDocumentCommand { \Scontents }{ !s !O{} }
+\NewDocumentCommand \Scontents { !s !O{} }
{ \__scontents_Scontents_internal:nn {#1} {#2} }
-\NewDocumentCommand { \__scontents_verb_arg:w } { +v }
+\NewDocumentCommand \__scontents_verb_arg:w { +v }
{ \__scontents_verb_arg_internal:n {#1} }
-\NewDocumentCommand { \getstored } { O{-1} m }
+\NewDocumentCommand \getstored { O{-1} m }
{ \__scontents_getstored_internal:nn {#1} {#2} }
-\NewDocumentCommand { \foreachsc } { o m }
+\NewDocumentCommand \foreachsc { o m }
{ \__scontents_foreachsc_internal:nn {#1} {#2} }
-\NewDocumentCommand { \typestored } { o m }
+\NewDocumentCommand \typestored { o m }
{ \__scontents_typestored_internal:nn {#1} {#2} }
\use:x
{
@@ -238,13 +165,13 @@
}
}
\group_end:
-\NewDocumentCommand { \setupsc } { +m }
+\NewDocumentCommand \setupsc { +m }
{ \keys_set:nn { scontents } {#1} }
-\NewDocumentCommand { \meaningsc } { o m }
+\NewDocumentCommand \meaningsc { o m }
{ \__scontents_meaningsc_internal:nn {#1} {#2} }
-\NewExpandableDocumentCommand { \countsc } { m }
+\NewExpandableDocumentCommand \countsc { m }
{ \seq_count:c { g__scontents_name_#1_seq } }
-\NewDocumentCommand { \cleanseqsc } { m }
+\NewDocumentCommand \cleanseqsc { m }
{ \seq_clear_new:c { g__scontents_name_#1_seq } }
\ExplSyntaxOff
\endinput
diff --git a/Master/texmf-dist/tex/latex/scontents/scontents.sty b/Master/texmf-dist/tex/latex/scontents/scontents.sty
index 13ff98bfabb..af503554a91 100644
--- a/Master/texmf-dist/tex/latex/scontents/scontents.sty
+++ b/Master/texmf-dist/tex/latex/scontents/scontents.sty
@@ -6,7 +6,7 @@
%%
%% scontents.dtx (with options: `loader,latex')
%%
-%% Copyright (C) 2019-2020 by Pablo González L <pablgonz@educarchile.cl>
+%% Copyright (C) 2019-2022 by Pablo González L <pablgonz@educarchile.cl>
%%
%% This work may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3c of this license or (at
@@ -27,31 +27,21 @@
%% t-scontents.mkiv and
%% scontents-code.tex.
%%
-\def\ScontentsFileDate{2020-01-21}%
-\def\ScontentsFileVersion{1.9}%
+\def\ScontentsFileDate{2022-04-04}%
+\def\ScontentsFileVersion{2.0}%
\def\ScontentsFileDescription{Stores LaTeX contents in memory or files}%
-\RequirePackage{expl3,xparse,l3keys2e}[2019/05/28]
+\RequirePackage{l3keys2e}[2020/02/08]
\ProvidesExplPackage
{scontents} {\ScontentsFileDate} {\ScontentsFileVersion} {\ScontentsFileDescription}
-\@ifpackageloaded { verbatim }
- {
- \msg_set:nnn { scontents } { unsupported-verbatim }
- {
- The~implementation~of~the~'verbatimsc'~environment~used~by~
- \iow_char:N \\typestored~is~not~compatible~with~package~'verbatim'.~
- Review~the~documentation~and~redefine~the~'verbatimsc'~environment.
- }
- \msg_warning:nn { scontents } { unsupported-verbatim }
- } { }
\tl_new:N \g__scontents_end_verbatimsc_tl
-\tl_gset_rescan:Nnn
- \g__scontents_end_verbatimsc_tl
+\tl_gset_rescan:Nnn \g__scontents_end_verbatimsc_tl
{
\char_set_catcode_other:N \\
\char_set_catcode_other:N \{
\char_set_catcode_other:N \}
}
{ \end{verbatimsc} }
+\tl_new:N \l__scontents_env_name_tl
\tl_const:Nx \c__scontents_end_env_tl
{
\c_backslash_str
@@ -66,11 +56,11 @@
\keys_define:nn { scontents }
{ verb-font .initial:n = \ttfamily }
\ProcessKeysOptions { scontents }
-\NewDocumentCommand { \newenvsc } { m O{} }
+\NewDocumentCommand \newenvsc { m O{} }
{
\cs_if_exist:cTF { #1 }
{ \msg_error:nnn { scontents } { env-already-defined } {#1} }
- { \__scontents_scontents_setenv:nn {#1} {#2} }
+ { \__scontents_env_setting:nn {#1} {#2} }
}
\cs_new_protected:Npn \__scontents_env_define:nnn #1 #2 #3
{
@@ -89,15 +79,15 @@
\__scontents_analyse_nesting_latex:n
\cs_gset_eq:NN \__scontents_bsphack: \@bsphack
\cs_gset_eq:NN \__scontents_esphack: \@esphack
-\NewDocumentCommand { \Scontents }{ !s !O{} }
+\NewDocumentCommand \Scontents { !s !O{} }
{ \__scontents_Scontents_internal:nn {#1} {#2} }
-\NewDocumentCommand { \__scontents_verb_arg:w } { +v }
+\NewDocumentCommand \__scontents_verb_arg:w { +v }
{ \__scontents_verb_arg_internal:n {#1} }
-\NewDocumentCommand { \getstored } { O{-1} m }
+\NewDocumentCommand \getstored { O{-1} m }
{ \__scontents_getstored_internal:nn {#1} {#2} }
-\NewDocumentCommand { \foreachsc } { o m }
+\NewDocumentCommand \foreachsc { o m }
{ \__scontents_foreachsc_internal:nn {#1} {#2} }
-\NewDocumentCommand { \typestored } { o m }
+\NewDocumentCommand \typestored { o m }
{ \__scontents_typestored_internal:nn {#1} {#2} }
\use:x
{
@@ -110,18 +100,18 @@
\cs_set_eq:cN { @xverbatim } \__scontents_xverb:
\verbatim
}
- { }
+ { \endverbatim }
\group_begin:
\cs_new_protected:Npn \__scontents_plain_disable_outer_par:
{ }
\group_end:
-\NewDocumentCommand { \setupsc } { +m }
+\NewDocumentCommand \setupsc { +m }
{ \keys_set:nn { scontents } {#1} }
-\NewDocumentCommand { \meaningsc } { o m }
+\NewDocumentCommand \meaningsc { o m }
{ \__scontents_meaningsc_internal:nn {#1} {#2} }
-\NewExpandableDocumentCommand { \countsc } { m }
+\NewExpandableDocumentCommand \countsc { m }
{ \seq_count:c { g__scontents_name_#1_seq } }
-\NewDocumentCommand { \cleanseqsc } { m }
+\NewDocumentCommand \cleanseqsc { m }
{ \seq_clear_new:c { g__scontents_name_#1_seq } }
\endinput
%%