Skip to content

Commit

Permalink
ctex: 设置消息模块的名字和类型
Browse files Browse the repository at this point in the history
  • Loading branch information
qinglee committed May 27, 2022
1 parent b02fcb3 commit 2799a79
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
31 changes: 20 additions & 11 deletions ctex/ctex.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ Copyright and Licence
% \changes{v2.4.15}{2019/03/23}{同步 \LaTeXiii{} 2019/03/05。}
% \changes{v2.5.1}{2020/05/02}{\pkg{zhconv} 更名为 \pkg{ctex-zhconv}。}
%
% \CheckSum{6430}
% \CheckSum{6444}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
Expand Down Expand Up @@ -3293,9 +3293,18 @@ Copyright and Licence
%<@@=ctex>
% \end{macrocode}
%
% \changes{v2.5.9}{2022/05/27}{设置消息模块的名字和类型。}
%
% \begin{macrocode}
%<*class|style>
\RequirePackage { xparse , l3keys2e }
%<class>\prop_gput:Nnn \g_msg_module_type_prop { ctex } { Class }
%<article>\prop_gput:Nnn \g_msg_module_name_prop { ctex } { ctexart }
%<book>\prop_gput:Nnn \g_msg_module_name_prop { ctex } { ctexbook }
%<report>\prop_gput:Nnn \g_msg_module_name_prop { ctex } { ctexrep }
%<beamer>\prop_gput:Nnn \g_msg_module_name_prop { ctex } { ctexbeamer }
%<ctexsize>\prop_gput:Nnn \g_msg_module_name_prop { ctex } { ctexsize }
%<ctexheading>\prop_gput:Nnn \g_msg_module_name_prop { ctex } { ctexheading }
%</class|style>
% \end{macrocode}
%
Expand Down Expand Up @@ -4551,9 +4560,9 @@ Copyright and Licence
{ \msg_critical:nnx { ctex } { luatexja-loaded } { \g_file_curr_name_str } }
{
\ctex_at_begin_package:nn { luatexja }
{ \msg_redirect_name:nnn { ctex } { disable-package } { info } }
{ \msg_redirect_name:nnn { ctexhook } { disable-package } { info } }
\ctex_at_end_package:nn { luatexja }
{ \msg_redirect_name:nnn { ctex } { disable-package } { } }
{ \msg_redirect_name:nnn { ctexhook } { disable-package } { } }
\ctex_disable_package:n { ltj-latex }
}
% \end{macrocode}
Expand Down Expand Up @@ -11573,7 +11582,7 @@ Copyright and Licence
\@ifpackageloaded {#1}
{ \msg_error:nnxx }
{ \@@_disable_package_aux:nnnn }
{ ctex } { disable-package } {#1} { \@currname }
{ ctexhook } { disable-package } {#1} { \@currname }
}
\cs_new_protected:Npx \@@_disable_package_aux:nnnn #1#2#3#4
{
Expand All @@ -11584,7 +11593,7 @@ Copyright and Licence
}
{ \tl_const:cn { ver@ #3 . \exp_not:N \@pkgextension } { 9999/99/99 } }
}
\msg_new:nnn { ctex } { disable-package }
\msg_new:nnn { ctexhook } { disable-package }
{ Package~`#1'~can~not~be~loaded~with~`#2'. }
% \end{macrocode}
% \end{macro}
Expand All @@ -11604,8 +11613,8 @@ Copyright and Licence
}
{
\cs_new_protected:Npn \ctex_replace_package:nn
{ \msg_warning:nnnn { ctex } { replace-package-invalid } }
\msg_new:nnn { ctex } { replace-package-invalid }
{ \msg_warning:nnnn { ctexhook } { replace-package-invalid } }
\msg_new:nnn { ctexhook } { replace-package-invalid }
{
\token_to_str:N \ctex_replace_package:nn \{#1\}\{#2\}~is~invalid~
before~LaTeX~2020-10-01.
Expand All @@ -11624,8 +11633,8 @@ Copyright and Licence
{ \ctex_gadd_package_hook:nnn { before } {#1} }
}
\cs_new_protected:Npn \@@_package_loaded_warning:nn #1#2
{ \msg_warning:nnx { ctex } { invalid-hook } {#1} }
\msg_new:nnn { ctex } { invalid-hook }
{ \msg_warning:nnx { ctexhook } { invalid-hook } {#1} }
\msg_new:nnn { ctexhook } { invalid-hook }
{
Package~`#1'~is~loaded. \\
\token_to_str:N \ctex_at_begin_package:nn \{#1\}\{...\}~is~invalid.
Expand Down Expand Up @@ -11798,8 +11807,8 @@ Copyright and Licence
{ \ctex_patch_failure:N #1 }
}
\cs_new_protected:Npn \ctex_patch_failure:N #1
{ \msg_warning:nnx { ctex } { patch-failure } { \token_to_str:N #1 } }
\msg_new:nnn { ctex } { patch-failure }
{ \msg_warning:nnx { ctexpatch } { patch-failure } { \token_to_str:N #1 } }
\msg_new:nnn { ctexpatch } { patch-failure }
{ Oops!~Command~`#1'~is~NOT~patchable.\\ }
% \end{macrocode}
% \end{macro}
Expand Down
5 changes: 3 additions & 2 deletions ctex/test/testfiles/ctexhook.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ Author: Xiangdong Zeng
============================================================
TEST 1: Package hook
============================================================
Package ctex Warning: Package `indentfirst' is loaded.
(ctex) \ctex_at_begin_package:nn{indentfirst}{...} is invalid.
Package ctexhook Warning: Package `indentfirst' is loaded.
(ctexhook) \ctex_at_begin_package:nn{indentfirst}{...} is
(ctexhook) invalid.
End hook: indentfirst
Begin hook: somedefs
(../somedefs.sty)
Expand Down
6 changes: 3 additions & 3 deletions ctex/test/testfiles/space.luatex.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Author: Xiangdong Zeng
============================================================
TEST 1: space = true
============================================================
Package ctex Warning: Option `space' is invalid in current mode.
Class ctexart Warning: Option `space' is invalid in current mode.
(load cache: extra_lmromanslant10-regular.luc)
LaTeX Font Info: Font shape `LTJY3/FandolSong-Regular(0)/m/sl' in size <10.53937> not available
(Font) Font shape `LTJY3/FandolSong-Regular(0)/m/it' tried instead on input line ....
Expand Down Expand Up @@ -124,7 +124,7 @@ Completed box being shipped out [1]
============================================================
TEST 2: space = false
============================================================
Package ctex Warning: Option `space' is invalid in current mode.
Class ctexart Warning: Option `space' is invalid in current mode.
Completed box being shipped out [2]
\vbox(633.0+0.0)x407.0, direction TLT
.\whatsit4=[]
Expand Down Expand Up @@ -241,7 +241,7 @@ Completed box being shipped out [2]
============================================================
TEST 3: space = auto
============================================================
Package ctex Warning: Option `space' is invalid in current mode.
Class ctexart Warning: Option `space' is invalid in current mode.
Completed box being shipped out [3]
\vbox(633.0+0.0)x407.0, direction TLT
.\whatsit4=[]
Expand Down
6 changes: 3 additions & 3 deletions ctex/test/testfiles/space.uptex.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Author: Xiangdong Zeng
============================================================
TEST 1: space = true
============================================================
Package ctex Warning: Option `space' is invalid in current mode.
Class ctexart Warning: Option `space' is invalid in current mode.
LaTeX Font Warning: Font shape `JY2/zhrm/m/sl' undefined
(Font) using `JY2/zhrm/m/it' instead on input line ....
Completed box being shipped out [1]
Expand Down Expand Up @@ -85,7 +85,7 @@ Completed box being shipped out [1]
============================================================
TEST 2: space = false
============================================================
Package ctex Warning: Option `space' is invalid in current mode.
Class ctexart Warning: Option `space' is invalid in current mode.
LaTeX Font Warning: Font shape `JY2/zhrm/m/sl' undefined
(Font) using `JY2/zhrm/m/it' instead on input line ....
Completed box being shipped out [2]
Expand Down Expand Up @@ -152,7 +152,7 @@ Completed box being shipped out [2]
============================================================
TEST 3: space = auto
============================================================
Package ctex Warning: Option `space' is invalid in current mode.
Class ctexart Warning: Option `space' is invalid in current mode.
LaTeX Font Warning: Font shape `JY2/zhrm/m/sl' undefined
(Font) using `JY2/zhrm/m/it' instead on input line ....
Completed box being shipped out [3]
Expand Down

0 comments on commit 2799a79

Please sign in to comment.