Skip to content

Commit

Permalink
Fix \text_map_... functions (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
h20y6m committed Sep 3, 2022
1 parent 47b11b0 commit 5ef108b
Show file tree
Hide file tree
Showing 4 changed files with 239 additions and 0 deletions.
82 changes: 82 additions & 0 deletions plexpl3.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,88 @@
{ \__regex_replacement_put:n {#2} }
% \end{macrocode}
%
% \subsection{コードポイント関数の修正}
%
% Fix for codepoint functions in \file{l3text}.
% \begin{macrocode}
%<@@=text>
% \end{macrocode}
% \begin{macrocode}
\cs_gset:Npn \@@_codepoint_process:nN #1#2
{
% \end{macrocode}
% Check if the given character token is a jachar.
% One jachar token is one codepoint.
% \begin{macrocode}
\token_if_jachar:NTF #2
{ \use:n }
{
\int_compare:nNnTF { `#2 } > { "80 }
{
\int_compare:nNnTF { `#2 } < { "E0 }
{ \@@_codepoint_process:nNN }
{
\int_compare:nNnTF { `#2 } < { "F0 }
{ \@@_codepoint_process:nNNN }
{ \@@_codepoint_process:nNNNN }
}
}
}
{ \use:n }
{#1} #2
}
% \end{macrocode}
% \begin{macrocode}
\cs_gset:Npn \@@_codepoint_compare:N #1
{
% \end{macrocode}
% Check if the given character token is a jachar.
% \begin{macrocode}
\token_if_jachar:NTF #1
{ \@@_codepoint_compare_jachar:N }
{
\if_int_compare:w `#1 > "80 \exp_stop_f:
\if_int_compare:w `#1 < "E0 \exp_stop_f:
\exp_after:wN \exp_after:wN \exp_after:wN
\@@_codepoint_compare:NN
\else:
\if_int_compare:w `#1 < "F0 \exp_stop_f:
\exp_after:wN \exp_after:wN \exp_after:wN
\exp_after:wN \exp_after:wN \exp_after:wN
\exp_after:wN \@@_codepoint_compare:NNN
\else:
\exp_after:wN \exp_after:wN \exp_after:wN
\exp_after:wN \exp_after:wN \exp_after:wN
\exp_after:wN \@@_codepoint_compare:NNNN
\fi:
\fi:
\else:
\exp_after:wN \@@_codepoint_compare_aux:N
\fi:
}
#1
}
% \end{macrocode}
% \begin{macrocode}
\int_compare:nNnTF { \tex_jis:D "2121 } = { "3000 }
{
% \end{macrocode}
% up\TeX{} with unicode.
% \begin{macrocode}
\cs_new:Npn \@@_codepoint_compare_jachar:N #1 { `#1 }
}
{
% \end{macrocode}
% p\TeX{} or up\TeX{} with euc/sjis.
% \begin{macrocode}
\cs_new:Npn \@@_codepoint_compare_jachar:N #1
{ \tex_toucs:D `#1 \exp_stop_f: }
}
% \end{macrocode}
% \begin{macrocode}
%<@@=>
% \end{macrocode}
%
% 以上です。
% \begin{macrocode}
%</code>
Expand Down
38 changes: 38 additions & 0 deletions testfiles/pl3text002.lvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
%
% Copyright (c) 2022 Japanese TeX Development Community
%
\epTeXinputencoding utf8

\input{regression-test}
\documentclass{minimal}
\RequirePackage[enable-debug]{expl3}
\ExplSyntaxOn
\debug_on:n { check-declarations , deprecation , log-functions }
\ExplSyntaxOff

\RequirePackage{plexpl3}

\begin{document}

\START
\ExplSyntaxOn

\cs_new:Npn \test_map:n #1 { [#1] }

\TESTEXP { text_map_function }
{
\text_map_function:nN
{ ABC~äëïöü~αβγ~あいうえお~か゚き゚く゚け゚こ゚~葛󠄀城市~葛󠄁飾区~☀☁☂☃~⛄👨‍👩‍👧‍👦💔 }
\test_map:n
}

\TEST { text_map_inline }
{
\text_map_inline:nn
{ ABC~äëïöü~αβγ~あいうえお~か゚き゚く゚け゚こ゚~葛󠄀城市~葛󠄁飾区~☀☁☂☃~⛄👨‍👩‍👧‍👦💔 }
{
\TYPE { [#1] }
}
}

\END
60 changes: 60 additions & 0 deletions testfiles/pl3text002.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
Defining \test_map:n on line ...
============================================================
TEST 1: text_map_function
============================================================
[A][B][C][ ][^^c3^^a4][^^c3^^ab][^^c3^^af][^^c3^^b6][^^c3^^bc][ ][α][β][γ][ ][あ][い][う][え][お][ ][か^^e3^^82^^9a][き^^e3^^82^^9a][く^^e3^^82^^9a][け^^e3
^^82^^9a][こ^^e3^^82^^9a][ ][葛^^f3^^a0^^84^^80][城][市][ ][葛^^f3^^a0^^84^^81]
[飾][区][ ][^^e2^^98^^80][^^e2^^98^^81][^^e2^^98^^82][^^e2^^98^^83][ ][^^e2^^9b
^^84][^^f0^^9f^^91^^a8^^e2^^80^^8d][^^f0^^9f^^91^^a9^^e2^^80^^8d][^^f0^^9f^^91^^a7^^e2^^80^^8d][^^f0^^9f^^91^^a6][^^f0^^9f^^92^^94]
============================================================
============================================================
TEST 2: text_map_inline
============================================================
[A]
[B]
[C]
[ ]
[^^c3^^a4]
[^^c3^^ab]
[^^c3^^af]
[^^c3^^b6]
[^^c3^^bc]
[ ]
[α]
[β]
[γ]
[ ]
[あ]
[い]
[う]
[え]
[お]
[ ]
[か^^e3^^82^^9a]
[き^^e3^^82^^9a]
[く^^e3^^82^^9a]
[け^^e3^^82^^9a]
[こ^^e3^^82^^9a]
[ ]
[葛^^f3^^a0^^84^^80]
[城]
[市]
[ ]
[葛^^f3^^a0^^84^^81]
[飾]
[区]
[ ]
[^^e2^^98^^80]
[^^e2^^98^^81]
[^^e2^^98^^82]
[^^e2^^98^^83]
[ ]
[^^e2^^9b^^84]
[^^f0^^9f^^91^^a8^^e2^^80^^8d]
[^^f0^^9f^^91^^a9^^e2^^80^^8d]
[^^f0^^9f^^91^^a7^^e2^^80^^8d]
[^^f0^^9f^^91^^a6]
[^^f0^^9f^^92^^94]
============================================================
59 changes: 59 additions & 0 deletions testfiles/pl3text002.uptex.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
Defining \test_map:n on line ...
============================================================
TEST 1: text_map_function
============================================================
[A][B][C][ ][^^c3^^a4][^^c3^^ab][^^c3^^af][^^c3^^b6][^^c3^^bc][ ][α][β][γ][ ][あ][い][う][え][お][ ][か゚][き゚][く゚][け゚][こ゚][ ][葛
󠄀][城][市][ ][葛󠄁][飾][区][ ][☀][☁][☂][☃][ ][⛄][👨‍][
👩‍][👧‍][👦][💔]
============================================================
============================================================
TEST 2: text_map_inline
============================================================
[A]
[B]
[C]
[ ]
[^^c3^^a4]
[^^c3^^ab]
[^^c3^^af]
[^^c3^^b6]
[^^c3^^bc]
[ ]
[α]
[β]
[γ]
[ ]
[あ]
[い]
[う]
[え]
[お]
[ ]
[か゚]
[き゚]
[く゚]
[け゚]
[こ゚]
[ ]
[葛󠄀]
[城]
[市]
[ ]
[葛󠄁]
[飾]
[区]
[ ]
[☀]
[☁]
[☂]
[☃]
[ ]
[⛄]
[👨‍]
[👩‍]
[👧‍]
[👦]
[💔]
============================================================

0 comments on commit 5ef108b

Please sign in to comment.