diff options
author | jfbu <jfbu@free.fr> | 2021-02-04 16:10:32 +0300 |
---|---|---|
committer | jfbu <jfbu@free.fr> | 2021-02-04 16:14:37 +0300 |
commit | 39e4ea23c6c0930fa6d917361263a66f0b9b4196 (patch) | |
tree | 414e87c0c49436075962dfee73e4a07c3f14453c /sphinx/texinputs | |
parent | 1cf915f7ddc6e12cf9d67d94b6be27fc95c9c4df (diff) |
Sync with footnotehyper 1.1d
This fixes a problem introduced at 1.1b which could case latex build
crash in case of extra user packages.
It also improves compatibility with babel + french.
Diffstat (limited to 'sphinx/texinputs')
-rw-r--r-- | sphinx/texinputs/footnotehyper-sphinx.sty | 84 |
1 files changed, 61 insertions, 23 deletions
diff --git a/sphinx/texinputs/footnotehyper-sphinx.sty b/sphinx/texinputs/footnotehyper-sphinx.sty index dfe43cdcb..5ed0e8e6e 100644 --- a/sphinx/texinputs/footnotehyper-sphinx.sty +++ b/sphinx/texinputs/footnotehyper-sphinx.sty @@ -1,9 +1,9 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{footnotehyper-sphinx}% - [2021/01/29 v1.1c hyperref aware footnote.sty for sphinx (JFB)] + [2021/02/04 v1.1d hyperref aware footnote.sty for sphinx (JFB)] %% %% Package: footnotehyper-sphinx -%% Version: based on footnotehyper.sty 2021/01/29 v1.1c +%% Version: based on footnotehyper.sty 2021/02/04 v1.1d %% as available at https://www.ctan.org/pkg/footnotehyper %% License: the one applying to Sphinx %% @@ -17,6 +17,7 @@ %% 4. macro definition \sphinxfootnotemark, %% 5. macro definition \sphinxlongtablepatch %% 6. replaced some \undefined by \@undefined +\newif\iffootnotehyperparse\footnotehyperparsetrue \DeclareOption*{\PackageWarning{footnotehyper-sphinx}{Option `\CurrentOption' is unknown}}% \ProcessOptions\relax \newbox\FNH@notes @@ -218,38 +219,76 @@ \FNH@endfntext@fntext {\unvbox\z@}% \endgroup }% -\AtBeginDocument{% - \let\FNH@@makefntext\@makefntext - \ifx\@makefntextFB\@undefined - \expandafter\@gobble\else\expandafter\@firstofone\fi - {\ifFBFrenchFootnotes \let\FNH@@makefntext\@makefntextFB \else - \let\FNH@@makefntext\@makefntextORI\fi}% - \expandafter\FNH@check@a\FNH@@makefntext{1.2!3?4,}% - \FNH@@@1.2!3?4,\FNH@@@\relax +\let\FNH@prefntext\@empty +\let\FNH@postfntext\@empty +\AtBeginDocument{\iffootnotehyperparse\expandafter\FNH@check\fi}% +\def\FNH@safeif#1{% + \iftrue\csname if#1\endcsname\csname fi\endcsname\expandafter\@firstoftwo + \else\csname fi\endcsname\expandafter\@secondoftwo + \fi +}% +\def\FNH@check{% + \ifx\@makefntextFB\@undefined\expandafter\FNH@check@ + \else\expandafter\FNH@frenchb@ + \fi +}% +\def\FNH@frenchb@{% + \def\FNH@prefntext{% + \localleftbox{}% + \let\FBeverypar@save\FBeverypar@quote + \let\FBeverypar@quote\relax + \FNH@safeif{FB@koma}% + {\FNH@safeif{FBFrenchFootnotes}% + {\ifx\footnote\thanks + \let\@@makefnmark\@@makefnmarkTH + \@makefntextTH{} % space as in french.ldf + \else + \let\@@makefnmark\@@makefnmarkFB + \@makefntextFB{} % space as in french.ldf + \fi + }{\let\@@makefnmark\@@makefnmarkORI + \@makefntextORI{}% no space as in french.ldf + }% + }% + {\FNH@safeif{FBFrenchFootnotes}% + {\@makefntextFB{}}% + {\@makefntextORI{}}% + }% + }% + \def\FNH@postfntext{% + \let\FBeverypar@quote\FBeverypar@save + \localleftbox{\FBeveryline@quote}% + }% +}% +\def\FNH@check@{% + \expandafter\FNH@check@a\@makefntext{1.2!3?4,}% + \FNH@@@1.2!3?4,\FNH@@@\relax }% \long\def\FNH@check@a #11.2!3?4,#2\FNH@@@#3{% - \ifx\relax#3\FNH@bad@makefntext@alert + \ifx\relax#3\expandafter\FNH@checkagain@ \else - \edef\FNH@restore@{\catcode`\noexpand\@\the\catcode`\@\relax}% - \makeatletter - \ifx\@makefntextFB\@undefined - \expandafter\@gobble\else\expandafter\@firstofone\fi - {\@ifclassloaded{memoir}% - {\ifFBFrenchFootnotes\expandafter\@gobble\fi}% - {}}% - \@secondoftwo - \scantokens{\def\FNH@prefntext{#1}\def\FNH@postfntext{#2}}% - \FNH@restore@ + \def\FNH@prefntext{#1}\def\FNH@postfntext{#2}% \expandafter\FNH@check@b \fi }% +\def\FNH@checkagain@{% + \expandafter\FNH@checkagain@a + \detokenize\expandafter{\@makefntext{1.2!3?4,}}\relax\FNH@@@ +}% +\edef\FNH@temp{\noexpand\FNH@checkagain@a ##1\string{1.2!3?4,\string}}% +\expandafter\def\FNH@temp#2#3\FNH@@@{% + \ifx\relax#2% + \def\FNH@prefntext{\@makefntext{}}% + \else\FNH@bad@makefntext@alert + \fi +}% \def\FNH@check@b #1\relax{% \expandafter\expandafter\expandafter\FNH@check@c \expandafter\meaning\expandafter\FNH@prefntext \meaning\FNH@postfntext1.2!3?4,\FNH@check@c\relax }% \def\FNH@check@c #11.2!3?4,#2#3\relax{% - \ifx\FNH@check@c#2\expandafter\@gobble\fi\FNH@bad@makefntext@alert + \ifx\FNH@check@c#2\else\FNH@bad@makefntext@alert\fi }% % slight reformulation for Sphinx \def\FNH@bad@makefntext@alert{% @@ -283,7 +322,6 @@ \noexpand\if@endpe\noexpand\@endpetrue\noexpand\fi }% }% -% end of footnotehyper 2017/02/16 v0.99 % some extras for Sphinx : % \sphinxfootnotemark: usable in section titles and silently removed from TOCs. \def\sphinxfootnotemark [#1]% |