summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/regexpatch/regexpatch.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/regexpatch/regexpatch.sty')
-rw-r--r--Master/texmf-dist/tex/latex/regexpatch/regexpatch.sty718
1 files changed, 549 insertions, 169 deletions
diff --git a/Master/texmf-dist/tex/latex/regexpatch/regexpatch.sty b/Master/texmf-dist/tex/latex/regexpatch/regexpatch.sty
index b6b65c512b4..6ac04557daf 100644
--- a/Master/texmf-dist/tex/latex/regexpatch/regexpatch.sty
+++ b/Master/texmf-dist/tex/latex/regexpatch/regexpatch.sty
@@ -9,7 +9,7 @@
%% Do not distribute this file without also distributing the
%% source files specified above.
%%
-%% File: regexpatch.dtx (C) Copyright 2012 Enrico Gregorio
+%% File: regexpatch.dtx (C) Copyright 2012-2013 Enrico Gregorio
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -24,7 +24,7 @@
%% The released version of this bundle is available from CTAN.
%%
\RequirePackage{expl3}
-\GetIdInfo$Id: regexpatch.dtx 0.1b 2012-07-24 12:00:00Z Enrico $
+\GetIdInfo$Id: regexpatch.dtx 0.2 2013-03-28 12:00:00Z Enrico $
{Extending etoolbox patching commands}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
@@ -118,25 +118,35 @@
\l_xpatch_repl_tl
}
}
-\cs_new_protected:Npn \xpatch_main:NNN #1 #2 #3
+\cs_new_protected:Npn \xpatch_main_four:NNnnnn #1 #2 #3 #4 #5 #6
{
- \cs_if_exist:NTF #3
+ \cs_if_exist:NTF #2
{
- \xpatch_main_check:N #3
+ \xpatch_main_check:N #2
\bool_if:NT \l_xpatch_tracing_bool
- { \xpatch_message_cstype:N #3 }
- \exp_after:wN #1 \cs:w \l_xpatch_name_tl \cs_end:
+ { \xpatch_message_cstype:N #2 }
+ \exp_after:wN #1 \cs:w \l_xpatch_name_tl \cs_end: {#3}{#4}{#5}{#6}
}
{
- \msg_term:x
+ \msg_term:n
{
xpatch~message \\
- `\token_to_str:N #3'~is~undefined;~
+ `\token_to_str:N #2'~is~undefined;~
I'll~ignore~the~request.
}
- #2
}
}
+\cs_new_protected:Npn \xpatch_main_three:NNnnn #1 #2 #3 #4 #5
+ {
+ \xpatch_main_four:NNnnnn #1 #2 { #3 } { #4 } { #5 } { }
+ }
+\cs_new_protected:Npn \xpatch_main_zero:NN #1 #2
+ {
+ \xpatch_main_four:NNnnnn #1 #2 { } { } { } { }
+ }
+\cs_generate_variant:Nn \xpatch_main_zero:NN {Nc}
+\cs_generate_variant:Nn \xpatch_main_three:NNnnn {Nc}
+\cs_generate_variant:Nn \xpatch_main_four:NNnnnn {Nc}
\cs_new_protected:Npn \xpatch_get_all:N #1
{
\tl_set:Nf \l_xpatch_prefix_tl { \token_get_prefix_spec:N #1 }
@@ -151,7 +161,7 @@
\use:x
{
\exp_not:V \l_xpatch_prefix_tl
- \tex_def:D
+ \tex_def:D % unavoidable
\exp_not:N #1
\exp_not:V \l_xpatch_arg_tl
{ \exp_not:V \l_xpatch_replacement_tl }
@@ -280,12 +290,12 @@
{
\bool_if:NT \l_xpatch_tracing_bool
{
- \msg_term:x { xpatch~message \\ #1 }
+ \msg_term:n { xpatch~message \\ #1 }
}
}
\cs_new:Npn \xpatch_message_cstype:N #1
{
- \prg_case_str:onn { \l_xpatch_type_tl }
+ \str_case:onn { \l_xpatch_type_tl }
{
{ DRCw } {
\xpatch_message:n
@@ -349,167 +359,537 @@
}
}
}
-\NewDocumentCommand{\xshowcmd} { s m }
- {
- \IfBooleanT{#1}
- {
- \group_begin:
- \bool_set_true:N \l_xpatch_tracing_bool
- }
- \xpatch_main:NNN \cs_show:N \prg_do_nothing: #2
- \IfBooleanT{#1}
- {
- \group_end:
- }
- }
-\NewDocumentCommand{\xpretocmd}{ }
- { \xpatch_main:NNN \xpatch_pretocmd:Nnnn \use_none:nn }
-\NewDocumentCommand{\xapptocmd}{ }
- { \xpatch_main:NNN \xpatch_apptocmd:Nnnn \use_none:nn }
-\NewDocumentCommand{\regexpatchcmd}{ s }
- {
- \IfBooleanTF{#1}
- { \xpatch_main:NNN \xpatch_regexpatchcmd_all:Nnnnn \use_none:nnn }
- { \xpatch_main:NNN \xpatch_regexpatchcmd_once:Nnnnn \use_none:nnn }
- }
-\NewDocumentCommand{\xpatchcmd}{ s }
- {
- \IfBooleanTF{#1}
- { \xpatch_main:NNN \xpatch_patchcmd_all:Nnnnn \use_none:nnn }
- { \xpatch_main:NNN \xpatch_patchcmd_once:Nnnnn \use_none:nnn }
- }
-\cs_generate_variant:Nn \xpatch_main:NNN {NNc}
-\NewDocumentCommand{\xshowbibmacro} { s m }
- {
- \IfBooleanT{#1}
- {
- \group_begin:
- \bool_set_true:N \l_xpatch_tracing_bool
- }
- \xpatch_main:NNc \cs_show:N \prg_do_nothing: { abx@macro@ \tl_to_str:n {#2} }
- \IfBooleanT{#1}
- {
- \group_end:
- }
- }
-\NewDocumentCommand{\xpretobibmacro} { m }
- {
- \xpatch_main:NNc \xpatch_pretocmd:Nnnn \use_none:nn
- { abx@macro@ \tl_to_str:n {#1} }
- }
-\NewDocumentCommand{\xapptobibmacro} { m }
- {
- \xpatch_main:NNc \xpatch_apptocmd:Nnnn \use_none:nn
- { abx@macro@ \tl_to_str:n {#1} }
- }
-\NewDocumentCommand{\xpatchbibmacro} { s m }
- {
- \IfBooleanTF{#1}
- {
- \xpatch_main:NNc \xpatch_patchcmd_all:Nnnnn \use_none:nnn
- { abx@macro@ \tl_to_str:n {#2} }
- }
- {
- \xpatch_main:NNc \xpatch_patchcmd_once:Nnnnn \use_none:nnn
- { abx@macro@ \tl_to_str:n {#2} }
- }
- }
-\NewDocumentCommand{\regexpatchbibmacro} { s m }
- {
- \IfBooleanTF{#1}
- {
- \xpatch_main:NNc \xpatch_regexpatchcmd_all:Nnnnn \use_none:nnn
- { abx@macro@ \tl_to_str:n {#2} }
- }
- {
- \xpatch_main:NNc \xpatch_regexpatchcmd_once:Nnnnn \use_none:nnn
- { abx@macro@ \tl_to_str:n {#2} }
- }
- }
-\NewDocumentCommand{\xshowbibdriver} { s m }
- {
- \IfBooleanT{#1}
- {
- \group_begin:
- \bool_set_true:N \l_xpatch_tracing_bool
- }
- \xpatch_main:NNc \cs_show:N \prg_do_nothing: { blx@bbx@#2 }
- \IfBooleanT{#1}
- {
- \group_end:
- }
- }
-\NewDocumentCommand{\xpretobibdriver} { m }
- { \exp_args:Nc \xpatch_pretocmd:Nnnn {blx@bbx@#1} }
-\NewDocumentCommand{\xapptobibdriver} { m }
- { \exp_args:Nc \xpatch_apptocmd:Nnnn {blx@bbx@#1} }
-\NewDocumentCommand{\xpatchbibdriver} { s m }
- {
- \IfBooleanTF{#1}
- { \exp_args:Nc \xpatch_patchcmd_all:Nnnnn {blx@bbx@#2} }
- { \exp_args:Nc \xpatch_patchcmd_once:Nnnnn {blx@bbx@#2} }
- }
-\NewDocumentCommand{\regexpatchbibdriver} { s m }
- {
- \IfBooleanTF{#1}
- { \exp_args:Nc \xpatch_regexpatchcmd_all:Nnnnn {blx@bbx@#2} }
- { \exp_args:Nc \xpatch_regexpatchcmd_once:Nnnnn {blx@bbx@#2} }
- }
-\NewDocumentCommand{\checkpatchable}{ m }
- {
- \group_begin:
- \bool_set_true:N \l_xpatch_tracing_bool
- \xpatch_check_patchable:N #1
- \group_end:
- }
+\NewDocumentCommand{\xshowcmd} { s +m }
+ {
+ \IfBooleanT{#1}
+ {
+ \group_begin:
+ \bool_set_true:N \l_xpatch_tracing_bool
+ }
+ \xpatch_main_zero:NN \cs_show:N #2
+ \IfBooleanT{#1}
+ {
+ \group_end:
+ }
+ }
+\NewDocumentCommand{\xpretocmd}{ +m +m +m +m }
+ { \xpatch_main_three:NNnnn \xpatch_pretocmd:Nnnn #1 {#2} {#3} {#4} }
+\NewDocumentCommand{\xapptocmd}{ +m +m +m +m }
+ { \xpatch_main_three:NNnnn \xpatch_apptocmd:Nnnn #1 {#2} {#3} {#4} }
+\NewDocumentCommand{\regexpatchcmd}{ s +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ { \xpatch_main_four:NNnnnn \xpatch_regexpatchcmd_all:Nnnnn #2 {#3}{#4}{#5}{#6} }
+ { \xpatch_main_four:NNnnnn \xpatch_regexpatchcmd_once:Nnnnn #2 {#3}{#4}{#5}{#6} }
+ }
+\NewDocumentCommand{\xpatchcmd}{ s +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ { \xpatch_main_four:NNnnnn \xpatch_patchcmd_all:Nnnnn #2 {#3}{#4}{#5}{#6} }
+ { \xpatch_main_four:NNnnnn \xpatch_patchcmd_once:Nnnnn #2 {#3}{#4}{#5}{#6} }
+ }
+\NewDocumentCommand{\xshowbibmacro} { s +m }
+ {
+ \IfBooleanT{#1}
+ {
+ \group_begin:
+ \bool_set_true:N \l_xpatch_tracing_bool
+ }
+ \xpatch_main_zero:Nc \cs_show:N { abx@macro@ \tl_to_str:n {#2} }
+ \IfBooleanT{#1}
+ {
+ \group_end:
+ }
+ }
+\NewDocumentCommand{\xpretobibmacro} { +m +m +m +m }
+ {
+ \xpatch_main_three:Ncnnn \xpatch_pretocmd:Nnnn
+ { abx@macro@ \tl_to_str:n {#1} } {#2}{#3}{#4}
+ }
+\NewDocumentCommand{\xapptobibmacro} { +m +m +m +m }
+ {
+ \xpatch_main_three:Ncnnn \xpatch_apptocmd:Nnnn
+ { abx@macro@ \tl_to_str:n {#1} } {#2}{#3}{#4}
+ }
+\NewDocumentCommand{\xpatchbibmacro} { s +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_patchcmd_all:Nnnnn
+ { abx@macro@ \tl_to_str:n {#2} } {#3}{#4}{#5}{#6}
+ }
+ {
+ \xpatch_main:Ncnnnn \xpatch_patchcmd_once:Nnnnn
+ { abx@macro@ \tl_to_str:n {#2} } {#3}{#4}{#5}{#6}
+ }
+ }
+\NewDocumentCommand{\regexpatchbibmacro} { s +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_regexpatchcmd_all:Nnnnn
+ { abx@macro@ \tl_to_str:n {#2} } {#3}{#4}{#5}{#6}
+ }
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_regexpatchcmd_once:Nnnnn
+ { abx@macro@ \tl_to_str:n {#2} } {#3}{#4}{#5}{#6}
+ }
+ }
+\NewDocumentCommand{\xshowbibdriver} { s +m }
+ {
+ \IfBooleanT{#1}
+ {
+ \group_begin:
+ \bool_set_true:N \l_xpatch_tracing_bool
+ }
+ \xpatch_main_zero:Nc \cs_show:N { blx@bbx@#2 }
+ \IfBooleanT{#1}
+ {
+ \group_end:
+ }
+ }
+\NewDocumentCommand{\xpretobibdriver} { +m +m +m +m }
+ { \exp_args:Nc \xpatch_pretocmd:Nnnn {blx@bbx@#1} {#2}{#3}{#4} }
+\NewDocumentCommand{\xapptobibdriver} { +m +m +m +m }
+ { \exp_args:Nc \xpatch_apptocmd:Nnnn {blx@bbx@#1} {#2}{#3}{#4} }
+\NewDocumentCommand{\xpatchbibdriver} { s +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ { \exp_args:Nc \xpatch_patchcmd_all:Nnnnn {blx@bbx@#2} {#2}{#3}{#4}{#5} }
+ { \exp_args:Nc \xpatch_patchcmd_once:Nnnnn {blx@bbx@#2} {#2}{#3}{#4}{#5} }
+ }
+\NewDocumentCommand{\regexpatchbibdriver} { s +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ { \exp_args:Nc \xpatch_regexpatchcmd_all:Nnnnn {blx@bbx@#2} {#2}{#3}{#4}{#5} }
+ { \exp_args:Nc \xpatch_regexpatchcmd_once:Nnnnn {blx@bbx@#2} {#2}{#3}{#4}{#5} }
+ }
+\NewDocumentCommand{\xshowfieldformat} { s O{*} +m }
+ {
+ \IfBooleanT{#1}
+ {
+ \group_begin:
+ \bool_set_true:N \l_xpatch_tracing_bool
+ }
+ \xpatch_main_zero:Nc \cs_show:N { abx@ffd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} }
+ \IfBooleanT{#1}
+ {
+ \group_end:
+ }
+ }
+\NewDocumentCommand{\xpretofieldformat} { s O{*} +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_three:Ncnnn \xpatch_pretocmd_all:Nnnn
+ { abx@ffd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ {
+ \xpatch_main_three:Ncnnn \xpatch_pretocmd_once:Nnnn
+ { abx@ffd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ }
+\NewDocumentCommand{\xapptofieldformat} { s O{*} +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_three:Ncnnn \xpatch_apptocmd_all:Nnnn
+ { abx@ffd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ {
+ \xpatch_main_three:Ncnnn \xpatch_apptocmd_once:Nnnn
+ { abx@ffd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ }
+\NewDocumentCommand{\xpatchfieldformat} { s O{*} +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_patchcmd_all:Nnnnn
+ { abx@ffd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_patchcmd_once:Nnnnn
+ { abx@ffd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ }
+\NewDocumentCommand{\regexpatchfieldformat} { s O{*} +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_regexpatchcmd_all:Nnnnn
+ { abx@ffd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_regexpatchcmd_once:Nnnnn
+ { abx@ffd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ }
+
+\NewDocumentCommand{\xshownameformat} { s O{*} +m }
+ {
+ \IfBooleanT{#1}
+ {
+ \group_begin:
+ \bool_set_true:N \l_xpatch_tracing_bool
+ }
+ \xpatch_main_zero:Nc \cs_show:N { abx@nfd@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} }
+ \IfBooleanT{#1}
+ {
+ \group_end:
+ }
+ }
+\NewDocumentCommand{\xpretonameformat} { s O{*} +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_three:Ncnnn \xpatch_pretocmd_all:Nnnn
+ { abx@nfd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ {
+ \xpatch_main_three:Ncnnn \xpatch_pretocmd_once:Nnnn
+ { abx@nfd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ }
+\NewDocumentCommand{\xapptonameformat} { s O{*} +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_three:Ncnnn \xpatch_apptocmd_all:Nnnn
+ { abx@nfd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ {
+ \xpatch_main_three:Ncnnn \xpatch_apptocmd_once:Nnnn
+ { abx@nfd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ }
+\NewDocumentCommand{\xpatchnameformat} { s O{*} +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_patchcmd_all:Nnnnn
+ { abx@nfd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_patchcmd_once:Nnnnn
+ { abx@nfd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ }
+\NewDocumentCommand{\regexpatchnameformat} { s O{*} +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_regexpatchcmd_all:Nnnnn
+ { abx@nfd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_regexpatchcmd_once:Nnnnn
+ { abx@nfd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ }
+
+\NewDocumentCommand{\xshowlistformat} { s O{*} +m }
+ {
+ \IfBooleanT{#1}
+ {
+ \group_begin:
+ \bool_set_true:N \l_xpatch_tracing_bool
+ }
+ \xpatch_main_zero:Nc \cs_show:N { abx@lfd@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} }
+ \IfBooleanT{#1}
+ {
+ \group_end:
+ }
+ }
+\NewDocumentCommand{\xpretolistformat} { s O{*} +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_three:Ncnnn \xpatch_pretocmd_all:Nnnn
+ { abx@lfd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ {
+ \xpatch_main_three:Ncnnn \xpatch_pretocmd_once:Nnnn
+ { abx@lfd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ }
+\NewDocumentCommand{\xapptolistformat} { s O{*} +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_three:Ncnnn \xpatch_apptocmd_all:Nnnn
+ { abx@lfd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ {
+ \xpatch_main_three:Ncnnn \xpatch_apptocmd_once:Nnnn
+ { abx@lfd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ }
+\NewDocumentCommand{\xpatchlistformat} { s O{*} +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_patchcmd_all:Nnnnn
+ { abx@lfd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_patchcmd_once:Nnnnn
+ { abx@lfd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ }
+\NewDocumentCommand{\regexpatchlistformat} { s O{*} +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_regexpatchcmd_all:Nnnnn
+ { abx@lfd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_regexpatchcmd_once:Nnnnn
+ { abx@lfd@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ }
+
+\NewDocumentCommand{\xshowindexfieldformat} { s O{*} +m }
+ {
+ \IfBooleanT{#1}
+ {
+ \group_begin:
+ \bool_set_true:N \l_xpatch_tracing_bool
+ }
+ \xpatch_main_zero:Nc \cs_show:N { abx@fid@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} }
+ \IfBooleanT{#1}
+ {
+ \group_end:
+ }
+ }
+\NewDocumentCommand{\xpretoindexfieldformat} { s O{*} +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_three:Ncnnn \xpatch_pretocmd_all:Nnnn
+ { abx@fid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ {
+ \xpatch_main_three:Ncnnn \xpatch_pretocmd_once:Nnnn
+ { abx@fid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ }
+\NewDocumentCommand{\xapptoindexfieldformat} { s O{*} +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_three:Ncnnn \xpatch_apptocmd_all:Nnnn
+ { abx@fid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ {
+ \xpatch_main_three:Ncnnn \xpatch_apptocmd_once:Nnnn
+ { abx@fid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ }
+\NewDocumentCommand{\xpatchindexfieldformat} { s O{*} +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_patchcmd_all:Nnnnn
+ { abx@fid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_patchcmd_once:Nnnnn
+ { abx@fid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ }
+\NewDocumentCommand{\regexpatchindexfieldformat} { s O{*} +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_regexpatchcmd_all:Nnnnn
+ { abx@fid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_regexpatchcmd_once:Nnnnn
+ { abx@fid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ }
+
+\NewDocumentCommand{\xshowindexnameformat} { s O{*} +m }
+ {
+ \IfBooleanT{#1}
+ {
+ \group_begin:
+ \bool_set_true:N \l_xpatch_tracing_bool
+ }
+ \xpatch_main_zero:Nc \cs_show:N { abx@nid@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} }
+ \IfBooleanT{#1}
+ {
+ \group_end:
+ }
+ }
+\NewDocumentCommand{\xpretoindexnameformat} { s O{*} +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_three:Ncnnn \xpatch_pretocmd_all:Nnnn
+ { abx@nid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ {
+ \xpatch_main_three:Ncnnn \xpatch_pretocmd_once:Nnnn
+ { abx@nid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ }
+\NewDocumentCommand{\xapptoindexnameformat} { s O{*} +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_three:Ncnnn \xpatch_apptocmd_all:Nnnn
+ { abx@nid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ {
+ \xpatch_main_three:Ncnnn \xpatch_apptocmd_once:Nnnn
+ { abx@nid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ }
+\NewDocumentCommand{\xpatchindexnameformat} { s O{*} +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_patchcmd_all:Nnnnn
+ { abx@nid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_patchcmd_once:Nnnnn
+ { abx@nid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ }
+\NewDocumentCommand{\regexpatchindexnameformat} { s O{*} +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_regexpatchcmd_all:Nnnnn
+ { abx@nid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_regexpatchcmd_once:Nnnnn
+ { abx@nid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ }
+
+\NewDocumentCommand{\xshowindexlistformat} { s O{*} +m }
+ {
+ \IfBooleanT{#1}
+ {
+ \group_begin:
+ \bool_set_true:N \l_xpatch_tracing_bool
+ }
+ \xpatch_main_zero:Nc \cs_show:N { abx@lid@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} }
+ \IfBooleanT{#1}
+ {
+ \group_end:
+ }
+ }
+\NewDocumentCommand{\xpretoindexlistformat} { s O{*} +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_three:Ncnnn \xpatch_pretocmd_all:Nnnn
+ { abx@lid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ {
+ \xpatch_main_three:Ncnnn \xpatch_pretocmd_once:Nnnn
+ { abx@lid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ }
+\NewDocumentCommand{\xapptoindexlistformat} { s O{*} +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_three:Ncnnn \xpatch_apptocmd_all:Nnnn
+ { abx@lid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ {
+ \xpatch_main_three:Ncnnn \xpatch_apptocmd_once:Nnnn
+ { abx@lid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}
+ }
+ }
+\NewDocumentCommand{\xpatchindexlistformat} { s O{*} +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_patchcmd_all:Nnnnn
+ { abx@lid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_patchcmd_once:Nnnnn
+ { abx@lid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ }
+\NewDocumentCommand{\regexpatchindexlistformat} { s O{*} +m +m +m +m +m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_regexpatchcmd_all:Nnnnn
+ { abx@lid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ {
+ \xpatch_main_four:Ncnnnn \xpatch_regexpatchcmd_once:Nnnnn
+ { abx@lid@ \tl_to_str:n {#2} @ \tl_to_str:n {#3} } {#4}{#5}{#6}{#7}
+ }
+ }
+\NewDocumentCommand{\checkpatchable}{ +m }
+ {
+ \group_begin:
+ \bool_set_true:N \l_xpatch_tracing_bool
+ \xpatch_check_patchable:N #1
+ \group_end:
+ }
\cs_generate_variant:Nn \xpatch_get_all:N {c}
\cs_generate_variant:Nn \xpatch_rebuild:N {c}
-\NewDocumentCommand{\xpatchoptarg}{ m m }
- {
- \xpatch_main_check:N #1
- \bool_if:NTF \l_xpatch_optional_bool
- {
- \tl_set:Nx \l_xpatch_name_tl { \tl_tail:V \l_xpatch_name_tl }
- \tl_set:Nf \l_xpatch_prefix_tl { \token_get_prefix_spec:N #1 }
- \tl_clear:N \l_xpatch_prefix_tl
- \tl_set_rescan:Nnx \l_xpatch_prefix_tl { } \l_xpatch_prefix_tl
- \tl_set_eq:Nc \l_xpatch_replacement_tl { \l_xpatch_name_tl }
- \tl_set:Nn \l_tmpa_tl { { #2 } }
- \regex_replace_once:nnN { \cB. .* \cE. \Z} { \u{l_tmpa_tl} }
- \l_xpatch_replacement_tl
- \xpatch_rebuild:c { \l_xpatch_name_tl }
- }
+\NewDocumentCommand{\xpatchoptarg}{ +m +m }
+ {
+ \xpatch_main_check:N #1
+ \bool_if:NTF \l_xpatch_optional_bool
+ {
+ \tl_set:Nx \l_xpatch_name_tl { \tl_tail:V \l_xpatch_name_tl }
+ \tl_set:Nf \l_xpatch_prefix_tl { \token_get_prefix_spec:N #1 }
+ \tl_clear:N \l_xpatch_prefix_tl
+ \tl_set_rescan:Nnx \l_xpatch_prefix_tl { } \l_xpatch_prefix_tl
+ \tl_set_eq:Nc \l_xpatch_replacement_tl { \l_xpatch_name_tl }
+ \tl_set:Nn \l_tmpa_tl { { #2 } }
+ \regex_replace_once:nnN { \cB. .* \cE. \Z} { \u{l_tmpa_tl} }
+ \l_xpatch_replacement_tl
+ \xpatch_rebuild:c { \l_xpatch_name_tl }
+ }
+ {
+ \group_begin:
+ \bool_set_true:N \l_xpatch_tracing_bool
+ \xpatch_message:n
{
- \group_begin:
- \bool_set_true:N \l_xpatch_tracing_bool
- \xpatch_message:n
- {
- Macro~`\token_to_str:N #1'~ has~no~optional~argument~
- or~it~has~been~defined~with~`xparse'~and~operating~
- on~such~commands~is~(still)~not~supported
- }
- \group_end:
+ Macro~`\token_to_str:N #1'~ has~no~optional~argument~
+ or~it~has~been~defined~with~`xparse'~and~operating~
+ on~such~commands~is~(still)~not~supported
}
- }
+ \group_end:
+ }
+ }
\NewDocumentCommand{\tracingxpatches}{ O{1} }
- {
- \int_compare:nTF { #1 > 0 }
- { \bool_set_true:N \l_xpatch_tracing_bool }
- { \bool_set_false:N \l_xpatch_tracing_bool }
- }
-\NewDocumentCommand{\xpatchparametertext}{m m m m m}
- {
- \xpatch_check_patchable:N #1
- \bool_if:NTF \l_xpatch_patchable_bool
- {
- \regex_replace_once:nnN { #2 } { #3 } \l_xpatch_arg_tl
- \xpatch_rebuild:N #1
- #4
- }
- {
- #5
- }
- }
+ {
+ \int_compare:nTF { #1 > 0 }
+ { \bool_set_true:N \l_xpatch_tracing_bool }
+ { \bool_set_false:N \l_xpatch_tracing_bool }
+ }
+\NewDocumentCommand{\xpatchparametertext}{ m +m +m +m +m }
+ {
+ \xpatch_check_patchable:N #1
+ \bool_if:NTF \l_xpatch_patchable_bool
+ {
+ \regex_replace_once:nnN { #2 } { #3 } \l_xpatch_arg_tl
+ \xpatch_rebuild:N #1
+ #4
+ }
+ {
+ #5
+ }
+ }
%%
%%
%% End of file `regexpatch.sty'.