diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/zhlipsum')
4 files changed, 88 insertions, 103 deletions
diff --git a/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum-big5.def b/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum-big5.def index ee72622a1aa..4a9e4740241 100644 --- a/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum-big5.def +++ b/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum-big5.def @@ -7,7 +7,7 @@ %% zhlipsum.dtx (with options: `text,big5') %% zhlipsum-text.dtx (with options: `text,big5') %% -%% Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com> +%% Copyright (C) 2017--2020 by Xiangdong Zeng <xdzeng96@gmail.com> %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -35,7 +35,7 @@ %% zhlipsum-en.pdf, %% and README.md. %% -\GetIdInfo $Id: zhlipsum.dtx 1.1.1 2018-09-08 12:00:00Z Xiangdong Zeng <xdzeng96@gmail.com> $ +\GetIdInfo $Id: zhlipsum.dtx 1.2.0 2020-04-10 12:00:00Z Xiangdong Zeng <xdzeng96@gmail.com> $ {Chinese dummy text with Big5 encoding (for zhlipsum)} \ProvidesExplFile{\ExplFileName-big5.def} {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} diff --git a/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum-gbk.def b/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum-gbk.def index 463520f8d2f..c177e08dff9 100644 --- a/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum-gbk.def +++ b/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum-gbk.def @@ -7,7 +7,7 @@ %% zhlipsum.dtx (with options: `text,gbk') %% zhlipsum-text.dtx (with options: `text,gbk') %% -%% Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com> +%% Copyright (C) 2017--2020 by Xiangdong Zeng <xdzeng96@gmail.com> %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -35,7 +35,7 @@ %% zhlipsum-en.pdf, %% and README.md. %% -\GetIdInfo $Id: zhlipsum.dtx 1.1.1 2018-09-08 12:00:00Z Xiangdong Zeng <xdzeng96@gmail.com> $ +\GetIdInfo $Id: zhlipsum.dtx 1.2.0 2020-04-10 12:00:00Z Xiangdong Zeng <xdzeng96@gmail.com> $ {Chinese dummy text with GBK encoding (for zhlipsum)} \ProvidesExplFile{\ExplFileName-gbk.def} {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} diff --git a/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum-utf8.def b/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum-utf8.def index c4a7538a23b..e9d35bd1b54 100644 --- a/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum-utf8.def +++ b/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum-utf8.def @@ -7,7 +7,7 @@ %% zhlipsum.dtx (with options: `text,utf8') %% zhlipsum-text.dtx (with options: `text,utf8') %% -%% Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com> +%% Copyright (C) 2017--2020 by Xiangdong Zeng <xdzeng96@gmail.com> %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -35,7 +35,7 @@ %% zhlipsum-en.pdf, %% and README.md. %% -\GetIdInfo $Id: zhlipsum.dtx 1.1.1 2018-09-08 12:00:00Z Xiangdong Zeng <xdzeng96@gmail.com> $ +\GetIdInfo $Id: zhlipsum.dtx 1.2.0 2020-04-10 12:00:00Z Xiangdong Zeng <xdzeng96@gmail.com> $ {Chinese dummy text with UTF-8 encoding (for zhlipsum)} \ProvidesExplFile{\ExplFileName-utf8.def} {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} diff --git a/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum.sty b/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum.sty index ff08b730cb1..83b68f21ff2 100644 --- a/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum.sty +++ b/Master/texmf-dist/tex/latex/zhlipsum/zhlipsum.sty @@ -6,7 +6,7 @@ %% %% zhlipsum.dtx (with options: `package') %% -%% Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com> +%% Copyright (C) 2017--2020 by Xiangdong Zeng <xdzeng96@gmail.com> %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -36,7 +36,7 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo $Id: zhlipsum.dtx 1.1.1 2018-09-08 12:00:00Z Xiangdong Zeng <xdzeng96@gmail.com> $ +\GetIdInfo $Id: zhlipsum.dtx 1.2.0 2020-04-10 12:00:00Z Xiangdong Zeng <xdzeng96@gmail.com> $ {Chinese dummy text} \ProvidesExplPackage{\ExplFileName} {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -56,100 +56,96 @@ \tl_new:N \l__zhlipsum_tmpa_tl \seq_new:N \l__zhlipsum_tmpa_seq \seq_new:N \l__zhlipsum_tmpb_seq -\tl_new:N \g__zhlipsum_encoding_tl +\str_new:N \l__zhlipsum_tmpa_str \seq_new:N \g_zhlipsum_seq -\seq_new:N \c_zhlipsum_simp_seq -\seq_new:N \c_zhlipsum_trad_seq -\seq_set_from_clist:Nn \c_zhlipsum_simp_seq { simp, zhufu, aspirin } -\seq_set_from_clist:Nn \c_zhlipsum_trad_seq { trad, xiangyu, nanshanjing } +\seq_const_from_clist:Nn \c_zhlipsum_simp_seq { simp, zhufu, aspirin } +\seq_const_from_clist:Nn \c_zhlipsum_trad_seq { trad, xiangyu, nanshanjing } \cs_generate_variant:Nn \file_input:n { x } -\prg_generate_conditional_variant:Nnn \tl_if_eq:nn { Vn } { T, TF } -\prg_new_protected_conditional:Npnn \__zhlipsum_if_unicode_engine: { T, F, TF } +\prg_new_conditional:Npnn \__zhlipsum_if_unicode_engine: { T, F, TF } { \bool_lazy_any:nTF { - { \sys_if_engine_xetex_p: } - { \sys_if_engine_luatex_p: } - { \sys_if_engine_uptex_p: } + \sys_if_engine_xetex_p: + \sys_if_engine_luatex_p: + \sys_if_engine_uptex_p: } - { \prg_return_true: } - { \prg_return_false: } + { \prg_return_true: } { \prg_return_false: } } -\prg_new_protected_conditional:Npnn \__zhlipsum_if_encoding:n #1 { T, F, TF } +\prg_new_conditional:Npnn \__zhlipsum_if_encoding:n #1 { T, F, TF } { - \tl_if_eq:VnTF \g__zhlipsum_encoding_tl {#1} + \str_if_eq:VnTF \g__zhlipsum_encoding_str {#1} { \prg_return_true: } { \prg_return_false: } } +\prg_generate_conditional_variant:Nnn \__zhlipsum_if_encoding:n { V } { T, F, TF } +\str_new:N \g__zhlipsum_encoding_str \cs_new:Npn \__zhlipsum_msg_new:nn { \msg_new:nnn { zhlipsum } } \cs_new:Npn \__zhlipsum_error:n { \msg_error:nn { zhlipsum } } \cs_new:Npn \__zhlipsum_error:nn { \msg_error:nnn { zhlipsum } } +\cs_new:Npn \__zhlipsum_warning:n { \msg_warning:nn { zhlipsum } } \cs_new:Npn \__zhlipsum_warning:nn { \msg_warning:nnn { zhlipsum } } \cs_new:Npn \__zhlipsum_warning:nnn { \msg_warning:nnnn { zhlipsum } } \cs_new:Npn \__zhlipsum_warning:nxxx { \msg_warning:nnxxx { zhlipsum } } \cs_new:Npn \__zhlipsum_info:nn { \msg_info:nnn { zhlipsum } } -\cs_new_eq:NN \__zhlipsum_par: \tex_par:D \keys_define:nn { zhlipsum / option } { encoding .choices:nn = { utf8, gbk, big5 } - { - \tl_gset_eq:NN \g__zhlipsum_encoding_tl \l_keys_choice_tl - \__zhlipsum_if_unicode_engine:T - { - \__zhlipsum_if_encoding:nF { utf8 } - { - \tl_gset:Nn \g__zhlipsum_encoding_tl { utf8 } - \__zhlipsum_warning:nn { unicode-engine } {#1} - } - } - \__zhlipsum_if_ctex_valid_encoding:F - { \__zhlipsum_error:nn { ctex-invalid-encoding } {#1} } - }, + { \str_gset:Nn \g__zhlipsum_encoding_str {#1} }, encoding / unknown .code:n = { \__zhlipsum_error:nn { invalid-encoding } {#1} }, encoding .value_required:n = true, unknown .code:n = { \__zhlipsum_error:n { unknown-option } } } -\__zhlipsum_msg_new:nn { unicode-engine } +\__zhlipsum_msg_new:nn { invalid-encoding } { - You~ are~ now~ using~ Unicode~ engine~ \c_sys_engine_str. \\ - Encoding~ "#1"~ is~ invalid.~ Changed~ into~ "utf8". + Encoding~"#1"~is~invalid. \\ + Available~encodings~are~"utf8",~"gbk"~and~"big5". } -\__zhlipsum_msg_new:nn { ctex-invalid-encoding } +\__zhlipsum_msg_new:nn { unknown-option } + { Package~option~'\l_keys_key_tl'~is~unknown. } +\cs_new_protected:Npn \__zhlipsum_check_unicode_engine_encoding: { - Package~ option~ "encoding=#1"~ is~ in~ conflict~ with~ ctex's~ - option~ "\tl_use:N \l__ctex_encoding_tl".\\\\ - Please~ check~ the~ package~ options. + \__zhlipsum_if_unicode_engine:T + { + \str_if_empty:NF \g__zhlipsum_encoding_str + { + \__zhlipsum_if_encoding:nF { utf8 } + { \__zhlipsum_warning:n { unicode-engine } } + } + \str_gset:Nn \g__zhlipsum_encoding_str { utf8 } + } } -\__zhlipsum_msg_new:nn { invalid-encoding } +\__zhlipsum_msg_new:nn { unicode-engine } { - Encoding~ "#1"~ is~ invalid. \\ - Available~ encodings~ are~ "utf8",~ "gbk"~ and~ "big5". + You~are~now~using~Unicode~engine~\c_sys_engine_str\c_space_tl~so~ + encoding~"\g__zhlipsum_encoding_str"~is~invalid. \\ + Changed~into~"utf8". } -\__zhlipsum_msg_new:nn { unknown-option } - { Package~ option~ "\l_keys_key_tl"~ is~ unknown. } -\prg_new_protected_conditional:Npnn \__zhlipsum_if_ctex_valid_encoding: { F } +\cs_new_protected:Npn \__zhlipsum_check_ctex_encoding: { - \tl_if_exist:NTF \l__ctex_encoding_tl + \tl_if_exist:NT \l__ctex_encoding_tl { - \tl_set:Nx \l__zhlipsum_tmpa_tl + \str_set:Nx \l__zhlipsum_tmpa_str { \str_lower_case:f { \l__ctex_encoding_tl } } - \str_if_eq:NNTF \g__zhlipsum_encoding_tl \l__zhlipsum_tmpa_tl - { \prg_return_true: } { \prg_return_false: } + \str_if_empty:NF \g__zhlipsum_encoding_str + { + \__zhlipsum_if_encoding:VF \l__zhlipsum_tmpa_str + { \__zhlipsum_warning:n { ctex-encoding-conflict } } + } + \str_gset_eq:NN \g__zhlipsum_encoding_str \l__zhlipsum_tmpa_str } - { \prg_return_true: } } -\tl_if_exist:NTF \l__ctex_encoding_tl +\__zhlipsum_msg_new:nn { ctex-encoding-conflict } { - \tl_if_eq:VnTF \l__ctex_encoding_tl { UTF8 } - { \tl_gset:Nn \g__zhlipsum_encoding_tl { utf8 } } - { - \tl_if_eq:VnT \l__ctex_encoding_tl { GBK } - { \tl_gset:Nn \g__zhlipsum_encoding_tl { gbk } } - } + Package~option~"encoding=\g__zhlipsum_encoding_str"~is~in~conflict~with~ + ctex's~option~"\l__ctex_encoding_tl". \\ + Changed~into~"encoding=\l__zhlipsum_tmpa_str". } - { \tl_gset:Nn \g__zhlipsum_encoding_tl { utf8 } } \ProcessKeysOptions { zhlipsum / option } +\__zhlipsum_check_unicode_engine_encoding: +\__zhlipsum_check_ctex_encoding: +\str_if_empty:NT \g__zhlipsum_encoding_str + { \str_gset:Nn \g__zhlipsum_encoding_str { utf8 } } \tl_new:N \l__zhlipsum_name_tl \tl_new:N \l__zhlipsum_before_tl \tl_new:N \l__zhlipsum_after_tl @@ -193,14 +189,14 @@ \group_begin: \IfBooleanF {#1} { - \tl_set:Nn \l__zhlipsum_before_tl { \__zhlipsum_par: } - \tl_set:Nn \l__zhlipsum_after_tl { \__zhlipsum_par: } - \tl_set:Nn \l__zhlipsum_inter_tl { \__zhlipsum_par: } + \tl_set:Nn \l__zhlipsum_before_tl { } + \tl_set:Nn \l__zhlipsum_after_tl { \par } + \tl_set:Nn \l__zhlipsum_inter_tl { \par } } \IfValueTF {#3} { \keys_set:nn { zhlipsum } {#3} - \zhlipsum_use:Vn \l__zhlipsum_name_tl {#2} + \__zhlipsum:n {#2} } { \IfValueTF {#2} @@ -208,19 +204,18 @@ \__zhlipsum_if_key_value_list:nTF {#2} { \keys_set:nn { zhlipsum } {#2} - \zhlipsum_use:Vn \l__zhlipsum_name_tl { 1 - 3 } + \__zhlipsum:n { 1 - 3 } } - { \zhlipsum_use:Vn \l__zhlipsum_name_tl {#2} } + { \__zhlipsum:n {#2} } } - { \zhlipsum_use:Vn \l__zhlipsum_name_tl { 1 - 3 } } + { \__zhlipsum:n { 1 - 3 } } } \group_end: } -\prg_new_protected_conditional:Npnn \__zhlipsum_if_key_value_list:n #1 { TF } - { - \tl_if_in:nnTF {#1} { = } - { \prg_return_true: } { \prg_return_false: } - } +\cs_new_protected:Npn \__zhlipsum:n #1 + { \exp_args:No \zhlipsum_use:nn { \l__zhlipsum_name_tl } {#1} } +\cs_new_protected:Npn \__zhlipsum_if_key_value_list:nTF #1 + { \tl_if_in:nnTF {#1} {=} } \seq_new:N \l__zhlipsum_par_num_seq \cs_new_protected:Npn \zhlipsum_use:nn #1#2 { @@ -229,57 +224,47 @@ \zhlipsum_if_exist:nTF {#1} { \__zhlipsum_parse_par:nn {#1} {#2} - \seq_pop_right:NN \l__zhlipsum_par_num_seq \l__zhlipsum_tmpa_tl - \tl_use:N \l__zhlipsum_before_tl - \seq_map_inline:Nn \l__zhlipsum_par_num_seq + \seq_if_empty:NF \l__zhlipsum_par_num_seq { - \__zhlipsum_use:nn {#1} {##1} - \tl_use:N \l__zhlipsum_inter_tl + \seq_pop_right:NN \l__zhlipsum_par_num_seq \l__zhlipsum_tmpa_tl + \l__zhlipsum_before_tl + \seq_map_inline:Nn \l__zhlipsum_par_num_seq + { + \__zhlipsum_use:nn {#1} {##1} + \l__zhlipsum_inter_tl + } + \__zhlipsum_use:nn {#1} { \l__zhlipsum_tmpa_tl } + \l__zhlipsum_after_tl } - \__zhlipsum_use:nn {#1} { \tl_use:N \l__zhlipsum_tmpa_tl } - \tl_use:N \l__zhlipsum_after_tl } { \__zhlipsum_error:nn { invalid-name } {#1} } } { \__zhlipsum_error:n { CJK-invalid-encoding } } } -\cs_generate_variant:Nn \zhlipsum_use:nn { Vn } \__zhlipsum_msg_new:nn { invalid-name } { - Name~ "#1"~ is~ unknown. \\\\ + Name~ "#1"~ is~ unknown. \\ Please~ use~ the~ pre-defined~ Chinese~ dummy~ texts~ or~ declare~ new~ one. } \__zhlipsum_msg_new:nn { CJK-invalid-encoding } { - The~ current~ CJK~ environment~ uses~ "\tl_use:N \CJK@@@enc"~ - encoding,\\ + The~ current~ CJK~ environment~ uses~ "\CJK@@@enc"~ encoding,~ but~ zhlipsum~ package~ has~ been~ loaded~ with~ the~ option~ - "encoding=\tl_use:N \g__zhlipsum_encoding_tl".\\\\ + "encoding=\g__zhlipsum_encoding_str". \\ Please~ check~ the~ package~ options. } \prg_new_protected_conditional:Npnn \__zhlipsum_if_cjk_valid_encoding: { TF } { \tl_if_exist:NTF \CJK@@@enc { - \tl_set:Nx \l__zhlipsum_tmpa_tl { \str_lower_case:f { \CJK@@@enc } } - \str_if_eq:NNTF \g__zhlipsum_encoding_tl \l__zhlipsum_tmpa_tl - { \prg_return_true: } + \exp_args:NV \str_case:nn \g__zhlipsum_encoding_str { - \__zhlipsum_if_encoding:nTF { gbk } - { - \str_if_eq:VnTF \l__zhlipsum_tmpa_tl { gb } - { \prg_return_true: } { \prg_return_false: } - } - { - \__zhlipsum_if_encoding:nTF { big5 } - { - \str_if_eq:VnTF \l__zhlipsum_tmpa_tl { bg5 } - { \prg_return_true: } { \prg_return_false: } - } - { \prg_return_false: } - } + { utf8 } { \str_if_eq:VnTF \CJK@@@enc { UTF8 } } + { gbk } { \str_if_in:NnTF \CJK@@@enc { GB } } + { big5 } { \str_if_eq:VnTF \CJK@@@enc { Bg5 } } } + { \prg_return_true: } { \prg_return_false: } } { \prg_return_true: } } @@ -408,7 +393,7 @@ \tl_const:cn { c__zhlipsum_ #1 @ \int_use:c { g__zhlipsum_ #1 _int } _tl } {#2} } -\file_input:x { zhlipsum- \g__zhlipsum_encoding_tl .def } +\file_input:x { zhlipsum- \g__zhlipsum_encoding_str .def } \endinput %% %% End of file `zhlipsum.sty'. |