Skip to content

Commit

Permalink
xeCJK: 应用 \peek_remove_spaces:n
Browse files Browse the repository at this point in the history
  • Loading branch information
qinglee committed Feb 10, 2020
1 parent fd80776 commit 7a632fb
Showing 1 changed file with 10 additions and 31 deletions.
41 changes: 10 additions & 31 deletions xeCJK/xeCJK.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ Copyright and Licence
% \changes{v3.8.0}{2020/02/09}{兼容 \LaTeXe\ 2020/02/02 对 \pkg{NFSS} 的修改。}
% \changes{v3.8.0}{2020/02/09}{清理过时的兼容性补丁代码。}
%
% \CheckSum{10770}
% \CheckSum{10754}
% \GetFileId{xeCJK.sty}
%
% \title{\bfseries\pkg{xeCJK} 宏包}
Expand Down Expand Up @@ -1979,8 +1979,10 @@ Copyright and Licence
\cs_new_protected:Npn \xeCJK_peek_catcode_ignore_spaces:NTF #1#2#3
{
\cs_set_eq:NN \l_@@_peek_search_token #1 \scan_stop:
\tl_set:Nn \@@_peek_catcode_true:w { \group_align_safe_end: #2 }
\tl_set:Nn \@@_peek_catcode_false:w { \group_align_safe_end: #3 }
\cs_set_protected:Npx \@@_peek_catcode_true:w
{ \exp_not:N \group_align_safe_end: \exp_not:n {#2} }
\cs_set_protected:Npx \@@_peek_catcode_false:w
{ \exp_not:N \group_align_safe_end: \exp_not:n {#3} }
\bool_set_false:N \l_@@_peek_ignore_spaces_bool
\group_align_safe_begin:
\peek_after:Nw \@@_peek_catcode_ignore_spaces_branches:w
Expand All @@ -2004,33 +2006,13 @@ Copyright and Licence
\fi:
}
\cs_new_eq:NN \l_@@_peek_search_token ?
\tl_new:N \@@_peek_catcode_true:w
\tl_new:N \@@_peek_catcode_false:w
\cs_new_eq:NN \@@_peek_catcode_true:w \prg_do_nothing:
\cs_new_eq:NN \@@_peek_catcode_false:w \prg_do_nothing:
\bool_new:N \l_@@_peek_ignore_spaces_bool
% \end{macrocode}
% \end{macro}
%
% \begin{macro}[int]{\xeCJK_peek_after_ignore_spaces:nw}
% 与 \tn{@ifnextchar} 和 \tn{futurenonspacelet} 类似,会省略掉后面的空格。
% \begin{macrocode}
\cs_new_protected:Npn \xeCJK_peek_after_ignore_spaces:nw #1
{
\tl_set:Nn \@@_peek_after_do:w { \group_align_safe_end: #1 }
\group_align_safe_begin:
\peek_after:Nw \@@_peek_ignore_spaces_branches:w
}
\cs_new_protected_nopar:Npn \@@_peek_ignore_spaces_branches:w
{
\if_meaning:w \l_peek_token \c_space_token
\exp_after:wN \peek_after:Nw
\exp_after:wN \@@_peek_ignore_spaces_branches:w
\tex_romannumeral:D 0
\else:
\exp_after:wN \@@_peek_after_do:w
\fi:
}
% \end{macrocode}
% \end{macro}
% \changes{v3.8.0}{2020/02/10}{应用 \cs{peek_remove_spaces:n}。}
%
% \begin{macro}[int]{\xeCJK_token_value_class:N}
% 用于取得记号 |#1| 所在的 \XeTeX 字符类。|#1| 应为 \tn{catcode} 为 |11| 或 |12|
Expand Down Expand Up @@ -4552,10 +4534,7 @@ Copyright and Licence
% \begin{macro}[int]{\xeCJK_check_FullRight_symbol:Nw}
% \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_check_FullRight_symbol:Nw #1
{
\xeCJK_peek_after_ignore_spaces:nw
{ \@@_save_FullRight_symbol:N #1 }
}
{ \peek_remove_spaces:n { \@@_save_FullRight_symbol:N #1 } }
% \end{macrocode}
% \end{macro}
%
Expand Down Expand Up @@ -7854,7 +7833,7 @@ Copyright and Licence
}
\cs_new_protected_nopar:Npn \@@_set_visible_space_size:n #1
{
\fontencoding { \g_fontspec_encoding_tl }
\fontencoding { \UnicodeEncodingName }
\tl_set:Nn \f@family { lmtt }
\selectfont
\dim_compare:nNnF {#1} = { \tex_fontdimen:D 2 ~ \tex_font:D }
Expand Down

0 comments on commit 7a632fb

Please sign in to comment.