diff options
author | Karl Berry <karl@freefriends.org> | 2016-02-03 23:02:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-02-03 23:02:34 +0000 |
commit | d7e7feec5992a359e08cb62c8bb2a53b59b7112f (patch) | |
tree | 382490c4e07b4ab12dfa6c15c3ace2012b847ad9 /Master/texmf-dist | |
parent | f4a543aed2bbfaec5c3f8dbfee5985322cd1b938 (diff) |
zhnumber (2feb16)
git-svn-id: svn://tug.org/texlive/trunk@39567 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/zhnumber/zhnumber.pdf | bin | 328366 -> 325428 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/zhnumber/zhnumber.dtx | 102 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/zhnumber/zhnumber.ins | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/zhnumber/zhnumber-big5.cfg | 6 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/zhnumber/zhnumber-gbk.cfg | 6 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/zhnumber/zhnumber-utf8.cfg | 6 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty | 99 |
7 files changed, 108 insertions, 115 deletions
diff --git a/Master/texmf-dist/doc/latex/zhnumber/zhnumber.pdf b/Master/texmf-dist/doc/latex/zhnumber/zhnumber.pdf Binary files differindex 1bdb5c845c9..65289a9c2eb 100644 --- a/Master/texmf-dist/doc/latex/zhnumber/zhnumber.pdf +++ b/Master/texmf-dist/doc/latex/zhnumber/zhnumber.pdf diff --git a/Master/texmf-dist/source/latex/zhnumber/zhnumber.dtx b/Master/texmf-dist/source/latex/zhnumber/zhnumber.dtx index 218c0fee1e7..3fa1919271a 100644 --- a/Master/texmf-dist/source/latex/zhnumber/zhnumber.dtx +++ b/Master/texmf-dist/source/latex/zhnumber/zhnumber.dtx @@ -130,7 +130,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). \askforoverwritefalse \preamble - Copyright (C) 2012, 2014, 2015 by Qing Lee <sobenlee@gmail.com> + Copyright (C) 2012, 2014-2016 by Qing Lee <sobenlee@gmail.com> -------------------------------------------------------------------------- This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 @@ -200,7 +200,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). %<config&utf8> {\ExplFileName-utf8.cfg} %<config&big5> {\ExplFileName-big5.cfg} %<config&gbk> {\ExplFileName-gbk.cfg} - {\ExplFileDate}{2.2}{\ExplFileDescription} + {\ExplFileDate}{2.3}{\ExplFileDescription} %</driver|package|config> %<*driver> \ExplSyntaxOff @@ -309,7 +309,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). %</driver> % \fi % -% \CheckSum{1194} +% \CheckSum{1193} % \GetFileInfo{\jobname.sty} % % \title{\bfseries\pkg{zhnumber} 宏包} @@ -627,7 +627,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). 'l3kernel'~and~'l3packages'\\\\ using~your~TeX~package~manager~or~from~CTAN. } -\@ifpackagelater { expl3 } { 2014/08/25 } { } +\@ifpackagelater { expl3 } { 2015/09/24 } { } { \msg_error:nn { zhnumber } { l3-too-old } } % \end{macrocode} % @@ -770,7 +770,9 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). { \@@_counter_error:n {#1} } } \cs_new:Npn \@@_counter_error:n #1 - { \__msg_expandable_error:n { `#1'~is~not~a~LaTeX~counter. } } + { \msg_expandable_error:nnn { zhnumber } { not-counter } {#1} } +\msg_new:nnn { zhnumber } { not-counter } + { `#1'~is~not~a~LaTeX~counter. } \cs_new:Npn \zhnum_int:n #1 { \int_compare:nNnTF {#1} > \c_zero @@ -798,7 +800,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). \exp_after:wN \@@_read_integer:www \tex_number:D \exp_after:wN \@@_read_sign_loop:N - \tex_romannumeral:D -`0 \use:n + \exp:w \exp_end_continue_f:w \use:n #1 \exp_stop_f: \q_recursion_tail \q_recursion_stop \@@_result:nn { \c_zero } { } ; } @@ -806,10 +808,10 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). { \if:w + \if:w - \exp_not:N #1 + \fi: \exp_not:N #1 \exp_after:wN \@@_read_sign_loop:N - \tex_romannumeral:D -`0 \exp_after:wN \use:n + \exp:w \exp_end_continue_f:w \exp_after:wN \use:n \else: 1 \exp_after:wN ; - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \exp_after:wN \@@_read_zeros_loop:N \exp_after:wN #1 \fi: @@ -818,7 +820,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). { \if:w 0 \exp_not:N #1 \exp_after:wN \@@_read_zeros_loop:N - \tex_romannumeral:D -`0 \exp_after:wN \use:n + \exp:w \exp_end_continue_f:w \exp_after:wN \use:n \else: \exp_after:wN \@@_read_abs_loop:Nw \exp_after:wN #1 @@ -840,7 +842,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). { \@@_output:nnwnn { + \c_one } #1 } { \quark_if_recursion_tail_stop_do:Nn #1 { \@@_loop_end:wnn } } \exp_after:wN \@@_read_abs_loop:Nw - \tex_romannumeral:D -`0 \use:n #2 \q_recursion_stop + \exp:w \exp_end_continue_f:w \use:n #2 \q_recursion_stop } \cs_new:Npn \@@_output:nnwnn #1#2#3 \@@_result:nn #4#5 { #3 \@@_result:nn { #4#1 } { #5#2 } } @@ -1037,14 +1039,14 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). \exp_after:wN \@@_read_digits:w \tex_number:D \exp_after:wN \@@_read_sign_loop:NN \exp_after:wN #1 - \tex_romannumeral:D -`0 \use:n + \exp:w \exp_end_continue_f:w \use:n #2 \exp_stop_f: \q_recursion_tail \q_recursion_stop } \cs_new:Npn \@@_read_sign_loop:NN #1#2 { \if:w + \if:w - \exp_not:N #2 + \fi: \exp_not:N #2 \exp_after:wN \@@_read_sign_loop:NN \exp_after:wN #1 - \tex_romannumeral:D -`0 \exp_after:wN \use:n + \exp:w \exp_end_continue_f:w \exp_after:wN \use:n \else: 1 \exp_after:wN ; \exp_after:wN \@@_read_digits_loop:NN @@ -1061,7 +1063,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). \if:w .\exp_not:N #2 \exp_after:wN \c_@@_dot_tl \fi: } \exp_after:wN \@@_read_digits_loop:NN \exp_after:wN #1 - \tex_romannumeral:D -`0 \use:n + \exp:w \exp_end_continue_f:w \use:n } \cs_new:Npn \@@_read_digits:w #1 ; { @@ -1225,16 +1227,13 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). % \begin{macrocode} \cs_new:Npn \zhtime #1 { \@@_time:ww #1 \q_stop } -\group_begin: -\char_set_lccode:nn { `\; } { `\: } -\tl_to_lowercase:n +\use:x { - \group_end: - \cs_new:Npn \@@_time:ww #1 ; #2 \q_stop - { - \zhnum_check_time:Nn \zhnum_int:n {#1} \c_@@_hour_tl - \zhnum_check_time:Nn \zhnum_int:n {#2} \c_@@_minute_tl - } + \cs_new:Npn \exp_not:N \@@_time:ww ##1 \c_colon_str ##2 \exp_not:N \q_stop + } + { + \zhnum_check_time:Nn \zhnum_int:n {#1} \c_@@_hour_tl + \zhnum_check_time:Nn \zhnum_int:n {#2} \c_@@_minute_tl } % \end{macrocode} % \end{macro} @@ -1657,16 +1656,16 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). % \begin{macrocode} \cs_new_protected:Npn \zhnum_load_cfg:n #1 { - \zhnum_set_cfg_name:Nn \l_@@_cfg_tl {#1} - \tl_if_eq:NNF \l_@@_cfg_tl \l_@@_last_cfg_tl + \zhnum_set_cfg_name:Nn \l_@@_cfg_str {#1} + \str_if_eq:NNF \l_@@_cfg_str \l_@@_last_cfg_str { \zhnum_update_cfg:n {#1} } \zhnum_parse_config: } \cs_generate_variant:Nn \zhnum_load_cfg:n { o } \cs_new_protected:Npn \zhnum_update_cfg:n #1 { - \prop_if_exist:cTF { g_@@_cfg_ \l_@@_cfg_tl _prop } - { \tl_set_eq:NN \l_@@_last_cfg_tl \l_@@_cfg_tl } + \prop_if_exist:cTF { g_@@_cfg_ \l_@@_cfg_str _prop } + { \str_set_eq:NN \l_@@_last_cfg_str \l_@@_cfg_str } { \zhnum_input_cfg:n {#1} } \@@_update_cfg_prop:N \prop_set_eq:Nc } @@ -1688,10 +1687,10 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). } \cs_new_protected:Npn \@@_update_cfg_prop:N #1 { - #1 \l_@@_cfg_map_prop { g_@@_cfg_ \l_@@_cfg_tl _prop } - #1 \l_@@_cfg_map_var_prop { g_@@_cfg_var_ \l_@@_cfg_tl _prop } - #1 \l_@@_cfg_map_finan_prop { g_@@_cfg_finan_ \l_@@_cfg_tl _prop } - #1 \l_@@_cfg_map_ganzhi_prop { g_@@_cfg_ganzhi_ \l_@@_cfg_tl _prop } + #1 \l_@@_cfg_map_prop { g_@@_cfg_ \l_@@_cfg_str _prop } + #1 \l_@@_cfg_map_var_prop { g_@@_cfg_var_ \l_@@_cfg_str _prop } + #1 \l_@@_cfg_map_finan_prop { g_@@_cfg_finan_ \l_@@_cfg_str _prop } + #1 \l_@@_cfg_map_ganzhi_prop { g_@@_cfg_ganzhi_ \l_@@_cfg_str _prop } } \cs_new_protected:Npn \@@_prop_initial:Nn #1#2 { @@ -1700,8 +1699,8 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). } \cs_new_protected:Npn \@@_prop_gset_eq:Nn #1#2 { \prop_gset_eq:cN {#2} #1 } -\tl_new:N \l_@@_cfg_tl -\tl_new:N \l_@@_last_cfg_tl +\str_new:N \l_@@_cfg_str +\str_new:N \l_@@_last_cfg_str \bool_new:N \l_@@_reset_bool \msg_new:nnnn { zhnumber } { file-not-found } { File~`#1'~not~found. } @@ -1714,16 +1713,14 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). % % \begin{macro}[internal,pTF]{\zhnum_if_unicode_engine:} % 使用 \upTeX{} 的时候,也不必将汉字的首字符设置为活动字符。判断 |^^^^0021| 是否为 -% 单个记号的办法对 \upTeX{} 不适用。因此,参考 \pkg{ifuptex} 宏包,通过 \tn{kchar} -% 是否为 primitive 来判断。 +% 单个记号的办法对 \upTeX{} 不适用。 % \begin{macrocode} -\pdftex_if_engine:TF +\bool_if:nTF { - \str_if_eq_x:nnTF - { \token_to_str:N \kchar } - { \token_to_meaning:N \kchar } + \sys_if_engine_xetex_p: || + \sys_if_engine_luatex_p: || + \sys_if_engine_uptex_p: } - { \use_i:nn } { \cs_new_eq:NN \zhnum_if_unicode_engine_p: \c_true_bool \cs_new_eq:NN \zhnum_if_unicode_engine:TF \use_i:nn @@ -1747,8 +1744,8 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). \cs_new_eq:NN \zhnum_set_catcode: \prg_do_nothing: \cs_new_protected:Npn \zhnum_set_cfg_name:Nn #1#2 { - \tl_set:Nx \l_@@_encoding_tl {#2} - \tl_set:Nx #1 { \tl_to_str:N \l_@@_encoding_tl } + \str_set:Nx \l_@@_encoding_str {#2} + \str_set_eq:NN #1 \l_@@_encoding_str } \cs_new_eq:NN \zhnum_reset_config: \zhnum_parse_config: \else: @@ -1756,7 +1753,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). { \bool_if:NT \l_@@_active_char_bool { \zhnum_set_active: } } \cs_new_protected_nopar:Npn \zhnum_set_active: { - \str_case:onTF { \l_@@_encoding_tl } + \str_case:onTF { \l_@@_encoding_str } { { gbk } { \int_set:Nn \l_@@_byte_min_int { "81 } } { big5 } { \int_set:Nn \l_@@_byte_min_int { "A1 } } @@ -1774,16 +1771,15 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). \int_new:N \l_@@_byte_max_int \cs_new_protected:Npn \zhnum_set_cfg_name:Nn #1#2 { - \tl_set:Nx \l_@@_encoding_tl {#2} - \tl_set:Nx #1 + \str_set:Nx \l_@@_encoding_str {#2} + \str_set:Nx #1 { - \tl_to_str:N \l_@@_encoding_tl - \bool_if:NT \l_@@_active_char_bool - { \tl_to_str:n { _active } } + \l_@@_encoding_str + \bool_if:NT \l_@@_active_char_bool { _active } } } \cs_new_protected_nopar:Npn \zhnum_reset_config: - { \zhnum_load_cfg:o { \l_@@_encoding_tl } } + { \zhnum_load_cfg:o { \l_@@_encoding_str } } \bool_new:N \l_@@_active_char_bool \bool_set_true:N \l_@@_active_char_bool \fi: @@ -1798,9 +1794,9 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). encoding .choices:nn = { UTF8 , GBK , Big5 } { - \exp_args:Nx \tex_lowercase:D - { \tl_set:Nn \exp_not:N \l_@@_encoding_tl { \l_keys_choice_tl } } - \zhnum_load_cfg:o { \l_@@_encoding_tl } + \str_set:Nx \l_@@_encoding_str + { \str_fold_case:V \l_keys_choice_tl } + \zhnum_load_cfg:o { \l_@@_encoding_str } } , encoding .default:n = { GBK } , encoding / Bg5 .meta:n = { encoding = Big5 } , @@ -1839,7 +1835,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). { \cs_set_eq:NN \zhnum_ganzhi:nnn \zhnum_ganzhi_normal:nnn } , ganzhi-cyclic .default:n = { true } , } -\tl_new:N \l_@@_encoding_tl +\str_new:N \l_@@_encoding_str \msg_new:nnnn { zhnumber } { encoding-invalid } { The~encoding~`#1'~is~invalid. } { Available~encodings~are~`UTF8',~`GBK'~and~`Big5'. } @@ -1865,7 +1861,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). % % 如果没有选定编码,则根据引擎自动设置编码。 % \begin{macrocode} -\tl_if_empty:NT \l_@@_encoding_tl +\str_if_empty:NT \l_@@_encoding_str { \zhnum_if_unicode_engine:TF { \keys_set:nn { zhnum / options } { encoding = UTF8 } } diff --git a/Master/texmf-dist/source/latex/zhnumber/zhnumber.ins b/Master/texmf-dist/source/latex/zhnumber/zhnumber.ins index 1ed6564f831..4aadc96b646 100644 --- a/Master/texmf-dist/source/latex/zhnumber/zhnumber.ins +++ b/Master/texmf-dist/source/latex/zhnumber/zhnumber.ins @@ -6,7 +6,7 @@ %% %% zhnumber.dtx (with options: `install') %% -%% Copyright (C) 2012, 2014, 2015 by Qing Lee <sobenlee@gmail.com> +%% Copyright (C) 2012, 2014-2016 by Qing Lee <sobenlee@gmail.com> %% -------------------------------------------------------------------------- %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -65,7 +65,7 @@ \askforoverwritefalse \preamble - Copyright (C) 2012, 2014, 2015 by Qing Lee <sobenlee@gmail.com> + Copyright (C) 2012, 2014-2016 by Qing Lee <sobenlee@gmail.com> -------------------------------------------------------------------------- This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 diff --git a/Master/texmf-dist/tex/latex/zhnumber/zhnumber-big5.cfg b/Master/texmf-dist/tex/latex/zhnumber/zhnumber-big5.cfg index f74aee2d3d5..f62be008da2 100644 --- a/Master/texmf-dist/tex/latex/zhnumber/zhnumber-big5.cfg +++ b/Master/texmf-dist/tex/latex/zhnumber/zhnumber-big5.cfg @@ -6,7 +6,7 @@ %% %% zhnumber.dtx (with options: `config,big5') %% -%% Copyright (C) 2012, 2014, 2015 by Qing Lee <sobenlee@gmail.com> +%% Copyright (C) 2012, 2014-2016 by Qing Lee <sobenlee@gmail.com> %% -------------------------------------------------------------------------- %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -19,11 +19,11 @@ %% This work has the LPPL maintenance status "maintained". %% The Current Maintainer of this work is Qing Lee. %% -\GetIdInfo$Id: zhnumber.dtx 42dbb38 2015-05-21 23:20:32 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: zhnumber.dtx 9686fd1 2016-02-02 16:55:41 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese numerals with Big5 encoding} \ProvidesExplFile {\ExplFileName-big5.cfg} - {\ExplFileDate}{2.2}{\ExplFileDescription} + {\ExplFileDate}{2.3}{\ExplFileDescription} \zhnum_set_digits_map:nn { minus } { t } \zhnum_set_digits_map:nn { 0 } { s } \zhnum_set_digits_map:nn { null } { } diff --git a/Master/texmf-dist/tex/latex/zhnumber/zhnumber-gbk.cfg b/Master/texmf-dist/tex/latex/zhnumber/zhnumber-gbk.cfg index 2f6dd172f76..57e1af8dbf9 100644 --- a/Master/texmf-dist/tex/latex/zhnumber/zhnumber-gbk.cfg +++ b/Master/texmf-dist/tex/latex/zhnumber/zhnumber-gbk.cfg @@ -6,7 +6,7 @@ %% %% zhnumber.dtx (with options: `config,gbk') %% -%% Copyright (C) 2012, 2014, 2015 by Qing Lee <sobenlee@gmail.com> +%% Copyright (C) 2012, 2014-2016 by Qing Lee <sobenlee@gmail.com> %% -------------------------------------------------------------------------- %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -19,11 +19,11 @@ %% This work has the LPPL maintenance status "maintained". %% The Current Maintainer of this work is Qing Lee. %% -\GetIdInfo$Id: zhnumber.dtx 42dbb38 2015-05-21 23:20:32 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: zhnumber.dtx 9686fd1 2016-02-02 16:55:41 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese numerals with GBK encoding} \ProvidesExplFile {\ExplFileName-gbk.cfg} - {\ExplFileDate}{2.2}{\ExplFileDescription} + {\ExplFileDate}{2.3}{\ExplFileDescription} \zhnum_set_digits_map:nnn { minus } { simp } { } \zhnum_set_digits_map:nnn { minus } { trad } { ؓ } \zhnum_set_digits_map:nn { 0 } { } diff --git a/Master/texmf-dist/tex/latex/zhnumber/zhnumber-utf8.cfg b/Master/texmf-dist/tex/latex/zhnumber/zhnumber-utf8.cfg index b006f7b0b2b..d8f110df755 100644 --- a/Master/texmf-dist/tex/latex/zhnumber/zhnumber-utf8.cfg +++ b/Master/texmf-dist/tex/latex/zhnumber/zhnumber-utf8.cfg @@ -6,7 +6,7 @@ %% %% zhnumber.dtx (with options: `config,utf8') %% -%% Copyright (C) 2012, 2014, 2015 by Qing Lee <sobenlee@gmail.com> +%% Copyright (C) 2012, 2014-2016 by Qing Lee <sobenlee@gmail.com> %% -------------------------------------------------------------------------- %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -19,11 +19,11 @@ %% This work has the LPPL maintenance status "maintained". %% The Current Maintainer of this work is Qing Lee. %% -\GetIdInfo$Id: zhnumber.dtx 42dbb38 2015-05-21 23:20:32 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: zhnumber.dtx 9686fd1 2016-02-02 16:55:41 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese numerals with UTF8 encoding} \ProvidesExplFile {\ExplFileName-utf8.cfg} - {\ExplFileDate}{2.2}{\ExplFileDescription} + {\ExplFileDate}{2.3}{\ExplFileDescription} \zhnum_set_digits_map:nnn { minus } { simp } { 负 } \zhnum_set_digits_map:nnn { minus } { trad } { 負 } \zhnum_set_digits_map:nn { 0 } { 零 } diff --git a/Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty b/Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty index 4223c0743d7..3945d1cfc98 100644 --- a/Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty +++ b/Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty @@ -6,7 +6,7 @@ %% %% zhnumber.dtx (with options: `package') %% -%% Copyright (C) 2012, 2014, 2015 by Qing Lee <sobenlee@gmail.com> +%% Copyright (C) 2012, 2014-2016 by Qing Lee <sobenlee@gmail.com> %% -------------------------------------------------------------------------- %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,11 +21,11 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: zhnumber.dtx 42dbb38 2015-05-21 23:20:32 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: zhnumber.dtx 9686fd1 2016-02-02 16:55:41 +0800 Qing Lee <sobenlee@gmail.com> $ {Typesetting numbers with Chinese glyphs} \ProvidesExplPackage {\ExplFileName} - {\ExplFileDate}{2.2}{\ExplFileDescription} + {\ExplFileDate}{2.3}{\ExplFileDescription} \msg_new:nnn { zhnumber } { l3-too-old } { Support~package~'expl3'~too~old. \\\\ @@ -33,7 +33,7 @@ 'l3kernel'~and~'l3packages'\\\\ using~your~TeX~package~manager~or~from~CTAN. } -\@ifpackagelater { expl3 } { 2014/08/25 } { } +\@ifpackagelater { expl3 } { 2015/09/24 } { } { \msg_error:nn { zhnumber } { l3-too-old } } \RequirePackage { xparse , l3keys2e } \DeclareExpandableDocumentCommand \zhnumber { +o +m } @@ -118,7 +118,9 @@ { \__zhnum_counter_error:n {#1} } } \cs_new:Npn \__zhnum_counter_error:n #1 - { \__msg_expandable_error:n { `#1'~is~not~a~LaTeX~counter. } } + { \msg_expandable_error:nnn { zhnumber } { not-counter } {#1} } +\msg_new:nnn { zhnumber } { not-counter } + { `#1'~is~not~a~LaTeX~counter. } \cs_new:Npn \zhnum_int:n #1 { \int_compare:nNnTF {#1} > \c_zero @@ -138,7 +140,7 @@ \exp_after:wN \__zhnum_read_integer:www \tex_number:D \exp_after:wN \__zhnum_read_sign_loop:N - \tex_romannumeral:D -`0 \use:n + \exp:w \exp_end_continue_f:w \use:n #1 \exp_stop_f: \q_recursion_tail \q_recursion_stop \__zhnum_result:nn { \c_zero } { } ; } @@ -146,10 +148,10 @@ { \if:w + \if:w - \exp_not:N #1 + \fi: \exp_not:N #1 \exp_after:wN \__zhnum_read_sign_loop:N - \tex_romannumeral:D -`0 \exp_after:wN \use:n + \exp:w \exp_end_continue_f:w \exp_after:wN \use:n \else: 1 \exp_after:wN ; - \tex_romannumeral:D -`0 + \exp:w \exp_end_continue_f:w \exp_after:wN \__zhnum_read_zeros_loop:N \exp_after:wN #1 \fi: @@ -158,7 +160,7 @@ { \if:w 0 \exp_not:N #1 \exp_after:wN \__zhnum_read_zeros_loop:N - \tex_romannumeral:D -`0 \exp_after:wN \use:n + \exp:w \exp_end_continue_f:w \exp_after:wN \use:n \else: \exp_after:wN \__zhnum_read_abs_loop:Nw \exp_after:wN #1 @@ -170,7 +172,7 @@ { \__zhnum_output:nnwnn { + \c_one } #1 } { \quark_if_recursion_tail_stop_do:Nn #1 { \__zhnum_loop_end:wnn } } \exp_after:wN \__zhnum_read_abs_loop:Nw - \tex_romannumeral:D -`0 \use:n #2 \q_recursion_stop + \exp:w \exp_end_continue_f:w \use:n #2 \q_recursion_stop } \cs_new:Npn \__zhnum_output:nnwnn #1#2#3 \__zhnum_result:nn #4#5 { #3 \__zhnum_result:nn { #4#1 } { #5#2 } } @@ -304,14 +306,14 @@ \exp_after:wN \__zhnum_read_digits:w \tex_number:D \exp_after:wN \__zhnum_read_sign_loop:NN \exp_after:wN #1 - \tex_romannumeral:D -`0 \use:n + \exp:w \exp_end_continue_f:w \use:n #2 \exp_stop_f: \q_recursion_tail \q_recursion_stop } \cs_new:Npn \__zhnum_read_sign_loop:NN #1#2 { \if:w + \if:w - \exp_not:N #2 + \fi: \exp_not:N #2 \exp_after:wN \__zhnum_read_sign_loop:NN \exp_after:wN #1 - \tex_romannumeral:D -`0 \exp_after:wN \use:n + \exp:w \exp_end_continue_f:w \exp_after:wN \use:n \else: 1 \exp_after:wN ; \exp_after:wN \__zhnum_read_digits_loop:NN @@ -328,7 +330,7 @@ \if:w .\exp_not:N #2 \exp_after:wN \c__zhnum_dot_tl \fi: } \exp_after:wN \__zhnum_read_digits_loop:NN \exp_after:wN #1 - \tex_romannumeral:D -`0 \use:n + \exp:w \exp_end_continue_f:w \use:n } \cs_new:Npn \__zhnum_read_digits:w #1 ; { @@ -427,16 +429,13 @@ } \cs_new:Npn \zhtime #1 { \__zhnum_time:ww #1 \q_stop } -\group_begin: -\char_set_lccode:nn { `\; } { `\: } -\tl_to_lowercase:n +\use:x { - \group_end: - \cs_new:Npn \__zhnum_time:ww #1 ; #2 \q_stop - { - \zhnum_check_time:Nn \zhnum_int:n {#1} \c__zhnum_hour_tl - \zhnum_check_time:Nn \zhnum_int:n {#2} \c__zhnum_minute_tl - } + \cs_new:Npn \exp_not:N \__zhnum_time:ww ##1 \c_colon_str ##2 \exp_not:N \q_stop + } + { + \zhnum_check_time:Nn \zhnum_int:n {#1} \c__zhnum_hour_tl + \zhnum_check_time:Nn \zhnum_int:n {#2} \c__zhnum_minute_tl } \cs_new_nopar:Npn \zhcurrtime { @@ -733,16 +732,16 @@ { \cs_set_eq:NN \zhnum_set_alias:NN \tl_set_eq:NN } \cs_new_protected:Npn \zhnum_load_cfg:n #1 { - \zhnum_set_cfg_name:Nn \l__zhnum_cfg_tl {#1} - \tl_if_eq:NNF \l__zhnum_cfg_tl \l__zhnum_last_cfg_tl + \zhnum_set_cfg_name:Nn \l__zhnum_cfg_str {#1} + \str_if_eq:NNF \l__zhnum_cfg_str \l__zhnum_last_cfg_str { \zhnum_update_cfg:n {#1} } \zhnum_parse_config: } \cs_generate_variant:Nn \zhnum_load_cfg:n { o } \cs_new_protected:Npn \zhnum_update_cfg:n #1 { - \prop_if_exist:cTF { g__zhnum_cfg_ \l__zhnum_cfg_tl _prop } - { \tl_set_eq:NN \l__zhnum_last_cfg_tl \l__zhnum_cfg_tl } + \prop_if_exist:cTF { g__zhnum_cfg_ \l__zhnum_cfg_str _prop } + { \str_set_eq:NN \l__zhnum_last_cfg_str \l__zhnum_cfg_str } { \zhnum_input_cfg:n {#1} } \__zhnum_update_cfg_prop:N \prop_set_eq:Nc } @@ -764,10 +763,10 @@ } \cs_new_protected:Npn \__zhnum_update_cfg_prop:N #1 { - #1 \l__zhnum_cfg_map_prop { g__zhnum_cfg_ \l__zhnum_cfg_tl _prop } - #1 \l__zhnum_cfg_map_var_prop { g__zhnum_cfg_var_ \l__zhnum_cfg_tl _prop } - #1 \l__zhnum_cfg_map_finan_prop { g__zhnum_cfg_finan_ \l__zhnum_cfg_tl _prop } - #1 \l__zhnum_cfg_map_ganzhi_prop { g__zhnum_cfg_ganzhi_ \l__zhnum_cfg_tl _prop } + #1 \l__zhnum_cfg_map_prop { g__zhnum_cfg_ \l__zhnum_cfg_str _prop } + #1 \l__zhnum_cfg_map_var_prop { g__zhnum_cfg_var_ \l__zhnum_cfg_str _prop } + #1 \l__zhnum_cfg_map_finan_prop { g__zhnum_cfg_finan_ \l__zhnum_cfg_str _prop } + #1 \l__zhnum_cfg_map_ganzhi_prop { g__zhnum_cfg_ganzhi_ \l__zhnum_cfg_str _prop } } \cs_new_protected:Npn \__zhnum_prop_initial:Nn #1#2 { @@ -776,8 +775,8 @@ } \cs_new_protected:Npn \__zhnum_prop_gset_eq:Nn #1#2 { \prop_gset_eq:cN {#2} #1 } -\tl_new:N \l__zhnum_cfg_tl -\tl_new:N \l__zhnum_last_cfg_tl +\str_new:N \l__zhnum_cfg_str +\str_new:N \l__zhnum_last_cfg_str \bool_new:N \l__zhnum_reset_bool \msg_new:nnnn { zhnumber } { file-not-found } { File~`#1'~not~found. } @@ -785,13 +784,12 @@ The~requested~file~could~not~be~found~in~the~current~directory,~ in~the~TeX~search~path~or~in~the~LaTeX~search~path. } -\pdftex_if_engine:TF +\bool_if:nTF { - \str_if_eq_x:nnTF - { \token_to_str:N \kchar } - { \token_to_meaning:N \kchar } + \sys_if_engine_xetex_p: || + \sys_if_engine_luatex_p: || + \sys_if_engine_uptex_p: } - { \use_i:nn } { \cs_new_eq:NN \zhnum_if_unicode_engine_p: \c_true_bool \cs_new_eq:NN \zhnum_if_unicode_engine:TF \use_i:nn @@ -804,8 +802,8 @@ \cs_new_eq:NN \zhnum_set_catcode: \prg_do_nothing: \cs_new_protected:Npn \zhnum_set_cfg_name:Nn #1#2 { - \tl_set:Nx \l__zhnum_encoding_tl {#2} - \tl_set:Nx #1 { \tl_to_str:N \l__zhnum_encoding_tl } + \str_set:Nx \l__zhnum_encoding_str {#2} + \str_set_eq:NN #1 \l__zhnum_encoding_str } \cs_new_eq:NN \zhnum_reset_config: \zhnum_parse_config: \else: @@ -813,7 +811,7 @@ { \bool_if:NT \l__zhnum_active_char_bool { \zhnum_set_active: } } \cs_new_protected_nopar:Npn \zhnum_set_active: { - \str_case:onTF { \l__zhnum_encoding_tl } + \str_case:onTF { \l__zhnum_encoding_str } { { gbk } { \int_set:Nn \l__zhnum_byte_min_int { "81 } } { big5 } { \int_set:Nn \l__zhnum_byte_min_int { "A1 } } @@ -831,16 +829,15 @@ \int_new:N \l__zhnum_byte_max_int \cs_new_protected:Npn \zhnum_set_cfg_name:Nn #1#2 { - \tl_set:Nx \l__zhnum_encoding_tl {#2} - \tl_set:Nx #1 + \str_set:Nx \l__zhnum_encoding_str {#2} + \str_set:Nx #1 { - \tl_to_str:N \l__zhnum_encoding_tl - \bool_if:NT \l__zhnum_active_char_bool - { \tl_to_str:n { _active } } + \l__zhnum_encoding_str + \bool_if:NT \l__zhnum_active_char_bool { _active } } } \cs_new_protected_nopar:Npn \zhnum_reset_config: - { \zhnum_load_cfg:o { \l__zhnum_encoding_tl } } + { \zhnum_load_cfg:o { \l__zhnum_encoding_str } } \bool_new:N \l__zhnum_active_char_bool \bool_set_true:N \l__zhnum_active_char_bool \fi: @@ -849,9 +846,9 @@ encoding .choices:nn = { UTF8 , GBK , Big5 } { - \exp_args:Nx \tex_lowercase:D - { \tl_set:Nn \exp_not:N \l__zhnum_encoding_tl { \l_keys_choice_tl } } - \zhnum_load_cfg:o { \l__zhnum_encoding_tl } + \str_set:Nx \l__zhnum_encoding_str + { \str_fold_case:V \l_keys_choice_tl } + \zhnum_load_cfg:o { \l__zhnum_encoding_str } } , encoding .default:n = { GBK } , encoding / Bg5 .meta:n = { encoding = Big5 } , @@ -890,7 +887,7 @@ { \cs_set_eq:NN \zhnum_ganzhi:nnn \zhnum_ganzhi_normal:nnn } , ganzhi-cyclic .default:n = { true } , } -\tl_new:N \l__zhnum_encoding_tl +\str_new:N \l__zhnum_encoding_str \msg_new:nnnn { zhnumber } { encoding-invalid } { The~encoding~`#1'~is~invalid. } { Available~encodings~are~`UTF8',~`GBK'~and~`Big5'. } @@ -901,7 +898,7 @@ } \keys_set:nn { zhnum / options } { style , time } \ProcessKeysOptions { zhnum / options } -\tl_if_empty:NT \l__zhnum_encoding_tl +\str_if_empty:NT \l__zhnum_encoding_str { \zhnum_if_unicode_engine:TF { \keys_set:nn { zhnum / options } { encoding = UTF8 } } |