| 1 |
% ====================================================================== |
| 2 |
% scrdocstrip.tex |
| 3 |
% Copyright (c) Markus Kohm, 2013-2025 |
| 4 |
% |
| 5 |
% This file is part of the LaTeX2e KOMA-Script bundle. |
| 6 |
% |
| 7 |
% This work may be distributed and/or modified under the conditions of |
| 8 |
% the LaTeX Project Public License, version 1.3c of the license. |
| 9 |
% The latest version of this license is in |
| 10 |
% http://www.latex-project.org/lppl.txt |
| 11 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 12 |
% version 2005/12/01 or later and of this work. |
| 13 |
% |
| 14 |
% This work has the LPPL maintenance status "author-maintained". |
| 15 |
% |
| 16 |
% The Current Maintainer and author of this work is Markus Kohm. |
| 17 |
% |
| 18 |
% This work consists of all files listed in MANIFEST.md. |
| 19 |
% ====================================================================== |
| 20 |
% $Id: scrdocstrip.tex 4215 2025-08-29 07:10:23Z kohm $ |
| 21 |
|
| 22 |
\expandafter\ifx\csname scrdocstripversion\endcsname\relax |
| 23 |
\let\KOMAbatchfile\batchfile |
| 24 |
\let\batchfile\undefined |
| 25 |
\fi |
| 26 |
|
| 27 |
\input docstrip.tex |
| 28 |
|
| 29 |
\ifx\generate\undefined |
| 30 |
\errhelp{| This installation requires docstrip version 2.3c or * later,^^J% |
| 31 |
| but an old version of docstrip has been input.^^J% |
| 32 |
| This error is fatal, because You have to update docstrip and maybe LaTeX |
| 33 |
fist!} |
| 34 |
\errmessage{| Fatal error: Old docstrip in input path} |
| 35 |
\batchmode |
| 36 |
\csname @@end\endcsname |
| 37 |
\fi |
| 38 |
|
| 39 |
\expandafter\ifx\csname scrdocstripversion\endcsname\relax |
| 40 |
\else \expandafter\endinput |
| 41 |
\fi |
| 42 |
\Msg{| Using KOMA-Script's docstrip extensions.}%| |
| 43 |
% Support for variables: |
| 44 |
\def\KOMAdefVariable#1#2{% |
| 45 |
\expandafter\def\csname KOMAvar@#1\endcsname{#2}% |
| 46 |
} |
| 47 |
\def\KOMAifVariable#1{% |
| 48 |
\expandafter\ifx\csname KOMAvar@#1\endcsname\relax |
| 49 |
\expandafter\@secondoftwo |
| 50 |
\else |
| 51 |
\expandafter\@firstoftwo |
| 52 |
\fi |
| 53 |
} |
| 54 |
\def\KOMAuseVariable#1{% |
| 55 |
\KOMAifVariable{#1}{% |
| 56 |
\csname KOMAvar@#1\endcsname |
| 57 |
}{% |
| 58 |
variable #1\undefined |
| 59 |
}% |
| 60 |
} |
| 61 |
\KOMAdefVariable{AUTHOR}{Markus Kohm} |
| 62 |
\KOMAdefVariable{COPYRIGHT}{% |
| 63 |
Copyright (c) |
| 64 |
\KOMAifVariable{COPYRIGHTFROM}{\KOMAuseVariable{COPYRIGHTFROM}-}{}% |
| 65 |
\KOMAifVariable{COPYRIGHTTILL}{\KOMAuseVariable{COPYRIGHTTILL}}{\the\year} |
| 66 |
\KOMAuseVariable{AUTHOR}% |
| 67 |
\KOMAifVariable{EMAIL}{ \KOMAuseVariable{EMAIL}}{}% |
| 68 |
} |
| 69 |
\KOMAdefVariable{COPYRIGHTCOMMENT}{% |
| 70 |
\MetaPrefix\space\KOMAuseVariable{COPYRIGHT}% |
| 71 |
} |
| 72 |
% Extend line scanner by: |
| 73 |
% - %!VARIABLE : to write variable into files |
| 74 |
% - %?VARIABLE=VALUE : to setup a new variable |
| 75 |
\begingroup |
| 76 |
\catcode`\%=12 \catcode`\*=14 |
| 77 |
\gdef\processLineX%#1{* |
| 78 |
\ifcase\ifx%#10\else |
| 79 |
\ifx<#11\else |
| 80 |
\ifx!#12\else 3\fi\fi\fi\relax |
| 81 |
\expandafter\putMetaComment\or |
| 82 |
\expandafter\checkOption\or |
| 83 |
\expandafter\KOMAexpandVariable\or |
| 84 |
\expandafter\removeComment\fi |
| 85 |
#1} |
| 86 |
\gdef\KprocessLineX%#1{* |
| 87 |
\ifcase\ifx%#10\else |
| 88 |
\ifx<#11\else |
| 89 |
\ifx!#12\else |
| 90 |
\ifx?#13\else 4\fi\fi\fi\fi\relax |
| 91 |
\expandafter\putMetaComment\or |
| 92 |
\expandafter\checkOption\or |
| 93 |
\expandafter\KOMAexpandVariable\or |
| 94 |
\expandafter\KOMAsetVariable\or |
| 95 |
\expandafter\removeComment\fi |
| 96 |
#1} |
| 97 |
\endgroup |
| 98 |
\def\KOMAexpandVariable!#1\endLine{% |
| 99 |
\advance\codeLinesPassed\@ne |
| 100 |
\maybeMsg{x}% |
| 101 |
\edef\inLine{\KOMAuseVariable{#1}}% |
| 102 |
\let\do\putline@do |
| 103 |
\activefiles |
| 104 |
} |
| 105 |
\def\KOMAsetVariable?#1=#2\endLine{% |
| 106 |
\expandafter\gdef\csname KOMAvar@#1\endcsname{#2}% |
| 107 |
} |
| 108 |
% Extend heading |
| 109 |
\def\ds@heading{% |
| 110 |
\expandafter\ifx\csname ifbeta\expandafter\endcsname |
| 111 |
\csname iftrue\endcsname |
| 112 |
\use@Warning{\outFileName}{% |
| 113 |
YOU SHOULD NOTE, THAT THIS IS NOT AN OFFICIAL RELEASE!^^J% |
| 114 |
THIS VERSION IS INTENDED TO BE USED FOR TESTING ONLY!^^J% |
| 115 |
USAGE FOR PURPOSES OTHER THAN INTENDED IS DANGEROUS!^^J% |
| 116 |
DON'T EXPECT ANY SUPPORT FOR THIS VERSION!% |
| 117 |
}% |
| 118 |
\fi |
| 119 |
\MetaPrefix ^^J% |
| 120 |
\MetaPrefix\space This is file `\outFileName',^^J% |
| 121 |
\MetaPrefix\space generated with the docstrip utility, extended by |
| 122 |
scrdocstrip.^^J% |
| 123 |
} |
| 124 |
\def\commentWarning#1#2{% |
| 125 |
\MetaPrefix\space |
| 126 |
-------------------------------------------------------------------------^^J% |
| 127 |
\@commentWarning#2^^J\@nil |
| 128 |
\MetaPrefix\space |
| 129 |
-------------------------------------------------------------------------^^J% |
| 130 |
} |
| 131 |
\def\@commentWarning#1^^J#2\@nil{% |
| 132 |
\MetaPrefix\space #1^^J% |
| 133 |
\ifx\relax#2\relax\else\@commentWarning#2\@nil\fi |
| 134 |
} |
| 135 |
\def\KNL{^\empty^J\perCent^^J} |
| 136 |
\def\XKNL{^\empty^J\perCent|^^J} |
| 137 |
\def\genericWarning#1#2{% |
| 138 |
\string\expandafter\string\ifx\string\csname\space scrWMSG\string\endcsname\string\relax^^J% |
| 139 |
\space\space\string\def\string\scrWMSG{\string\immediate\string\write17}^^J% |
| 140 |
\string\fi^^J% |
| 141 |
\string\scrWMSG{\KNL |
| 142 |
+----------------------------------------------------------------------\KNL |
| 143 |
| WARNING (`#1'):\XKNL |
| 144 |
+----------------------------------------------------------------------\KNL |
| 145 |
\@genericWarning#2^^J\@nil |
| 146 |
+----------------------------------------------------------------------\KNL |
| 147 |
}^^J% |
| 148 |
} |
| 149 |
\def\@genericWarning#1^^J#2\@nil{% |
| 150 |
| #1\XKNL |
| 151 |
\ifx\relax#2\relax\else\@genericWarning#2\@nil\fi |
| 152 |
}%| |
| 153 |
\def\useWarning#1{\let\use@Warning#1} |
| 154 |
\useWarning\genericWarning |
| 155 |
|
| 156 |
% Now, we need some code from docstrip to start old docstrip-processing |
| 157 |
\ifx\undefined\KOMAbatchfile\else |
| 158 |
\Defaultfalse |
| 159 |
\let\batchfile\KOMAbatchfile |
| 160 |
\def\process@first@batchfile{% |
| 161 |
\processbatchFile |
| 162 |
\ifnum\NumberOfFiles=\z@ |
| 163 |
\interactive |
| 164 |
\fi |
| 165 |
\endbatchfile |
| 166 |
} |
| 167 |
\fi |
| 168 |
|
| 169 |
\chardef\scrdocstripversion 1\relax |
| 170 |
|
| 171 |
\def\fromoptional#1{% |
| 172 |
\immediate\openin\inputcheck\uptospace#1 \qStop\relax |
| 173 |
\ifeof\inputcheck |
| 174 |
\Msg{Ignorring not existing optional file `#1'.}% |
| 175 |
\expandafter\@gobbletwo |
| 176 |
\else |
| 177 |
\immediate\closein\inputcheck |
| 178 |
\expandafter\from |
| 179 |
\fi |
| 180 |
{#1}% |
| 181 |
} |
| 182 |
|
| 183 |
\process@first@batchfile |
| 184 |
\endinput |
| 185 |
% |
| 186 |
% end of file `scrdocstrip.tex' |