summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/xpatch
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2012-10-06 09:27:44 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2012-10-06 09:27:44 +0000
commita9a23194b1cababcf9c24e48937a726cb465813a (patch)
tree23ec90526b8b1c9274216923e7494de498e159b1 /Master/texmf-dist/tex/latex/xpatch
parent2642cb8f94a8070118c06133cdd27f50abb894a2 (diff)
xpatch update
git-svn-id: svn://tug.org/texlive/trunk@27897 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/xpatch')
-rw-r--r--Master/texmf-dist/tex/latex/xpatch/xpatch.sty140
1 files changed, 97 insertions, 43 deletions
diff --git a/Master/texmf-dist/tex/latex/xpatch/xpatch.sty b/Master/texmf-dist/tex/latex/xpatch/xpatch.sty
index b26de40e4df..818e802ef43 100644
--- a/Master/texmf-dist/tex/latex/xpatch/xpatch.sty
+++ b/Master/texmf-dist/tex/latex/xpatch/xpatch.sty
@@ -24,7 +24,7 @@
%% The released version of this bundle is available from CTAN.
%%
\RequirePackage{expl3}
-\GetIdInfo$Id: xpatch.dtx 0.2 2012-01-13 12:00:00Z Enrico $
+\GetIdInfo$Id: xpatch.dtx 0.3 2012-10-02 12:00:00Z Enrico $
{Extending etoolbox patching commands}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
@@ -35,87 +35,93 @@
{
Please~install~an~up~to~date~version~of~l3kernel~
using~your~TeX~package~manager~or~from~CTAN.\\ \\
- Loading~xparse~will~abort!
+ Loading~xpatch~will~abort!
}
\tex_endinput:D
}
\RequirePackage{xparse,etoolbox}
\cs_generate_variant:Nn \tl_if_in:NnT { Nx }
-\bool_new:N \l_xpatch_protect_bool
+\bool_new:N \l__xpatch_protect_bool
\cs_if_exist:NF \c_backslash_str
{ \tl_const:Nx \c_backslash_str { \cs_to_str:N \\ } }
-\tl_const:Nx \c_xpatch_bizarre_tl
+\tl_const:Nx \c__xpatch_bizarre_tl
{ \tl_to_str:n { **)-(**/**]-[** } }
+\tl_new:N \l__xpatch_name_tl
+\tl_new:N \l__xpatch_repl_tl
\cs_new:Npn \xpatch_main:NN #1 #2
{
- \bool_set_false:N \l_xpatch_protect_bool
- \tl_set:Nx \l_xpatch_name_tl { \cs_to_str:N #2 }
- \tl_set:Nx \l_xpatch_repl_tl
- { \c_xpatch_bizarre_tl \token_get_replacement_spec:N #2 }
- \tl_if_in:NxT \l_xpatch_repl_tl
+ \bool_set_false:N \l__xpatch_protect_bool
+ \tl_set:Nx \l__xpatch_name_tl { \cs_to_str:N #2 }
+ \tl_set:Nx \l__xpatch_repl_tl
+ { \c__xpatch_bizarre_tl \token_get_replacement_spec:N #2 }
+ \tl_if_in:NxT \l__xpatch_repl_tl
{
- \c_xpatch_bizarre_tl
+ \c__xpatch_bizarre_tl
\token_to_str:N \protect \c_space_tl
- \c_backslash_str \l_xpatch_name_tl \c_space_tl \c_space_tl
+ \c_backslash_str \l__xpatch_name_tl \c_space_tl \c_space_tl
}
{
- \bool_set_true:N \l_xpatch_protect_bool
- \xpatch_add_space:
+ \bool_set_true:N \l__xpatch_protect_bool
+ \tl_put_right:Nn \l__xpatch_name_tl { \c_space_tl }
}
- \tl_if_in:NxT \l_xpatch_repl_tl
+ \tl_if_in:NxT \l__xpatch_repl_tl
{
- \c_xpatch_bizarre_tl
+ \c__xpatch_bizarre_tl
\token_to_str:N \x@protect \c_space_tl
- \c_backslash_str \l_xpatch_name_tl \c_backslash_str
+ \c_backslash_str \l__xpatch_name_tl \c_backslash_str
}
{
- \bool_set_true:N \l_xpatch_protect_bool
- \xpatch_add_space:
+ \bool_set_true:N \l__xpatch_protect_bool
+ \tl_put_right:Nn \l__xpatch_name_tl { \c_space_tl }
}
- \tl_if_in:NxT \l_xpatch_repl_tl
+ \tl_if_in:NxT \l__xpatch_repl_tl
{
- \c_xpatch_bizarre_tl
+ \c__xpatch_bizarre_tl
\token_to_str:N \@protected@testopt \c_space_tl
- \c_backslash_str \l_xpatch_name_tl
+ \c_backslash_str \l__xpatch_name_tl
\c_space_tl \c_backslash_str \c_backslash_str
}
- { \xpatch_add_backslash: }
- \tl_if_in:NxT \l_xpatch_repl_tl
{
- \c_xpatch_bizarre_tl
+ \tl_put_left:Nn \l__xpatch_name_tl { \c_backslash_str }
+ }
+ \tl_if_in:NxT \l__xpatch_repl_tl
+ {
+ \c__xpatch_bizarre_tl
\token_to_str:N \@protected@testopt \c_space_tl
- \c_backslash_str \l_xpatch_name_tl
+ \c_backslash_str \l__xpatch_name_tl
\c_backslash_str \c_backslash_str
}
- { \xpatch_add_backslash: }
- \tl_if_in:NxT \l_xpatch_repl_tl
{
- \c_xpatch_bizarre_tl
+ \tl_put_left:Nn \l__xpatch_name_tl { \c_backslash_str }
+ }
+ \tl_if_in:NxT \l__xpatch_repl_tl
+ {
+ \c__xpatch_bizarre_tl
\token_to_str:N \@testopt \c_space_tl
- \c_backslash_str \c_backslash_str \l_xpatch_name_tl
+ \c_backslash_str \c_backslash_str \l__xpatch_name_tl
}
- { \xpatch_add_backslash: }
- \bool_if:NT \l_xpatch_protect_bool
{
- \tl_set:Nx \l_xpatch_repl_tl
- { \c_xpatch_bizarre_tl
+ \tl_put_left:Nn \l__xpatch_name_tl { \c_backslash_str }
+ }
+ \bool_if:NT \l__xpatch_protect_bool
+ {
+ \tl_set:Nx \l__xpatch_repl_tl
+ { \c__xpatch_bizarre_tl
\exp_after:wN \token_get_replacement_spec:N
- \cs:w \l_xpatch_name_tl \cs_end: }
- \tl_if_in:NxT \l_xpatch_repl_tl
+ \cs:w \l__xpatch_name_tl \cs_end: }
+ \tl_if_in:NxT \l__xpatch_repl_tl
{
- \c_xpatch_bizarre_tl
+ \c__xpatch_bizarre_tl
\token_to_str:N \@protected@testopt \c_space_tl
- \c_backslash_str \l_xpatch_name_tl
+ \c_backslash_str \l__xpatch_name_tl
\c_space_tl \c_backslash_str \c_backslash_str
}
- { \xpatch_add_backslash: }
+ {
+ \tl_put_left:Nn \l__xpatch_name_tl { \c_backslash_str }
+ }
}
- \exp_after:wN #1 \cs:w \l_xpatch_name_tl \cs_end:
+ \exp_after:wN #1 \cs:w \l__xpatch_name_tl \cs_end:
}
-\cs_new:Npn \xpatch_add_space:
- { \tl_set:Nx \l_xpatch_name_tl { \l_xpatch_name_tl \c_space_tl } }
-\cs_new:Npn \xpatch_add_backslash:
- { \tl_set:Nx \l_xpatch_name_tl { \c_backslash_str \l_xpatch_name_tl } }
\NewDocumentCommand{\xpatchcmd}{}{ \xpatch_main:NN \patchcmd }
\NewDocumentCommand{\xpretocmd}{}{ \xpatch_main:NN \pretocmd }
\NewDocumentCommand{\xapptocmd}{}{ \xpatch_main:NN \apptocmd }
@@ -129,6 +135,54 @@
{ \xpatch_main:Nc \apptocmd { abx@macro@ \tl_to_str:n {#1} } }
\NewDocumentCommand{\xshowbibmacro} { m }
{ \xpatch_main:Nc \show { abx@macro@ \tl_to_str:n {#1} } }
+\NewDocumentCommand{\xpatchfieldformat} { O{*} m }
+ { \xpatch_main:Nc \patchcmd { abx@ffd@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xpretofieldformat} { O{*} m }
+ { \xpatch_main:Nc \pretocmd { abx@ffd@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xapptofieldformat} { O{*} m }
+ { \xpatch_main:Nc \apptocmd { abx@ffd@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xshowfieldformat} { O{*} m }
+ { \xpatch_main:Nc \show { abx@ffd@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xpatchnameformat} { O{*} m }
+ { \xpatch_main:Nc \patchcmd { abx@nfd@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xpretonameformat} { O{*} m }
+ { \xpatch_main:Nc \pretocmd { abx@nfd@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xapptonameformat} { O{*} m }
+ { \xpatch_main:Nc \apptocmd { abx@nfd@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xshownameformat} { O{*} m }
+ { \xpatch_main:Nc \show { abx@ffd@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xpatchlistformat} { O{*} m }
+ { \xpatch_main:Nc \patchcmd { abx@lfd@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xpretolistformat} { O{*} m }
+ { \xpatch_main:Nc \pretocmd { abx@lfd@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xapptolistformat} { O{*} m }
+ { \xpatch_main:Nc \apptocmd { abx@lfd@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xshowlistformat} { O{*} m }
+ { \xpatch_main:Nc \show { abx@lfd@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xpatchindexfieldformat} { O{*} m }
+ { \xpatch_main:Nc \patchcmd { abx@fid@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xpretoindexfieldformat} { O{*} m }
+ { \xpatch_main:Nc \pretocmd { abx@fid@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xapptoindexfieldformat} { O{*} m }
+ { \xpatch_main:Nc \apptocmd { abx@fid@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xshowindexfieldformat} { O{*} m }
+ { \xpatch_main:Nc \show { abx@fid@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xpatchindexnameformat} { O{*} m }
+ { \xpatch_main:Nc \patchcmd { abx@nid@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xpretoindexnameformat} { O{*} m }
+ { \xpatch_main:Nc \pretocmd { abx@nid@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xapptoindexnameformat} { O{*} m }
+ { \xpatch_main:Nc \apptocmd { abx@nid@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xshowindexnameformat} { O{*} m }
+ { \xpatch_main:Nc \show { abx@nid@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xpatchindexlistformat} { O{*} m }
+ { \xpatch_main:Nc \patchcmd { abx@lid@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xpretoindexlistformat} { O{*} m }
+ { \xpatch_main:Nc \pretocmd { abx@lid@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xappindextolistformat} { O{*} m }
+ { \xpatch_main:Nc \apptocmd { abx@lid@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
+\NewDocumentCommand{\xshowindexlistformat} { O{*} m }
+ { \xpatch_main:Nc \show { abx@lid@ \tl_to_str:n {#1} @ \tl_to_str:n {#2} } }
\NewDocumentCommand{\xpatchbibdriver} { m }
{ \exp_args:Nc \patchcmd {blx@bbx@#1} }
\NewDocumentCommand{\xpretobibdriver} { m }