Skip to content

Commit

Permalink
Extend firstaid for cleveref for gh1560 (#1562)
Browse files Browse the repository at this point in the history
* add cleveref firstaid for issue #1560

* update hook tests
  • Loading branch information
josephwright committed Nov 25, 2024
1 parent 5c1c295 commit 764d201
Show file tree
Hide file tree
Showing 22 changed files with 1,279 additions and 29 deletions.
2 changes: 1 addition & 1 deletion base/testfiles-lthooks/ltcmdhooks-001.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ All initialized (non-empty) hooks:
package/acro/after -> \__hook_toplevel package/acro/after \FirstAidNeededT {acro}{sty}{....-..-.. v... typeset acronyms and other abbreviations (CN)} {\UseName {prop_new:c}{l__acro_tmpa_prop}\acsetup {patch/longtable=false}}\__hook_next package/acro/after
package/chemformula/before -> \RequirePackage {l3keys2e}\__hook_toplevel package/chemformula/before \__hook_next package/chemformula/before
package/chemnum/after -> \__hook_toplevel package/chemnum/after \FirstAidNeededT {chemnum}{sty}{....-..-.. v... a comprehensive approach for the numbering of chemical compounds (CN)} {\UseName {prop_new:c}{l__chemnum_tmpa_prop}}\__hook_next package/chemnum/after
package/cleveref/after -> \__hook_toplevel package/cleveref/after \FirstAidNeededT {cleveref}{sty}{....-..-.. v... Intelligent cross-referencing} {\def \cref@getref ##1##2{\expandafter \let \expandafter ##2\csname r@##1@cref\endcsname \expandafter \expandafter \expandafter \def \expandafter \expandafter \expandafter ##2\expandafter \expandafter \expandafter {\expandafter \@firstoffive ##2}}\def \cpageref@getref ##1##2{\expandafter \let \expandafter ##2\csname r@##1@cref\endcsname \expandafter \expandafter \expandafter \def \expandafter \expandafter \expandafter ##2\expandafter \expandafter \expandafter {\expandafter \@secondoffive ##2}}\AddToHook {begindocument}[cleveref]{\def \label@noarg ##1{\cref@old@label {##1}\@bsphack \edef \@tempa {{page}{\the \c@page }}\setcounter {page}{1}\edef \@tempb {\thepage }\expandafter \setcounter \@tempa \cref@constructprefix {page}{\cref@result }\protected@write \@auxout {}{\string \newlabel {##1@cref}{{\cref@currentlabel }{[\@tempb ][\arabic {page}][\cref@result ]\thepage }{}{}{}}}\@esphack }\def \label@optarg [##1]##2{\cref@old@label {##2}\@bsphack \edef \@tempa {{page}{\the \c@page }}\setcounter {page}{1}\edef \@tempb {\thepage }\expandafter \setcounter \@tempa \cref@constructprefix {page}{\cref@result }\protected@edef \cref@currentlabel {\expandafter \cref@override@label@type \cref@currentlabel \@nil {##1}}\protected@write \@auxout {}{\string \newlabel {##2@cref}{{\cref@currentlabel }{[\@tempb ][\arabic {page}][\cref@result ]\thepage }{}{}{}}}\@esphack }} \newcommand \firstaid@cref@smugglelabel {\let \cref@currentlabel \cref@gcurrentlabel@temp } \newcommand \firstaid@cref@updatelabeldata [1]{\cref@constructprefix {##1}{\cref@result }\@ifundefined {cref@##1@alias}{\def \@tempa {##1}}{\def \@tempa {\csname cref@##1@alias\endcsname }}\protected@xdef \cref@gcurrentlabel@temp {[\@tempa ][\arabic {##1}][\cref@result ]\csname p@##1\endcsname \csname the##1\endcsname }\aftergroup \firstaid@cref@smugglelabel } \AddToHook {label}[firstaid/cleveref] {\ifx \@currentcounter \@empty \else \firstaid@cref@updatelabeldata {\@currentcounter }\fi } }\__hook_next package/cleveref/after
package/cleveref/after -> \__hook_toplevel package/cleveref/after \FirstAidNeededT {cleveref}{sty}{....-..-.. v... Intelligent cross-referencing} {\def \cref@getref ##1##2{\expandafter \let \expandafter ##2\csname r@##1@cref\endcsname \expandafter \expandafter \expandafter \def \expandafter \expandafter \expandafter ##2\expandafter \expandafter \expandafter {\expandafter \@firstoffive ##2}}\def \cpageref@getref ##1##2{\expandafter \let \expandafter ##2\csname r@##1@cref\endcsname \expandafter \expandafter \expandafter \def \expandafter \expandafter \expandafter ##2\expandafter \expandafter \expandafter {\expandafter \@secondoffive ##2}}\AddToHook {begindocument}[cleveref]{\def \label@noarg ##1{\cref@old@label {##1}\@bsphack \edef \@tempa {{page}{\the \c@page }}\setcounter {page}{1}\edef \@tempb {\thepage }\expandafter \setcounter \@tempa \cref@constructprefix {page}{\cref@result }\protected@write \@auxout {}{\string \newlabel {##1@cref}{{\cref@currentlabel }{[\@tempb ][\arabic {page}][\cref@result ]\thepage }{}{}{}}}\@esphack }\def \label@optarg [##1]##2{\cref@old@label {##2}\@bsphack \edef \@tempa {{page}{\the \c@page }}\setcounter {page}{1}\edef \@tempb {\thepage }\expandafter \setcounter \@tempa \cref@constructprefix {page}{\cref@result }\protected@edef \cref@currentlabel {\expandafter \cref@override@label@type \cref@currentlabel \@nil {##1}}\protected@write \@auxout {}{\string \newlabel {##2@cref}{{\cref@currentlabel }{[\@tempb ][\arabic {page}][\cref@result ]\thepage }{}{}{}}}\@esphack }} \newcommand \firstaid@cref@smugglelabel {\let \cref@currentlabel \cref@gcurrentlabel@temp } \newcommand \firstaid@cref@updatelabeldata [1]{\cref@constructprefix {##1}{\cref@result }\@ifundefined {cref@##1@alias}{\def \@tempa {##1}}{\def \@tempa {\csname cref@##1@alias\endcsname }}\protected@xdef \cref@gcurrentlabel@temp {[\@tempa ][\arabic {##1}][\cref@result ]\csname p@##1\endcsname \csname the##1\endcsname }\aftergroup \firstaid@cref@smugglelabel } \newif \iftag@ \AddToHook {label}[firstaid/cleveref] {\ifx \@currentcounter \@empty \else \iftag@ \else \firstaid@cref@updatelabeldata {\@currentcounter }\fi \fi } }\__hook_next package/cleveref/after
package/arydshln/after -> \__hook_toplevel package/arydshln/after \FirstAidNeededT {arydshln}{sty}{....-..-.. v... } {\protected \def \adl@@vlineL ##1##2##3##4{\adl@ivline ##4\@nil {##1}{##2}\xdef \adl@colsL {\adl@colsL \@elt {##3}{\number \@tempcnta }{\number \@tempcntb }{\adl@dashcolor }{\adl@gapcolor }}}\protected \def \adl@@vlineR ##1##2##3##4{\adl@ivline ##4\@nil {##1}{##2}\xdef \adl@colsR {\@elt {##3}{\number \@tempcnta }{\number \@tempcntb }{\adl@dashcolor }{\adl@gapcolor }\adl@colsR }}\let \adl@act@@vlineL \adl@@vlineL \let \adl@act@@vlineR \adl@@vlineR }\__hook_next package/arydshln/after
package/l3graphics/after -> \__hook_toplevel package/l3graphics/after \seq_set_from_clist:Nn \l_graphics_search_ext_seq {.pdf,.eps,.ps,.png,.jpg,.jpeg}\__hook_next package/l3graphics/after
cmd/foo/before -> before 1 before 2 \__hook_toplevel cmd/foo/before {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}\__hook_next cmd/foo/before {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}
Expand Down
2 changes: 1 addition & 1 deletion base/testfiles-lthooks/lthooks-000.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ All initialized (non-empty) hooks:
package/acro/after -> \__hook_toplevel package/acro/after \FirstAidNeededT {acro}{sty}{....-..-.. v... typeset acronyms and other abbreviations (CN)} {\UseName {prop_new:c}{l__acro_tmpa_prop}\acsetup {patch/longtable=false}}\__hook_next package/acro/after
package/chemformula/before -> \RequirePackage {l3keys2e}\__hook_toplevel package/chemformula/before \__hook_next package/chemformula/before
package/chemnum/after -> \__hook_toplevel package/chemnum/after \FirstAidNeededT {chemnum}{sty}{....-..-.. v... a comprehensive approach for the numbering of chemical compounds (CN)} {\UseName {prop_new:c}{l__chemnum_tmpa_prop}}\__hook_next package/chemnum/after
package/cleveref/after -> \__hook_toplevel package/cleveref/after \FirstAidNeededT {cleveref}{sty}{....-..-.. v... Intelligent cross-referencing} {\def \cref@getref ##1##2{\expandafter \let \expandafter ##2\csname r@##1@cref\endcsname \expandafter \expandafter \expandafter \def \expandafter \expandafter \expandafter ##2\expandafter \expandafter \expandafter {\expandafter \@firstoffive ##2}}\def \cpageref@getref ##1##2{\expandafter \let \expandafter ##2\csname r@##1@cref\endcsname \expandafter \expandafter \expandafter \def \expandafter \expandafter \expandafter ##2\expandafter \expandafter \expandafter {\expandafter \@secondoffive ##2}}\AddToHook {begindocument}[cleveref]{\def \label@noarg ##1{\cref@old@label {##1}\@bsphack \edef \@tempa {{page}{\the \c@page }}\setcounter {page}{1}\edef \@tempb {\thepage }\expandafter \setcounter \@tempa \cref@constructprefix {page}{\cref@result }\protected@write \@auxout {}{\string \newlabel {##1@cref}{{\cref@currentlabel }{[\@tempb ][\arabic {page}][\cref@result ]\thepage }{}{}{}}}\@esphack }\def \label@optarg [##1]##2{\cref@old@label {##2}\@bsphack \edef \@tempa {{page}{\the \c@page }}\setcounter {page}{1}\edef \@tempb {\thepage }\expandafter \setcounter \@tempa \cref@constructprefix {page}{\cref@result }\protected@edef \cref@currentlabel {\expandafter \cref@override@label@type \cref@currentlabel \@nil {##1}}\protected@write \@auxout {}{\string \newlabel {##2@cref}{{\cref@currentlabel }{[\@tempb ][\arabic {page}][\cref@result ]\thepage }{}{}{}}}\@esphack }} \newcommand \firstaid@cref@smugglelabel {\let \cref@currentlabel \cref@gcurrentlabel@temp } \newcommand \firstaid@cref@updatelabeldata [1]{\cref@constructprefix {##1}{\cref@result }\@ifundefined {cref@##1@alias}{\def \@tempa {##1}}{\def \@tempa {\csname cref@##1@alias\endcsname }}\protected@xdef \cref@gcurrentlabel@temp {[\@tempa ][\arabic {##1}][\cref@result ]\csname p@##1\endcsname \csname the##1\endcsname }\aftergroup \firstaid@cref@smugglelabel } \AddToHook {label}[firstaid/cleveref] {\ifx \@currentcounter \@empty \else \firstaid@cref@updatelabeldata {\@currentcounter }\fi } }\__hook_next package/cleveref/after
package/cleveref/after -> \__hook_toplevel package/cleveref/after \FirstAidNeededT {cleveref}{sty}{....-..-.. v... Intelligent cross-referencing} {\def \cref@getref ##1##2{\expandafter \let \expandafter ##2\csname r@##1@cref\endcsname \expandafter \expandafter \expandafter \def \expandafter \expandafter \expandafter ##2\expandafter \expandafter \expandafter {\expandafter \@firstoffive ##2}}\def \cpageref@getref ##1##2{\expandafter \let \expandafter ##2\csname r@##1@cref\endcsname \expandafter \expandafter \expandafter \def \expandafter \expandafter \expandafter ##2\expandafter \expandafter \expandafter {\expandafter \@secondoffive ##2}}\AddToHook {begindocument}[cleveref]{\def \label@noarg ##1{\cref@old@label {##1}\@bsphack \edef \@tempa {{page}{\the \c@page }}\setcounter {page}{1}\edef \@tempb {\thepage }\expandafter \setcounter \@tempa \cref@constructprefix {page}{\cref@result }\protected@write \@auxout {}{\string \newlabel {##1@cref}{{\cref@currentlabel }{[\@tempb ][\arabic {page}][\cref@result ]\thepage }{}{}{}}}\@esphack }\def \label@optarg [##1]##2{\cref@old@label {##2}\@bsphack \edef \@tempa {{page}{\the \c@page }}\setcounter {page}{1}\edef \@tempb {\thepage }\expandafter \setcounter \@tempa \cref@constructprefix {page}{\cref@result }\protected@edef \cref@currentlabel {\expandafter \cref@override@label@type \cref@currentlabel \@nil {##1}}\protected@write \@auxout {}{\string \newlabel {##2@cref}{{\cref@currentlabel }{[\@tempb ][\arabic {page}][\cref@result ]\thepage }{}{}{}}}\@esphack }} \newcommand \firstaid@cref@smugglelabel {\let \cref@currentlabel \cref@gcurrentlabel@temp } \newcommand \firstaid@cref@updatelabeldata [1]{\cref@constructprefix {##1}{\cref@result }\@ifundefined {cref@##1@alias}{\def \@tempa {##1}}{\def \@tempa {\csname cref@##1@alias\endcsname }}\protected@xdef \cref@gcurrentlabel@temp {[\@tempa ][\arabic {##1}][\cref@result ]\csname p@##1\endcsname \csname the##1\endcsname }\aftergroup \firstaid@cref@smugglelabel } \newif \iftag@ \AddToHook {label}[firstaid/cleveref] {\ifx \@currentcounter \@empty \else \iftag@ \else \firstaid@cref@updatelabeldata {\@currentcounter }\fi \fi } }\__hook_next package/cleveref/after
package/arydshln/after -> \__hook_toplevel package/arydshln/after \FirstAidNeededT {arydshln}{sty}{....-..-.. v... } {\protected \def \adl@@vlineL ##1##2##3##4{\adl@ivline ##4\@nil {##1}{##2}\xdef \adl@colsL {\adl@colsL \@elt {##3}{\number \@tempcnta }{\number \@tempcntb }{\adl@dashcolor }{\adl@gapcolor }}}\protected \def \adl@@vlineR ##1##2##3##4{\adl@ivline ##4\@nil {##1}{##2}\xdef \adl@colsR {\@elt {##3}{\number \@tempcnta }{\number \@tempcntb }{\adl@dashcolor }{\adl@gapcolor }\adl@colsR }}\let \adl@act@@vlineL \adl@@vlineL \let \adl@act@@vlineR \adl@@vlineR }\__hook_next package/arydshln/after
package/l3graphics/after -> \__hook_toplevel package/l3graphics/after \seq_set_from_clist:Nn \l_graphics_search_ext_seq {.pdf,.eps,.ps,.png,.jpg,.jpeg}\__hook_next package/l3graphics/after
No file lthooks-000.aux.
Expand Down
Loading

0 comments on commit 764d201

Please sign in to comment.