diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty index 57e71f04988..bbf68b78646 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty @@ -13,7 +13,7 @@ %% %% Do not distribute a modified version of this file. %% -%% File: l3str-format.dtx Copyright (C) 2012 The LaTeX3 Project +%% File: l3str-format.dtx Copyright (C) 2012-2013 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -61,6 +61,20 @@ } \cs_new:Npn \__str_format_put:nw #1 #2 \s__stop { #2 \s__stop #1 } \cs_generate_variant:Nn \__str_format_put:nw { o , f } +\prg_new_conditional:Npnn \__str_format_if_in:nN #1#2 { TF } + { + \__str_format_if_in_aux:NN #2 #1 + { #2 \prg_return_false: \exp_after:wN \__prg_break: \else: } + \__prg_break_point: + } +\cs_new:Npn \__str_format_if_in_aux:NN #1#2 + { + \if_charcode:w #1 #2 + \prg_return_true: + \exp_after:wN \__prg_break: + \fi: + \__str_format_if_in_aux:NN #1 + } \cs_new:Npn \__str_format_parse:n #1 { \exp_last_unbraced:Nf \__str_format_parse_auxi:NN @@ -68,7 +82,7 @@ } \cs_new:Npx \__str_format_parse_auxi:NN #1#2 { - \exp_not:N \__str_if_contains_char:nNTF { < > = ^ } #2 + \exp_not:N \__str_format_if_in:nNTF { < > = ^ } #2 { \exp_not:N \__str_format_parse_auxiii:nN { #1 #2 } } { \exp_not:N \__str_format_parse_auxii:nN @@ -77,13 +91,13 @@ } \cs_new:Npn \__str_format_parse_auxii:nN #1#2 { - \__str_if_contains_char:nNTF { < > = ^ } #2 + \__str_format_if_in:nNTF { < > = ^ } #2 { \__str_format_parse_auxiii:nN { #1 #2 } } { \__str_format_parse_auxiii:nN { #1 ? } #2 } } \cs_new:Npx \__str_format_parse_auxiii:nN #1#2 { - \exp_not:N \__str_if_contains_char:nNTF + \exp_not:N \__str_format_if_in:nNTF { + - \c_catcode_other_space_tl } #2 { \exp_not:N \__str_format_parse_auxiv:nwN { #1 #2 } ; } @@ -199,8 +213,8 @@ } \__str_format_put:nw { {#4} } \tl_if_empty:nTF {#5} - { \__str_format_put:nw { \use:n { } } } - { \__str_format_put:nw { \__str_substr_unsafe:nnn { {1} {#5} } } } + { \__str_format_put:nw { \__str_range_unsafe:nnn { {1} {-1} } } } + { \__str_format_put:nw { \__str_range_unsafe:nnn { {1} {#5} } } } \token_if_eq_charcode:NNF #6 s { \token_if_eq_charcode:NNF #6 ? @@ -384,7 +398,7 @@ } { \__str_format_put:fw - { \str_substr:nnn { #4#5#6#7 0 } { 2 } { #8 + 1 } } + { \str_range:nnn { #4#5#6#7 0 } { 2 } { #8 + 1 } } } \__str_format_put:fw { \use_i:nnnn #4 . } \use_none:n \s__stop |