Skip to content

Commit

Permalink
Handle accents separately from other case exlcusiosn
Browse files Browse the repository at this point in the history
See #946.
  • Loading branch information
josephwright committed Jun 14, 2021
1 parent 6c1b648 commit e31bb39
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
2 changes: 2 additions & 0 deletions l3kernel/CHANGELOG.md
Expand Up @@ -11,6 +11,8 @@ this project uses date-based 'snapshot' version identifiers.
- Local assignment to `\g__sys_backend_tl`
- Incorrect internal function name (issue #939)
- Case-changing exceptions for (u)pTeX (issue #939)
- Low-level error if accent commands are not followed by
letter when case changing (see #946)

## [2021-06-01]

Expand Down
33 changes: 29 additions & 4 deletions l3kernel/l3text.dtx
Expand Up @@ -625,6 +625,8 @@
% \begin{macro}[EXP]{\@@_expand_exclude:nN}
% \begin{macro}[EXP]{\@@_expand_exclude:NN}
% \begin{macro}[EXP]{\@@_expand_exclude:Nn}
% \begin{macro}[EXP]{\@@_expand_accent:N}
% \begin{macro}[EXP]{\@@_expand_accent:NN}
% \begin{macro}[EXP]{\@@_expand_letterlike:N}
% \begin{macro}[EXP]{\@@_expand_letterlike:NN}
% \begin{macro}[EXP]{\@@_expand_cs:N, \@@_expand_encoding:N}
Expand Down Expand Up @@ -858,15 +860,13 @@
}
% \end{macrocode}
% Next we exclude math commands: this is mainly as there \emph{might} be an
% \cs{ensuremath}. We also handle accents, which are basically the same issue
% but are kept separate for semantic reasons.
% \cs{ensuremath}.
% \begin{macrocode}
\cs_new:Npn \@@_expand_exclude:N #1
{
\exp_args:Ne \@@_expand_exclude:nN
{
\exp_not:V \l_text_math_arg_tl
\exp_not:V \l_text_accents_tl
\exp_not:V \l_text_expand_exclude_tl
}
#1
Expand All @@ -879,7 +879,7 @@
\cs_new:Npn \@@_expand_exclude:NN #1#2
{
\@@_if_recursion_tail_stop_do:Nn #2
{ \@@_expand_letterlike:N #1 }
{ \@@_expand_accent:N #1 }
\str_if_eq:nnTF {#1} {#2}
{
\@@_use_i_delimit_by_q_recursion_stop:nw
Expand All @@ -893,6 +893,29 @@
\@@_expand_loop:w
}
% \end{macrocode}
% Accents.
% \begin{macrocode}
\cs_new:Npn \@@_expand_accent:N #1
{
\exp_after:wN \@@_expand_accent:NN \exp_after:wN
#1 \l_text_accents_tl
\q_@@_recursion_tail \q_@@_recursion_stop
}
\cs_new:Npn \@@_expand_accent:NN #1#2
{
\@@_if_recursion_tail_stop_do:Nn #2
{ \@@_expand_letterlike:N #1 }
\cs_if_eq:NNTF #2 #1
{
\@@_use_i_delimit_by_q_recursion_stop:nw
{
\@@_expand_store:n {#1}
\@@_expand_loop:w
}
}
{ \@@_expand_accent:NN #1 }
}
% \end{macrocode}
% Another list of exceptions: these ones take no arguments so are
% easier to handle.
% \begin{macrocode}
Expand Down Expand Up @@ -1091,6 +1114,8 @@
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}
% {
Expand Down

0 comments on commit e31bb39

Please sign in to comment.