Skip to content

Commit

Permalink
feat: support custom extra info keys
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexaraWu committed Jan 12, 2025
1 parent 5756a25 commit 4afef9f
Showing 1 changed file with 38 additions and 4 deletions.
42 changes: 38 additions & 4 deletions sjtutex/source/sjtutex.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -4315,7 +4315,10 @@
\keys_define:nn { sjtu }
{ info / #1 .meta:nn = { sjtu / info / #1 } {##1} }
\keys_define:nn { sjtu / info }
{ #1 .meta:nn = { sjtu / info / #1 } {##1} }
{
#1 .meta:nn = { sjtu / info / #1 } {##1} ,
extra .meta:nn = { sjtu / info / extra } {##1}
}
\keys_define:nn { sjtu / info / #1 }
{
display-title .code:n =
Expand Down Expand Up @@ -4349,7 +4352,25 @@
fund .groups:n = { sensitive } ,
date .meta:nn = { sjtu / info } { date = {##1} } ,
display-date .tl_set:c = { l_@@_info_date_ #1 _tl } ,
show .clist_set:c = { l_@@_info_show_ #1 _clist }
show .clist_set:c = { l_@@_info_show_ #1 _clist } ,
show .groups:n = { sensitive } ,
extra .meta:nn = { sjtu / info / #1 / extra } {##1} ,
extra / unknown .code:n =
{
\keys_if_exist:nnF { sjtu / info / #1 } { \l_keys_key_tl }
{
\tl_set_eq:NN \l_@@_tmp_tl \l_keys_key_tl
\tl_replace_all:Nnn \l_@@_tmp_tl { - } { _ }
\tl_set:co { l_@@_name_ \l_@@_tmp_tl _ #1 _tl } { \use_i:nn ##1 }
\tl_set:co { l_@@_info_ \l_@@_tmp_tl _ #1 _tl } { \use_ii:nn ##1 }
}
}
}
\keys_define:nn { sjtu / info / extra }
{
#1 .meta:nn = { sjtu / info / #1 / extra } {##1} ,
#1 / unknown .code:n =
{ \keys_set:no { sjtu / info / #1 / extra } { \l_keys_key_tl = {##1} } }
}
}
% \end{macrocode}
Expand Down Expand Up @@ -4597,8 +4618,21 @@
{
\tl_set:Nn \l_@@_tmp_tl {##1}
\tl_replace_all:Nnn \l_@@_tmp_tl { - } { _ }
\exp_args:Nv \tl_if_novalue:nF
{ l_@@_info_ \l_@@_tmp_tl _ \l_@@_lang_tl _tl }
\bool_lazy_all:nT
{
{
\tl_if_exist_p:c
{ l_@@_name_ \l_@@_tmp_tl _ \l_@@_lang_tl _tl }
}
{
\tl_if_exist_p:c
{ l_@@_info_ \l_@@_tmp_tl _ \l_@@_lang_tl _tl }
}
{
! \exp_args:Nv \tl_if_novalue_p:n
{ l_@@_info_ \l_@@_tmp_tl _ \l_@@_lang_tl _tl }
}
}
{
\clist_put_right:Ne \l_@@_tmp_clist
{
Expand Down

0 comments on commit 4afef9f

Please sign in to comment.