summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3kernel/l3unicode.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3unicode.dtx')
-rw-r--r--macros/latex/contrib/l3kernel/l3unicode.dtx71
1 files changed, 46 insertions, 25 deletions
diff --git a/macros/latex/contrib/l3kernel/l3unicode.dtx b/macros/latex/contrib/l3kernel/l3unicode.dtx
index 9eb3d9747a..383826eaeb 100644
--- a/macros/latex/contrib/l3kernel/l3unicode.dtx
+++ b/macros/latex/contrib/l3kernel/l3unicode.dtx
@@ -2,7 +2,7 @@
%
%% File: l3unicode.dtx
%
-% Copyright (C) 2018-2019 The LaTeX3 Project
+% Copyright (C) 2018-2020 The LaTeX3 Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2019-11-07}
+% \date{Released 2020-01-12}
%
% \maketitle
%
@@ -116,35 +116,56 @@
}
}
% \end{macrocode}
-% Parse the main Unicode data file for title case exceptions (the one-to-one
-% lower and upper case mappings it contains are all be covered by the \TeX{}
-% data). There are no comments in the main data file so this can be done using
-% a standard mapping and no checks.
+% Parse the main Unicode data file for two things. First, we want the titlecase
+% exceptions: the one-to-one lower- and uppercase mappings it contains are all
+% be covered by the \TeX{} data. Second, we need normalization data: at present,
+% just the canonical \textsc{nfd} mappings. Those all yield either one or two
+% codepoints, so the split is relatively easy.
% \begin{macrocode}
\ior_open:Nn \g_@@_data_ior { UnicodeData.txt }
\cs_set_protected:Npn \@@_data_auxi:w
#1 ; #2 ; #3 ; #4 ; #5 ; #6 ; #7 ; #8 ; #9 ;
- { \@@_data_auxii:w #1 ; }
- \cs_set_protected:Npn \@@_data_auxii:w
- #1 ; #2 ; #3 ; #4 ; #5 ; #6 ; #7 \q_stop
+ {
+ \tl_if_blank:nF {#6}
+ {
+ \tl_if_head_eq_charcode:nNF {#6} < % >
+ { \@@_data_auxii:w #1 ; #6 ~ \q_stop }
+ }
+ \@@_data_auxiii:w #1 ;
+ }
+ \cs_set_protected:Npn \@@_data_auxii:w #1 ; #2 ~ #3 \q_stop
+ {
+ \tl_const:cx
+ { c_@@_nfd_ \@@_generate_char:n {#1} _tl }
+ {
+ \@@_generate:n { "#2 }
+ \tl_if_blank:nF {#3}
+ { \@@_generate:n { "#3 } }
+ }
+ }
+ \cs_set_protected:Npn \@@_data_auxiii:w
+ #1 ; #2 ; #3 ; #4 ; #5 ; #6 ; #7 ~ \q_stop
{
\cs_set_nopar:Npn \l_@@_tmpa_tl {#7}
\reverse_if:N \if_meaning:w \l_@@_tmpa_tl \c_empty_tl
\cs_set_nopar:Npn \l_@@_tmpb_tl {#5}
\reverse_if:N \if_meaning:w \l_@@_tmpa_tl \l_@@_tmpb_tl
\tl_const:cx
- { c_@@_mixed_case_ \@@_generate_char:n {#1} _tl }
+ { c_@@_titlecase_ \@@_generate_char:n {#1} _tl }
{ \@@_generate:n { "#7 } }
\fi:
\fi:
}
- \ior_map_variable:NNn \g_@@_data_ior \l_@@_tmpa_tl
- {
- \if_meaning:w \l_@@_tmpa_tl \c_space_tl
- \exp_after:wN \ior_map_break:
- \fi:
- \exp_after:wN \@@_data_auxi:w \l_@@_tmpa_tl \q_stop
- }
+ \group_begin:
+ \char_set_catcode_space:n { `\ }%
+ \ior_map_variable:NNn \g_@@_data_ior \l_@@_tmpa_tl
+ {%
+ \if_meaning:w \l_@@_tmpa_tl \c_space_tl
+ \exp_after:wN \ior_map_break:
+ \fi:
+ \exp_after:wN \@@_data_auxi:w \l_@@_tmpa_tl \q_stop
+ }%
+ \group_end:
\ior_close:N \g_@@_data_ior
% \end{macrocode}
% The other data files all use C-style comments so we have to worry about
@@ -161,7 +182,7 @@
\reverse_if:N \if_int_compare:w
\char_value_lccode:n {"#1} = "#3 ~
\tl_const:cx
- { c_@@_fold_case_ \@@_generate_char:n {#1} _tl }
+ { c_@@_foldcase_ \@@_generate_char:n {#1} _tl }
{ \@@_generate:n { "#3 } }
\fi:
\else:
@@ -172,7 +193,7 @@
}
\cs_set_protected:Npn \@@_data_auxii:w #1 ~ #2 ~ #3 ~ #4 \q_stop
{
- \tl_const:cx { c_@@_fold_case_ \@@_generate_char:n {#1} _tl }
+ \tl_const:cx { c_@@_foldcase_ \@@_generate_char:n {#1} _tl }
{
\@@_generate:n { "#2 }
\@@_generate:n { "#3 }
@@ -188,7 +209,7 @@
}
\ior_close:N \g_@@_data_ior
% \end{macrocode}
-% For upper and lower casing special situations, there is a bit more to
+% For upper- and lowercasing special situations, there is a bit more to
% do as we also have title casing to consider, plus we need to stop part-way
% through the file.
% \begin{macrocode}
@@ -199,14 +220,14 @@
\use:n { \@@_data_auxii:w #1 ~ lower ~ #2 ~ } ~ \q_stop
\use:n { \@@_data_auxii:w #1 ~ upper ~ #4 ~ } ~ \q_stop
\str_if_eq:nnF {#3} {#4}
- { \use:n { \@@_data_auxii:w #1 ~ mixed ~ #3 ~ } ~ \q_stop }
+ { \use:n { \@@_data_auxii:w #1 ~ title ~ #3 ~ } ~ \q_stop }
}
\cs_set_protected:Npn \@@_data_auxii:w
#1 ~ #2 ~ #3 ~ #4 ~ #5 \q_stop
{
\tl_if_empty:nF {#4}
{
- \tl_const:cx { c_@@_ #2 _case_ \@@_generate_char:n {#1} _tl }
+ \tl_const:cx { c_@@_ #2 case_ \@@_generate_char:n {#1} _tl }
{
\@@_generate:n { "#3 }
\@@_generate:n { "#4 }
@@ -244,9 +265,9 @@
\cs_set_protected:Npn \@@_tmp:NN #1#2
{
\quark_if_recursion_tail_stop:N #2
- \tl_const:cn { c_@@_upper_case_ #2 _tl } {#1}
- \tl_const:cn { c_@@_lower_case_ #1 _tl } {#2}
- \tl_const:cn { c_@@_fold_case_ #1 _tl } {#2}
+ \tl_const:cn { c_@@_uppercase_ #2 _tl } {#1}
+ \tl_const:cn { c_@@_lowercase_ #1 _tl } {#2}
+ \tl_const:cn { c_@@_foldcase_ #1 _tl } {#2}
\@@_tmp:NN
}
\@@_tmp:NN