summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/lwarp/lwarp-fancyvrb.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/lwarp/lwarp-fancyvrb.sty')
-rw-r--r--Master/texmf-dist/tex/latex/lwarp/lwarp-fancyvrb.sty315
1 files changed, 259 insertions, 56 deletions
diff --git a/Master/texmf-dist/tex/latex/lwarp/lwarp-fancyvrb.sty b/Master/texmf-dist/tex/latex/lwarp/lwarp-fancyvrb.sty
index d496a4461b0..a73bd19cfbc 100644
--- a/Master/texmf-dist/tex/latex/lwarp/lwarp-fancyvrb.sty
+++ b/Master/texmf-dist/tex/latex/lwarp/lwarp-fancyvrb.sty
@@ -17,10 +17,171 @@
%% version 2005/12/01 or later.
\AtBeginDocument{\RequirePackage{xcolor}}% for \convertcolorspec
-\LWR@ProvidesPackagePass{fancyvrb}[2008/02/07]
+\LWR@ProvidesPackagePass{fancyvrb}[2023/11/06]
\fvset{frame=none}%
+
+\define@key{FV}{gobble}{%
+ \@tempcnta=#1\relax
+ \ifnum\@tempcnta<\@ne
+ \let\FV@Gobble\relax
+ \else
+ \ifnum\@tempcnta>9
+ \FV@Error{gobble parameter must be less than 10}\FV@eha
+ \else
+ \renewcommand{\FV@@@@Gobble}[\@tempcnta]{}%
+ \let\FV@Gobble\FV@@Gobble%
+ \boolfalse{LWR@HTMLsanitize@tmpb@enable}% lwarp
+ \fi
+ \fi}
+
+\ifxetexorluatex
+\def\LWR@HTML@FancyVerbSpace{\textvisiblespace}
+\else
+\@ifundefined{verbvisiblespace}%
+ {%
+ \@ifundefined{textvisiblespace}%
+ {\begingroup\catcode`\ =12 \gdef\LWR@HTML@FancyVerbSpace{\tt }\endgroup}
+ {\def\LWR@HTML@FancyVerbSpace{\textvisiblespace}}
+ }%
+ {\def\LWR@HTML@FancyVerbSpace{\verbvisiblespace}}
+\fi
+\LWR@formatted{FancyVerbSpace}
+
+\def\LWR@print@FancyVerbTab{|}
+\def\LWR@HTML@FancyVerbTab{|}%
+\LWR@formatted{FancyVerbTab}
+
+\fvset{tabsize=8,showtabs=false}
+
+\def\FV@CatCodes{%
+ \let\do\@makeother\dospecials % The usual stuff.
+ \FV@ActiveWhiteSpace % See below.
+ \FV@FontScanPrep % See below.
+ \FV@CatCodesHook % A style hook.
+ \FancyVerbCodes % A user-defined hook.
+ \catcode`\>=12% % lwarp
+ \catcode`\<=12% % lwarp
+}
+\def\FV@GetLine{%
+ \@noligs%
+ \catcode`\>=12% lwarp, and the next line as well
+ \catcode`\<=12
+ \expandafter\FV@CheckScan\FancyVerbGetLine%
+}
+
+\begingroup
+\catcode`\^^M=\active%
+\gdef\FancyVerbGetLine#1^^M{%
+ \@nil%
+ \FV@CheckEnd{#1}%
+ \ifx\@tempa\FV@EnvironName% % True if end is found
+ \ifx\@tempb\FV@@@CheckEnd\else\FV@BadEndError\fi%
+ \let\next\FV@EndScanning%
+ \else%
+ \ifbool{LWR@HTMLsanitize@tmpb@enable}% lwarp
+ {\def\FV@Line{\LWR@HTMLsanitize@use@tmpb{#1}}}% lwarp
+ {\def\FV@Line{#1}}% lwarp
+ \def\next{\FV@PreProcessLine\FV@GetLine}%
+ \fi%
+ \next}%
+\endgroup
+\def\FV@List#1{%
+ \begingroup
+ \FV@UseKeyValues
+ \FV@LeaveVMode
+ \if@inlabel\else\setbox\@labels=\box\voidb@x\fi
+ \FV@ListNesting{#1}%
+ \FV@ListParameterHook
+ \FV@ListVSpace
+ \FV@SetLineWidth
+ \FV@InterLinePenalty
+ \let\FV@ProcessLine\FV@ListProcessLine% lwarp
+ \FV@CatCodes
+ \FV@FormattingPrep
+ \FV@ObeyTabsInit
+ \FV@BeginListFrame}
+\def\FV@ListProcessLine#1{%
+ \hbox to \hsize{%
+ \hbox to \VerbatimHTMLWidth {%
+ \ifcsvoid{FV@LeftListNumber}{}{\kern 2.5em}%
+ \FV@LeftListNumber%
+ \FancyVerbFormatLine{#1}%
+ \hss%
+ \FV@RightListNumber%
+ }%
+ \hss% required to avoid underfull hboxes
+}
+}
+
+\begingroup
+\catcode`\^^M=\active%
+\gdef\FVC@SaveVerb#1#2{%
+ \@namedef{FV@SV@#1}{}%
+ \begingroup%
+ \FV@UseKeyValues%
+ \FV@CatCodes%
+ \outer\def^^M{\FV@EOL}%
+ \global\let\@tempg\FancyVerbAfterSave%
+ \catcode`#2=12%
+ \def\@tempa{\def\FancyVerbGetVerb####1####2}%
+ \expandafter\@tempa\string#2{%
+ \endgroup%
+ \@namedef{FV@SV@#1}{%
+ \LWR@HTMLsanitize@use@tmpb{##2}% lwarp
+ }\@tempg%
+ }%
+ \FancyVerbGetVerb\FV@EOL}%
+\endgroup
+
+\def\FV@UseVerb#1{%
+ \ifbool{LWR@verbtags}% lwarp
+ {\LWR@htmltag{span class=\textquotedbl{}fancyvrb\textquotedbl}}% lwarp
+ {}% lwarp
+ \mbox{\FV@UseKeyValues\FV@FormattingPrep#1}%
+ \ifbool{LWR@verbtags}% lwarp
+ {\LWR@htmltag{/span}}% lwarp
+ {}% lwarp
+}
+
+\begingroup
+\catcode`\^^M=\active%
+\gdef\FVC@Verb#1{%
+ \begingroup%
+ \FV@UseKeyValues%
+ \FV@FormattingPrep%
+ \FV@CatCodes%
+ \outer\def^^M{}%
+ \catcode`#1=12%
+ \def\@tempa{\def\FancyVerbGetVerb####1####2}%
+ \expandafter\@tempa\string#1{%
+ \ifbool{LWR@verbtags}% lwarp
+ {% lwarp
+ \LWR@htmltag{span class=\textquotedbl{}fancyvrb\textquotedbl}% lwarp
+ \def\tmpb{##2}% lwarp
+ \LWR@HTMLsanitize@tmpb% lwarp
+ \mbox{\tmpb}% lwarp
+ \LWR@htmltag{/span}% lwarp
+ }% lwarp
+ {\mbox{##2}}%
+ \endgroup%
+ }%
+ \FancyVerbGetVerb\FV@EOL%
+}%
+\endgroup
+\begingroup
+\catcode`\^^M=\active
+\gdef\FV@ReadLine{%
+ \ifeof\FV@InFile\else
+ \immediate\read\FV@InFile to\tmpb%
+ \LWR@HTMLsanitize@tmpb%
+ \expandafter\FV@@ReadLine\tmpb^^M\relax^^M\@nil%
+ \fi}
+\endgroup
+\newcommand*{\LWR@FVstyle}{}
\AfterEndPreamble{
+
\LWR@traceinfo{Patching fancyvrb.}
+
\def\VerbatimFootnotes{%
\let\@footnotetext\V@footnotetext%
\let\footnote\V@footnote%
@@ -35,6 +196,9 @@
\csname p@footnote\endcsname\@thefnmark%
}% @currentlabel
\renewrobustcmd{\textsuperscript}[1]{\LWR@htmlspan{sup}{##1}}%
+ \booltrue{LWR@verbtags}%
+ \booltrue{LWR@HTMLsanitize@tmpb@enable}%
+
\LWR@htmltagc{\LWR@tagregularparagraph}\LWR@orignewline%
\@makefntext{}%
\bgroup%
@@ -43,47 +207,71 @@
\ignorespaces%
}%
\def\V@@@footnotetext{%
- \LWR@origtilde\LWR@orignewline%
+ \LWR@orignobreakspace\LWR@orignewline%
\LWR@htmltagc{/\LWR@tagregularparagraph}\LWR@orignewline%
\strut\egroup%
}
\preto\FVB@Verbatim{\LWR@forcenewpage}
\preto\FVB@LVerbatim{\LWR@forcenewpage}
-\def\FV@BeginListFrame@Single{%
+\def\LWR@HTML@FV@BeginListFrame@Single{%
\FV@SingleFrameLine{\z@}%
}
+\LWR@formatted{FV@BeginListFrame@Single}
-\def\FV@EndListFrame@Single{%
+\def\LWR@HTML@FV@EndListFrame@Single{%
\FV@SingleFrameLine{\@ne}%
}
+\LWR@formatted{FV@EndListFrame@Single}
-\def\FV@BeginListFrame@Lines{%
+\def\LWR@HTML@FV@BeginListFrame@Lines{%
\FV@SingleFrameLine{\z@}%
}
+\LWR@formatted{FV@BeginListFrame@Lines}
-\def\FV@EndListFrame@Lines{%
+\def\LWR@HTML@FV@EndListFrame@Lines{%
\FV@SingleFrameLine{\@ne}%
}
+\LWR@formatted{FV@EndListFrame@Lines}
-\renewcommand*{\FV@SingleFrameSep}{}
-\def\FV@BUseVerbatim#1{%
- \FV@BVerbatimBegin#1\FV@BVerbatimEnd%
-}
+\newcommand*{\LWR@HTML@FV@SingleFrameSep}{}%
+\LWR@formatted{FV@SingleFrameSep}
-\newcommand*{\LWR@FVstyle}{}
\newcommand*{\LWR@fvstartnone}{%
\LWR@traceinfo{fvstartnone}%
-\BlockClass[\LWR@FVstyle]{fancyvrb}
+ \ifdefstring{\LWR@FVstyle}{\LWR@currenttextcolorstyle}%
+ {%
+ \LWR@findcurrenttextcolor%
+ \ifdefstring{\LWR@tempcolor}{000000}%
+ {\BlockClass{fancyvrb}}%
+ {\BlockClass[\LWR@FVstyle]{fancyvrb}}%
+ }%
+ {%
+ \BlockClass[\LWR@FVstyle]{fancyvrb}%
+ }%
\LWR@stoppars
\ifx\FV@LabelPositionTopLine\relax\else
\ifx\FV@LabelBegin\relax\else
\FancyVerbRuleColor{\LWR@FVfindbordercolor}
- \LWR@htmltagc{%
- div class=\textquotedbl{}fancyvrblabel\textquotedbl\ % space
- style=\textquotedbl{}color: \LWR@origpound\LWR@tempcolor\textquotedbl%
- }
+ \ifbool{LWR@verbtags}% lwarp
+ {% lwarp
+ \LWR@findcurrenttextcolor%
+ \LWR@htmltagc{% lwarp
+ div class=\textquotedbl{}fancyvrblabel\textquotedbl\ % space
+ style=\textquotedbl{}%
+ color: \LWR@origpound\LWR@tempcolor%
+ \textquotedbl%
+ }%
+ \LWR@orignewline% lwarp
+ }% lwarp
+ {}% lwarp
\LWR@print@textrm{\FV@LabelBegin}% \textrm preserves emdash
- \LWR@htmltagc{/div}\LWR@orignewline%
+ \LWR@orignewline% lwarp
+ \ifbool{LWR@verbtags}% lwarp
+ {% lwarp
+ \LWR@htmltagc{/div}% lwarp
+ \LWR@orignewline% lwarp
+ }% lwarp
+ {}% lwarp
\fi
\fi
\LWR@atbeginverbatim{verbatim}%
@@ -95,16 +283,30 @@
\LWR@stoppars%
\ifx\FV@LabelPositionBottomLine\relax\else
\ifx\FV@LabelEnd\relax\else
- \FancyVerbRuleColor{\LWR@FVfindbordercolor}
- \LWR@htmltagc{%
- div class=\textquotedbl{}fancyvrblabel\textquotedbl\ % space
- style=\textquotedbl{}color: \LWR@origpound\LWR@tempcolor\textquotedbl%
- }
- \LWR@print@textrm{\FV@LabelEnd}
- \LWR@htmltagc{/div}\LWR@orignewline%
+ \FancyVerbRuleColor{\LWR@FVfindbordercolor}% lwarp
+ \ifbool{LWR@verbtags}% lwarp
+ {% lwarp
+ \LWR@findcurrenttextcolor%
+ \LWR@htmltagc{% lwarp
+ div class=\textquotedbl{}fancyvrblabel\textquotedbl\ % space
+ style=\textquotedbl{}%
+ color: \LWR@origpound\LWR@tempcolor%
+ \textquotedbl%
+ }%
+ \LWR@orignewline% lwarp
+ }% lwarp
+ {}% lwarp
+ \LWR@print@textrm{\FV@LabelEnd}% lwarp
+ \LWR@orignewline% lwarp
+ \ifbool{LWR@verbtags}% lwarp
+ {% lwarp
+ \LWR@htmltagc{/div}% lwarp
+ \LWR@orignewline% lwarp
+ }% lwarp
+ {}% lwarp
\fi
\fi
-\endBlockClass
+\endBlockClass% lwarp
}
\newcommand*{\LWR@fvstartsingle}{%
@@ -143,16 +345,17 @@ border#1: \strip@pt\dimexpr \FV@FrameRule\relax\relax pt % space
solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space
}
-\def\FV@Frame@none{%
+\def\LWR@HTML@FV@Frame@none{%
\renewcommand*{\LWR@FVstyle}{\LWR@currenttextcolorstyle}%
\let\FV@BeginListFrame\LWR@fvstartnone%
\let\FV@LeftListFrame\relax%
\let\FV@RightListFrame\relax%
\let\FV@EndListFrame\LWR@fvendnone}
+\LWR@formatted{FV@Frame@none}
\FV@Frame@none% default values
-\def\FV@Frame@single{%
+\def\LWR@HTML@FV@Frame@single{%
\renewcommand*{\LWR@FVstyle}{%
\LWR@currenttextcolorstyle\LWR@indentHTMLtwo%
\LWR@FVborderstyle{}%
@@ -161,8 +364,9 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space
\let\FV@LeftListFrame\FV@LeftListFrame@Single%
\let\FV@RightListFrame\FV@RightListFrame@Single%
\let\FV@EndListFrame\LWR@fvendsingle}
+\LWR@formatted{FV@Frame@single}
-\def\FV@Frame@lines{%
+\def\LWR@HTML@FV@Frame@lines{%
\renewcommand*{\LWR@FVstyle}{%
\LWR@currenttextcolorstyle\LWR@indentHTMLtwo%
\LWR@FVborderstyle{-top}%
@@ -173,8 +377,9 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space
\let\FV@LeftListFrame\relax%
\let\FV@RightListFrame\relax%
\let\FV@EndListFrame\LWR@fvendline}
+\LWR@formatted{FV@Frame@lines}
-\def\FV@Frame@topline{%
+\def\LWR@HTML@FV@Frame@topline{%
\renewcommand*{\LWR@FVstyle}{%
\LWR@currenttextcolorstyle\LWR@indentHTMLtwo%
\LWR@FVborderstyle{-top}%
@@ -183,8 +388,9 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space
\let\FV@LeftListFrame\relax%
\let\FV@RightListFrame\relax%
\let\FV@EndListFrame\LWR@fvendnone}
+\LWR@formatted{FV@Frame@topline}
-\def\FV@Frame@bottomline{%
+\def\LWR@HTML@FV@Frame@bottomline{%
\renewcommand*{\LWR@FVstyle}{%
\LWR@currenttextcolorstyle\LWR@indentHTMLtwo%
\LWR@FVborderstyle{-bottom}%
@@ -193,8 +399,9 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space
\let\FV@LeftListFrame\relax%
\let\FV@RightListFrame\relax%
\let\FV@EndListFrame\LWR@fvendline}
-\def\FV@FrameFillLine{}%
-\def\FV@Frame@leftline{%
+\LWR@formatted{FV@Frame@bottomline}
+\def\FV@FrameFillLine{}
+\def\LWR@HTML@FV@Frame@leftline{%
\renewcommand*{\LWR@FVstyle}{%
\LWR@currenttextcolorstyle\LWR@indentHTMLtwo%
\LWR@FVborderstyle{-left}%
@@ -212,7 +419,8 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space
\let\FV@LeftListFrame\FV@LeftListFrame@Single%
\let\FV@RightListFrame\relax%
\let\FV@EndListFrame\LWR@fvendnone}
-\def\FV@SingleFrameLine#1{%
+\LWR@formatted{FV@Frame@leftline}
+\def\LWR@HTML@FV@SingleFrameLine#1{%
\ifnum#1=\z@\relax
\let\FV@Label\FV@LabelBegin
\else
@@ -231,32 +439,11 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space
\fi
\fi
}
-\def\FV@ListProcessLine#1{%
- \hbox to \hsize{%
- \hbox to \VerbatimHTMLWidth {%
- \ifcsvoid{FV@LeftListNumber}{}{\kern 2.5em}%
- \FV@LeftListNumber%
- \FancyVerbFormatLine{#1}%
- \hss%
- \FV@RightListNumber%
- }%
- \hss% required to avoid underfull hboxes
-}
-}
-
-\def\FV@ListProcessLine@i#1{%
- \ifvoid\@labels\else
- \hbox to \z@{\kern\@totalleftmargin\box\@labels\hss}%
- \fi
- \FV@ListProcessLine{#1}%
-}
-
-\def\FV@ListProcessLastLine{}
-
+\LWR@formatted{FV@SingleFrameLine}
\xpretocmd{\FV@BeginVBox}
{%
- \LWR@forcenewpage% instead of \preto
+ \LWR@forcenewpage%
\LWR@atbeginverbatim{bverbatim}%
}
{}
@@ -271,6 +458,22 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space
} % \AfterEndPreamble
+\def\FVB@VerbatimOut#1{%
+ \@bsphack
+ \begingroup
+ \FV@UseKeyValues
+ \FV@DefineWhiteSpace
+ \def\FV@Space{\space}%
+ \FV@DefineTabOut
+ \def\FV@ProcessLine{\immediate\write\FV@OutFile}%
+ \immediate\openout\FV@OutFile #1\relax
+ \let\FV@FontScanPrep\relax
+%% DG/SR modification begin - May. 18, 1998 (to avoid problems with ligatures)
+ \let\@noligs\relax
+%% DG/SR modification end
+ \boolfalse{LWR@HTMLsanitize@tmpb@enable}% lwarp
+ \FV@Scan}
+
\endinput
%%