[latex3-commits] [latex3/latex2e] UF-latex-lab-table: add support for row headers (3f73ea7be)
github at latex-project.org
github at latex-project.org
Sun Jul 28 01:21:02 CEST 2024
Repository : https://github.com/latex3/latex2e
On branch : UF-latex-lab-table
Link : https://github.com/latex3/latex2e/commit/3f73ea7be8db6faf3a2129e858ec045750415aaf
>---------------------------------------------------------------
commit 3f73ea7be8db6faf3a2129e858ec045750415aaf
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Sun Jul 28 01:19:42 2024 +0200
add support for row headers
>---------------------------------------------------------------
3f73ea7be8db6faf3a2129e858ec045750415aaf
required/latex-lab/latex-lab-table.dtx | 66 ++++++++++++++++++++++------------
1 file changed, 44 insertions(+), 22 deletions(-)
diff --git a/required/latex-lab/latex-lab-table.dtx b/required/latex-lab/latex-lab-table.dtx
index e9f0b59ae..dfefe16ef 100644
--- a/required/latex-lab/latex-lab-table.dtx
+++ b/required/latex-lab/latex-lab-table.dtx
@@ -16,8 +16,8 @@
%
% for those people who are interested or want to report an issue.
%
-\def\ltlabtbldate{2024-07-13}
-\def\ltlabtblversion{0.85j}
+\def\ltlabtbldate{2024-07-27}
+\def\ltlabtblversion{0.85k}
%<*driver>
\documentclass{l3doc}
\EnableCrossrefs
@@ -340,10 +340,18 @@
% always even if the noop plug is in force this needs a different solution.
% \begin{macrocode}
\@@_show_curr_cell_data:
+% \end{macrocode}
+% this sets row headers
+% \begin{macrocode}
+ \clist_if_in:NVT \l_@@_header_columns_clist\g_@@_col_int
+ {
+ \tl_set:Nn \l_@@_celltag_tl {TH}
+ \tl_set:Ne \l_@@_cellattribute_tl {\l_@@_cellattribute_tl,TH-row}
+ }
\tag_struct_begin:n
{
tag =\l_@@_celltag_tl,
- attribute-class =\l_@@_cellattribute_tl
+ attribute-class ={\l_@@_cellattribute_tl}
}
\seq_gput_right:Ne \g_@@_struct_cur_seq { \tag_get:n {struct_num} }
% \end{macrocode}
@@ -376,15 +384,20 @@
\NewSocketPlug{tagsupport/tbl/pcell/begin}{TDpbox}
{
\@@_show_curr_cell_data:
+ \clist_if_in:NVT \l_@@_header_columns_clist\g_@@_col_int
+ {
+ \tl_set:Nn \l_@@_celltag_tl {TH}
+ \tl_set:Ne \l_@@_cellattribute_tl {\l_@@_cellattribute_tl,TH-row}
+ }
\tag_struct_begin:n
{
- tag =\l__tbl_pcelltag_tl,
- attribute-class =\l__tbl_cellattribute_tl
+ tag =\l_@@_pcelltag_tl,
+ attribute-class ={\l_@@_cellattribute_tl}
}
- \seq_gput_right:Ne \g__tbl_struct_cur_seq { \tag_get:n {struct_num} }
- \int_step_inline:nn { \g__tbl_span_tl - 1 }
+ \seq_gput_right:Ne \g_@@_struct_cur_seq { \tag_get:n {struct_num} }
+ \int_step_inline:nn { \g_@@_span_tl - 1 }
{
- \seq_gput_right:Ne \g__tbl_struct_cur_seq { -\tag_get:n {struct_num} }
+ \seq_gput_right:Ne \g_@@_struct_cur_seq { -\tag_get:n {struct_num} }
}
\tagpdfparaOn
\tl_set:Nn \l__tag_para_main_tag_tl {Div}
@@ -573,7 +586,7 @@
\prop_if_exist:cT
{ g__tag_struct_ \l_@@_tmpa_tl _prop }
{
- \exp_args:No \__tag_struct_prop_gput:nnn {\l_@@_tmpa_tl} {S}{/Artifact}
+ \__tag_struct_prop_gput:onn { \l_@@_tmpa_tl } {S}{/Artifact}
}
}
}
@@ -664,7 +677,7 @@
\prop_if_exist:cT
{ g__tag_struct_ \l_@@_tmpa_tl _prop }
{
- \exp_args:No\__tag_struct_prop_gput:nnn {\l_@@_tmpa_tl} {S}{/Artifact}
+ \__tag_struct_prop_gput:onn {\l_@@_tmpa_tl} {S}{/Artifact}
}
}
}
@@ -778,16 +791,10 @@
{/O /Table /ColSpan~\int_eval:n{#1}}
}
\tl_set:Ne \l_@@_cellattribute_tl
- {colspan-\int_eval:n{#1}}
+ {\l_@@_cellattribute_tl,colspan-\int_eval:n{#1}}
}
}
% \end{macrocode}
-% TODO: move to tagpdf
-% \begin{macrocode}
-\tag_if_active:T
- { \cs_generate_variant:Nn \__tag_attr_new_entry:nn {ee} }
-
-% \end{macrocode}
% \end{plugdecl}
%
%
@@ -914,6 +921,7 @@
\tl_set:Nn\l_@@_celltag_tl {text}
\tl_set:Nn\l_@@_tabletag_tl {Div}
\clist_clear:N \l_@@_header_rows_clist
+ \clist_clear:N \l_@@_header_columns_clist
},
table/tagging .default:n = true,
table/tagging .initial:n = true
@@ -982,11 +990,12 @@
% \end{macrocode}
%
-% \begin{variable}{\l_@@_header_rows_clist}
-% This holds the numbers of the header rows. Negative numbers are
+% \begin{variable}{\l_@@_header_rows_clist,\l_@@_header_columns_clist}
+% This holds the numbers of the header rows and columns. Negative numbers are
% possible and count from the last column backwards.
% \begin{macrocode}
\clist_new:N \l_@@_header_rows_clist
+\clist_new:N \l_@@_header_columns_clist
% \end{macrocode}
% \end{variable}
%
@@ -1009,14 +1018,26 @@
{
\__tag_struct_prop_gput:nnn{ ####1 }{S}{/TH}
% \end{macrocode}
-% This need refinement once row headers (and perhaps other attributes)
-% are used too, but for now it should be ok.
+% This sets the scope class. If the header has already a row attribute
+% we replace by TH-both.
% \begin{macrocode}
\prop_get:cnNTF
{ g__tag_struct_####1_prop }
{ C }
\l_@@_tmpa_tl
- {\__tag_struct_prop_gput:nne{ ####1 }{C}{[/TH-col~\l_@@_tmpa_tl]} }
+ {
+ \str_set:Ne \l_@@_tmpa_str {\l_@@_tmpa_tl}
+ \str_remove_once:Nn \l_@@_tmpa_str {[}
+ \str_remove_once:Nn \l_@@_tmpa_str {]}
+ \str_if_in:NnTF\l_@@_tmpa_str{/TH-row}
+ {
+ \str_replace_once:Nnn \l_@@_tmpa_str {/TH-row}{/TH-both}
+ \__tag_struct_prop_gput:nne{ ####1 }{C}{[\l_@@_tmpa_str]}
+ }
+ {
+ \__tag_struct_prop_gput:nne{ ####1 }{C}{[/TH-col~\l_@@_tmpa_str]}
+ }
+ }
{\__tag_struct_prop_gput:nnn{ ####1 }{C}{/TH-col}}
}
}
@@ -1031,6 +1052,7 @@
\keys_define:nn { __tag / setup }
{
table/header-rows .clist_set:N = \l_@@_header_rows_clist,
+ table/header-columns .clist_set:N = \l_@@_header_columns_clist,
% \end{macrocode}
% obsolete older name:
% \begin{macrocode}
More information about the latex3-commits
mailing list.