diff options
author | Karl Berry <karl@freefriends.org> | 2019-05-02 22:39:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-05-02 22:39:39 +0000 |
commit | 76e559e4657cc54e211e35d7ae6fdb91f89ee034 (patch) | |
tree | 938b4c1c850c06a1fc686dacbb79646c6d9d60ff /Master/texmf-dist/tex | |
parent | c7ea87b7b16e55ce9460b7789a8dcbc8d84ec51f (diff) |
filecontentsdef (24apr19)
git-svn-id: svn://tug.org/texlive/trunk@50942 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/filecontentsdef/filecontentsdef.sty | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/Master/texmf-dist/tex/latex/filecontentsdef/filecontentsdef.sty b/Master/texmf-dist/tex/latex/filecontentsdef/filecontentsdef.sty index f921673cfb1..e956a6ff767 100644 --- a/Master/texmf-dist/tex/latex/filecontentsdef/filecontentsdef.sty +++ b/Master/texmf-dist/tex/latex/filecontentsdef/filecontentsdef.sty @@ -23,12 +23,12 @@ %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{filecontentsdef} - [2016/09/19 v1.2 filecontents + macro + verbatim (JFB)] + [2019/04/20 v1.4 filecontents + macro + verbatim (JFB)] %% %% Package: filecontentsdef -%% Version: 1.2 (2016/09/19) +%% Version: 1.4 (2019/04/20) %% License: LPPL 1.3c -%% Copyright (C) 2016 Jean-Francois Burnol <jfbu at free dot fr> +%% Copyright (C) 2016-2019 Jean-Francois Burnol <jfbu at free dot fr> %% \begingroup \catcode`\^^M\active% @@ -36,6 +36,7 @@ \catcode`\^^I\active% \gdef\filec@ntentsdef#1#2{% \let#2\@empty% + \if@filesw% \openin\@inputcheck#1 % \ifeof\@inputcheck% \@latex@warning@no@line% @@ -58,6 +59,7 @@ \number\year/\two@digits\month/\two@digits\day.^^J% \@percentchar\@percentchar}% \fi% + \fi% \let\do\@makeother\dospecials% \count@=128\relax% \loop% @@ -75,7 +77,7 @@ \edef\reserved@b{\def\noexpand\reserved@b####1\E####2\E####3\relax}% \reserved@b{% \ifx\relax##3\relax% - \immediate\write\reserved@c{##1}% + \if@filesw\immediate\write\reserved@c{##1}\fi% \toks@\expandafter{#2}% {\def^^L{\noexpand^^M\noexpand^^M}\lowercase{\let^^I~}% \xdef#2{\the\toks@##1\noexpand^^M}}% @@ -83,9 +85,11 @@ \edef^^M{\noexpand\end{\@currenvir}}% \ifx\relax##1\relax% \else% + \if@filesw% \@latex@warning{Writing text `##1' before % \string\end{\@currenvir}\MessageBreak as last line of #1}% \immediate\write\reserved@c{##1}% + \fi% \toks@\expandafter{#2}% {\def^^L{\noexpand^^M\noexpand^^M}\lowercase{\let^^I~}% \xdef#2{\the\toks@##1\noexpand^^M}}% @@ -99,37 +103,50 @@ ^^M}% \catcode`\^^L\active% \let\L\@undefined% - \def^^L{\@ifundefined L^^J^^J^^J}% + \def^^L{\expandafter\ifx\csname L\endcsname\relax\fi^^J^^J}% \catcode`\^^I\active% \let\I\@undefined% - \def^^I{\@ifundefined I\space\space}% + \def^^I{\expandafter\ifx\csname I\endcsname\relax\fi\space}% \catcode`\^^M\active% \edef^^M##1^^M{\noexpand\reserved@b##1\E\E\relax}% \catcode32\active\lccode`~32 \lowercase{\def~{\noexpand~}}% }% \endgroup +\long\def\filecontentsdef@aux#1\filecontentsdef@aux{\@firstofone}% +\def\filecontentsdef@get#1#2% +{% + \def\@tempa{#1}\def\@tempb{{#2}}% + \expandafter\filecontentsdef@aux\@gobbletwo#2\filecontentsdef@aux + \@thirdofthree + \filecontentsdef@aux + {\ifcat\relax\noexpand#2\expandafter\@gobble\else\expandafter\@firstofone\fi}% + {\edef\@tempb{{\expandafter\noexpand\csname#2\endcsname}}}% + \expandafter\@tempa\@tempb +}% \begingroup \catcode`\*=11 -\gdef\filecontentsdef {\@tempswatrue\filec@ntentsdef}% -\gdef\filecontentsdef*{\@tempswafalse\filec@ntentsdef}% +\gdef\filecontentsdef #1{\@tempswatrue\filecontentsdef@get{\filec@ntentsdef{#1}}}% +\gdef\filecontentsdef*#1{\@tempswafalse\filecontentsdef@get{\filec@ntentsdef{#1}}}% \global\let\endfilecontentsdef \endfilecontents \global\let\endfilecontentsdef*\endfilecontents -\gdef\filecontentshere #1{\@tempswatrue - \filec@ntentsdef{#1}\filecontentsheremacro}% -\gdef\filecontentshere*#1{\@tempswafalse - \filec@ntentsdef{#1}\filecontentsheremacro}% -\gdef\endfilecontentshere{\endfilecontentsdef\aftergroup\filecontents@verbatim}% +\gdef\filecontentsdefmacro{\@fileswfalse\filecontentsdef@get{\filec@ntentsdef{}}}% +\global\let\endfilecontentsdefmacro\relax +\gdef\filecontentshere #1{\@tempswatrue\filec@ntentsdef{#1}\filecontentsheremacro}% +\gdef\filecontentshere*#1{\@tempswafalse\filec@ntentsdef{#1}\filecontentsheremacro}% +\gdef\endfilecontentshere{\endfilecontentsdef\aftergroup\filecontents@here}% \global\let\endfilecontentshere*\endfilecontentshere +\gdef\filecontentsprint{\filecontentsdef@get\filecontents@print}% \catcode`\^^M\active% -\gdef\filecontentsprint #1{\let\filecontentsprint@EOL^^M\let^^M\relax% +\gdef\filecontents@print #1{\let\filecontents@print@EOL^^M\let^^M\relax% \begingroup\toks@\expandafter{#1}\edef\x{\endgroup% \noexpand\begin{verbatim}^^M% \the\toks@\@backslashchar end\string{verbatim\string}}\x^^M% - \filecontentsprint@resetEOL}% -\gdef\filecontentsprint@resetEOL{\let^^M\filecontentsprint@EOL}% + \filecontents@print@resetEOL}% +\gdef\filecontents@print@resetEOL{\let^^M\filecontents@print@EOL}% \endgroup -\def\filecontents@verbatim {\filecontentsprint\filecontentsheremacro}% -\def\filecontentsexec #1{\newlinechar13 +\def\filecontents@here{\filecontents@print\filecontentsheremacro}% +\def\filecontentsexec{\filecontentsdef@get\filecontents@exec}% +\def\filecontents@exec #1{\newlinechar13 \scantokens\expandafter{#1}\newlinechar10\relax}% \endinput %% |