Skip to content

Commit

Permalink
Enable case switching in titlecase-first (fixes #1130)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Sep 28, 2022
1 parent cfc1525 commit 975af0d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions l3kernel/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ this project uses date-based 'snapshot' version identifiers.
### Added
- Set media box for test phase documents

### Fixed
- Text case switching in `\text_titlecase_first:n` (issue
[\#1130](https://github.com/latex3/latex3/issues/1130))

## [2022-08-30]

### Added
Expand Down
8 changes: 7 additions & 1 deletion l3kernel/l3text-case.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@
% {
% \@@_change_case_switch_lower:nnNnnnn ,
% \@@_change_case_switch_upper:nnNnnnn ,
% \@@_change_case_switch_title:nnNnnnn
% \@@_change_case_switch_title:nnNnnnn ,
% \@@_change_case_switch_titleonly:nnNnnnn
% }
% \begin{macro}[EXP]
% {
Expand Down Expand Up @@ -518,6 +519,11 @@
\@@_change_case_store:n {#7}
\@@_change_case_loop:nnw {#1} {#2}
}
\cs_new:Npn \@@_change_case_switch_titleonly:nnNnnnn #1#2#3#4#5#6#7
{
\@@_change_case_store:n {#7}
\@@_change_case_break:w
}
% \end{macrocode}
% Letter-like commands may still be present: they are set up using a simple
% lookup approach, so can easily be handled with no loop. If there is no
Expand Down
3 changes: 2 additions & 1 deletion l3kernel/testfiles/m3text002.lvt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%
% Copyright (C) 2020,2021 The LaTeX Project
% Copyright (C) 2020-2022 The LaTeX Project
%
\input{regression-test}

Expand Down Expand Up @@ -374,6 +374,7 @@
\text_uppercase:n {#1} \NEWLINE
\text_lowercase:n {#1} \NEWLINE
\text_titlecase:n {#1} \NEWLINE
\text_titlecase_first:n {#1} \NEWLINE
}

\TESTEXP { Case~change~switching }
Expand Down
2 changes: 2 additions & 0 deletions l3kernel/testfiles/m3text002.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,11 @@ TEST 30: Case change switching
lower
UPPER
Title
Title
WORDS lower
words UPPER
Words UPPER
Words \text_case_switch:nnnn {normal}{lower}{UPPER}{Title}
============================================================
============================================================
TEST 31: Case change replacements
Expand Down

0 comments on commit 975af0d

Please sign in to comment.