[latex3-commits] [latex3/latex2e] test-tagpdf-099f: test tagpdf with new suspend/resume (ff69368c)
github at latex-project.org
github at latex-project.org
Mon Sep 16 19:55:06 CEST 2024
Repository : https://github.com/latex3/latex2e
On branch : test-tagpdf-099f
Link : https://github.com/latex3/latex2e/commit/ff69368c7a23ccc1ea6b04062f2a05d064f6e841
>---------------------------------------------------------------
commit ff69368c7a23ccc1ea6b04062f2a05d064f6e841
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Mon Sep 16 19:55:06 2024 +0200
test tagpdf with new suspend/resume
>---------------------------------------------------------------
ff69368c7a23ccc1ea6b04062f2a05d064f6e841
texmf/tex/latex/tagpdf/tagpdf-base.sty | 2 +
texmf/tex/latex/tagpdf/tagpdf-debug.sty | 49 +++--
texmf/tex/latex/tagpdf/tagpdf-luatex.def | 6 +-
texmf/tex/latex/tagpdf/tagpdf.sty | 81 ++++---
texmf/tex/latex/tagpdf/tagpdfdocu-patches.sty | 293 --------------------------
5 files changed, 94 insertions(+), 337 deletions(-)
diff --git a/texmf/tex/latex/tagpdf/tagpdf-base.sty b/texmf/tex/latex/tagpdf/tagpdf-base.sty
index e02c03e6..1124f92e 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-base.sty
+++ b/texmf/tex/latex/tagpdf/tagpdf-base.sty
@@ -45,6 +45,8 @@
\cs_new_protected:Npn \tagstart{}
\cs_new_protected:Npn \tag_stop:n #1 {}
\cs_new_protected:Npn \tag_start:n #1 {}
+\cs_set_eq:NN \tag_suspend:n \tag_stop:n
+\cs_set_eq:NN \tag_resume:n \tag_start:n
%% File: tagpdf-mc-generic.dtx
\cs_new_protected:Npn \tag_mc_begin:n #1 { \__tag_whatsits: \int_gincr:N \c at g__tag_MCID_abs_int }
\cs_new_protected:Nn \tag_mc_end:{ \__tag_whatsits: }
diff --git a/texmf/tex/latex/tagpdf/tagpdf-debug.sty b/texmf/tex/latex/tagpdf/tagpdf-debug.sty
index e2ef54ea..4bfcb2b7 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-debug.sty
+++ b/texmf/tex/latex/tagpdf/tagpdf-debug.sty
@@ -33,7 +33,7 @@
\prop_gput:Nnn \g_msg_module_name_prop { tag / debug }{tagpdf~DEBUG}
\cs_set_protected:Npn \tag_stop:
{
- \msg_note:nne {tag / debug }{tag-stop}{ \int_use:N \l__tag_tag_stop_int }
+ \msg_note:nne {tag / debug }{tag-suspend}{ \int_use:N \l__tag_tag_stop_int }
\int_incr:N \l__tag_tag_stop_int
\bool_set_false:N \l__tag_active_struct_bool
\bool_set_false:N \l__tag_active_mc_bool
@@ -50,13 +50,13 @@
\bool_set_true:N \l__tag_active_socket_bool
\__tag_start_para_ints:
}
- \msg_note:nne {tag / debug }{tag-start}{ \int_use:N \l__tag_tag_stop_int }
+ \msg_note:nne {tag / debug }{tag-resume}{ \int_use:N \l__tag_tag_stop_int }
}
\cs_set_eq:NN\tagstop\tag_stop:
\cs_set_eq:NN\tagstart\tag_start:
-\cs_set_protected:Npn \tag_stop:n #1
+\cs_set_protected:Npn \tag_suspend:n #1
{
- \msg_note:nnee {tag / debug }{tag-stop}
+ \msg_note:nnee {tag / debug }{tag-suspend}
{ \int_use:N \l__tag_tag_stop_int }{\exp_not:n{#1}}
\int_incr:N \l__tag_tag_stop_int
\bool_set_false:N \l__tag_active_struct_bool
@@ -64,7 +64,8 @@
\bool_set_false:N \l__tag_active_socket_bool
\__tag_stop_para_ints:
}
-\cs_set_protected:Npn \tag_start:n #1
+\cs_set_eq:NN \tag_stop:n \tag_suspend:n
+\cs_set_protected:Npn \tag_resume:n #1
{
\int_if_zero:nF { \l__tag_tag_stop_int } { \int_decr:N \l__tag_tag_stop_int }
\int_if_zero:nT { \l__tag_tag_stop_int }
@@ -74,9 +75,10 @@
\bool_set_true:N \l__tag_active_socket_bool
\__tag_start_para_ints:
}
- \msg_note:nnee {tag / debug }{tag-start}
+ \msg_note:nnee {tag / debug }{tag-resume}
{ \int_use:N \l__tag_tag_stop_int }{\exp_not:n{#1}}
}
+\cs_set_eq:NN \tag_start:n \tag_resume:n
\bool_if:NTF \g__tag_mode_lua_bool
{
\RequirePackage {tagpdf-debug-lua}
@@ -195,20 +197,20 @@
}
}
}
-\msg_new:nnn { tag / debug } {tag-stop}
+\msg_new:nnn { tag / debug } {tag-suspend}
{
\int_if_zero:nTF
{#1}
- {Tagging~stopped}
- {Tagging~(not)~stopped~(already~inactive)}\\
+ {Tagging~suspended}
+ {Tagging~(not)~suspended~(already~inactive)}\\
level:~#1~==>~\int_eval:n{#1+1}\tl_if_empty:nF{#2}{,~label:~#2}~[\msg_line_context:]
}
-\msg_new:nnn { tag / debug } {tag-start}
+\msg_new:nnn { tag / debug } {tag-resume}
{
\int_if_zero:nTF
{#1}
- {Tagging~restarted}
- {Tagging~(not)~restarted}\\
+ {Tagging~resumed}
+ {Tagging~(not)~resumed}\\
level:~\int_eval:n{#1+1}~==>~#1\tl_if_empty:nF{#2}{,~label:~#2}~[\msg_line_context:]
}
%% File: tagpdf-user.dtx
@@ -263,7 +265,7 @@
\seq_new:c { g__tag_struct_debug_kids_1_seq }
\prop_gset_eq:cc { g__tag_struct_debug_1_prop }{ g__tag_struct_1_prop }
\prop_gremove:cn { g__tag_struct_debug_1_prop }{Namespaces}
-\cs_set_protected:Npn \__tag_struct_kid_mc_gput_right:nn #1 #2 %#1 structure num, #2 MCID absnum%
+\cs_set_protected:Npn \__tag_struct_kid_mc_gput_right:nn #1 #2
{
\__tag_seq_gput_right:ce
{ g__tag_struct_kids_#1_seq }
@@ -281,7 +283,8 @@
\prop_item:Nn \g__tag_struct_cont_mc_prop {#2}
}
}
-\cs_set_protected:Npn\__tag_struct_kid_struct_gput_right:nn #1 #2 %#1 num of parent struct, #2 kid struct
+\cs_set_protected:Npn\__tag_struct_kid_struct_gput_right:nn #1 #2
+%%#1 num of parent struct, #2 kid struct
{
\__tag_seq_gput_right:ce
{ g__tag_struct_kids_#1_seq }
@@ -294,8 +297,22 @@
Struct~#2
}
}
-
+\cs_set_protected:Npn\__tag_struct_kid_struct_gput_left:nn #1 #2
+%%#1 num of parent struct, #2 kid struct
+ {
+ \__tag_seq_gput_left:ce
+ { g__tag_struct_kids_#1_seq }
+ {
+ \pdf_object_ref_indexed:nn { __tag/struct }{ #2 }
+ }
+ \seq_gput_left:cn
+ { g__tag_struct_debug_kids_#1_seq }
+ {
+ Struct~#2
+ }
+ }
\cs_set_protected:Npn\__tag_struct_kid_OBJR_gput_right:nnn #1 #2 #3
+%%#1 num of parent struct,#2 obj reference,#3 page object reference
{
\pdf_object_unnamed_write:nn
{ dict }
@@ -450,7 +467,7 @@
%record this structure as kid:
%\tl_show:N \g__tag_struct_stack_current_tl
%\tl_show:N \l__tag_struct_stack_parent_tmpa_tl
- \__tag_struct_kid_struct_gput_right:ee
+ \use:c { __tag_struct_kid_struct_gput_ \l__tag_struct_addkid_tl :ee }
{ \l__tag_struct_stack_parent_tmpa_tl }
{ \g__tag_struct_stack_current_tl }
%\prop_show:c { g__tag_struct_\g__tag_struct_stack_current_tl _prop }
diff --git a/texmf/tex/latex/tagpdf/tagpdf-luatex.def b/texmf/tex/latex/tagpdf/tagpdf-luatex.def
index d9496473..b5eca2f6 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-luatex.def
+++ b/texmf/tex/latex/tagpdf/tagpdf-luatex.def
@@ -54,7 +54,11 @@
\seq_gput_right:Nn #1 { #2 }
\lua_now:e { table.insert(ltx.__tag.tables.\cs_to_str:N#1, "#2") }
}
-
+\cs_set_protected:Npn \__tag_seq_gput_left:Nn #1 #2
+ {
+ \seq_gput_left:Nn #1 { #2 }
+ \lua_now:e { table.insert(ltx.__tag.tables.\cs_to_str:N#1, "#2") }
+ }
\cs_set:Npn \__tag_seq_item:cn #1 #2
{
diff --git a/texmf/tex/latex/tagpdf/tagpdf.sty b/texmf/tex/latex/tagpdf/tagpdf.sty
index 93217d1f..abb6d3d8 100644
--- a/texmf/tex/latex/tagpdf/tagpdf.sty
+++ b/texmf/tex/latex/tagpdf/tagpdf.sty
@@ -180,12 +180,14 @@
\cs_set_eq:NN \__tag_seq_new:N \seq_new:N
\cs_set_eq:NN \__tag_prop_gput:Nnn \prop_gput:Nnn
\cs_set_eq:NN \__tag_seq_gput_right:Nn \seq_gput_right:Nn
+\cs_set_eq:NN \__tag_seq_gput_left:Nn \seq_gput_left:Nn
\cs_set_eq:NN \__tag_seq_item:cn \seq_item:cn
\cs_set_eq:NN \__tag_prop_item:cn \prop_item:cn
\cs_set_eq:NN \__tag_seq_show:N \seq_show:N
\cs_set_eq:NN \__tag_prop_show:N \prop_show:N
\cs_generate_variant:Nn \__tag_prop_gput:Nnn { Nen , Nee, Nne , cnn, cen, cne, cno, cnx}
\cs_generate_variant:Nn \__tag_seq_gput_right:Nn { Ne , No, cn, ce }
+\cs_generate_variant:Nn \__tag_seq_gput_left:Nn { ce }
\cs_generate_variant:Nn \__tag_prop_new:N { c }
\cs_generate_variant:Nn \__tag_seq_new:N { c }
\cs_generate_variant:Nn \__tag_seq_show:N { c }
@@ -212,7 +214,7 @@
}
\cs_set_eq:NN\tagstop\tag_stop:
\cs_set_eq:NN\tagstart\tag_start:
-\cs_set_protected:Npn \tag_stop:n #1
+\cs_set_protected:Npn \tag_suspend:n #1
{
\int_incr:N \l__tag_tag_stop_int
\bool_set_false:N \l__tag_active_struct_bool
@@ -220,7 +222,8 @@
\bool_set_false:N \l__tag_active_socket_bool
\__tag_stop_para_ints:
}
-\cs_set_protected:Npn \tag_start:n #1
+\cs_set_eq:NN \tag_stop:n \tag_suspend:n
+\cs_set_protected:Npn \tag_resume:n #1
{
\int_if_zero:nF { \l__tag_tag_stop_int } { \int_decr:N \l__tag_tag_stop_int }
\int_if_zero:nT { \l__tag_tag_stop_int }
@@ -231,6 +234,7 @@
\__tag_start_para_ints:
}
}
+\cs_set_eq:NN \tag_start:n \tag_resume:n
\keys_define:nn { __tag / setup }
{
activate/mc .bool_gset:N = \g__tag_active_mc_bool,
@@ -666,12 +670,12 @@
\tag_mc_end_push:
\tag_mc_begin:n {artifact=#1}
\group_begin:
- \tag_stop:n{artifact-group}
+ \tag_suspend:n{artifact-group}
}
\cs_set_protected:Npn \tag_mc_artifact_group_end:
{
- \tag_start:n{artifact-group}
+ \tag_resume:n{artifact-group}
\group_end:
\tag_mc_end:
\tag_mc_begin_pop:n{}
@@ -1973,6 +1977,9 @@
\prop_new_linked:N \g__tag_struct_label_num_prop
\bool_new:N \l__tag_struct_elem_stash_bool
+\tl_new:N \l__tag_struct_addkid_tl
+\tl_set:Nn \l__tag_struct_addkid_tl {right}
+
\prop_new_linked:N \g__tag_struct_ref_by_dest_prop
\cs_new:Npn \__tag_struct_output_prop_aux:nn #1 #2 %#1 num, #2 key
{
@@ -2097,7 +2104,7 @@
/MCID \c_space_tl \property_ref:enn{mcid-#1}{tagmcid}{1}
>>
}
-\cs_new_protected:Npn \__tag_struct_kid_mc_gput_right:nn #1 #2 %#1 structure num, #2 MCID absnum%
+\cs_new_protected:Npn \__tag_struct_kid_mc_gput_right:nn #1 #2
{
\__tag_seq_gput_right:ce
{ g__tag_struct_kids_#1_seq }
@@ -2111,7 +2118,8 @@
}
}
\cs_generate_variant:Nn \__tag_struct_kid_mc_gput_right:nn {ne}
-\cs_new_protected:Npn\__tag_struct_kid_struct_gput_right:nn #1 #2 %#1 num of parent struct, #2 kid struct
+\cs_new_protected:Npn\__tag_struct_kid_struct_gput_right:nn #1 #2
+%%#1 num of parent struct, #2 kid struct
{
\__tag_seq_gput_right:ce
{ g__tag_struct_kids_#1_seq }
@@ -2119,11 +2127,21 @@
\pdf_object_ref_indexed:nn { __tag/struct }{ #2 }
}
}
-
\cs_generate_variant:Nn \__tag_struct_kid_struct_gput_right:nn {ee}
-\cs_new_protected:Npn\__tag_struct_kid_OBJR_gput_right:nnn #1 #2 #3 %#1 num of parent struct,
- %#2 obj reference
- %#3 page object reference
+\cs_new_protected:Npn\__tag_struct_kid_struct_gput_left:nn #1 #2
+%%#1 num of parent struct, #2 kid struct
+ {
+ \__tag_seq_gput_left:ce
+ { g__tag_struct_kids_#1_seq }
+ {
+ \pdf_object_ref_indexed:nn { __tag/struct }{ #2 }
+ }
+ }
+\cs_generate_variant:Nn \__tag_struct_kid_struct_gput_left:nn {ee}
+\cs_new_protected:Npn\__tag_struct_kid_OBJR_gput_right:nnn #1 #2 #3
+
+
+%%#1 num of parent struct,#2 obj reference,#3 page object reference
{
\pdf_object_unnamed_write:nn
{ dict }
@@ -2262,7 +2280,8 @@
{
\prop_get:cnNF { g__tag_struct_#1_prop } {P}\l__tag_tmpb_tl
{
- \prop_gput:cne { g__tag_struct_#1_prop } {P}{\pdf_object_ref_indexed:nn { __tag/struct }{1}}
+ \prop_gput:cne { g__tag_struct_#1_prop } {P}
+ {\pdf_object_ref_indexed:nn { __tag/struct }{1}}
\prop_gput:cne { g__tag_struct_#1_prop } {S}{/Artifact}
\seq_if_empty:cF {g__tag_struct_kids_#1_seq}
{
@@ -2288,8 +2307,9 @@
\msg_error:nnn { tag } { struct-no-objnum } { #1}
}
}
-\cs_new_protected:Npn \__tag_struct_insert_annot:nn #1 #2 %#1 object reference to the annotation/xform
- %#2 structparent number
+\cs_new_protected:Npn \__tag_struct_insert_annot:nn #1 #2
+ %#1 object reference to the annotation/xform
+ %#2 structparent number
{
\bool_if:NT \g__tag_active_struct_bool
{
@@ -2311,7 +2331,8 @@
#1 %
}
{
- \pdf_pageobject_ref:n { \property_ref:nnn {@tag at objr@page@#2 }{ tagabspage }{1} }
+ \pdf_pageobject_ref:n
+ { \property_ref:nnn {@tag at objr@page@#2 }{ tagabspage }{1} }
}
% add the parent obj number to the parent tree:
\exp_args:Nne
@@ -2320,7 +2341,8 @@
#2
}
{
- \pdf_object_ref_indexed:nn { __tag/struct }{ \l__tag_struct_stack_parent_tmpa_tl }
+ \pdf_object_ref_indexed:nn
+ { __tag/struct }{ \l__tag_struct_stack_parent_tmpa_tl }
}
% increase the int:
\int_gincr:N \c at g__tag_parenttree_obj_int
@@ -2341,7 +2363,8 @@
\socket_new:nn { tag/struct/tag }{1}
\socket_new_plug:nnn { tag/struct/tag }{ latex-tags }
{
- \seq_set_split:Nne \l__tag_tmpa_seq { / } {#1/\prop_item:Ne\g__tag_role_tags_NS_prop{#1}}
+ \seq_set_split:Nne \l__tag_tmpa_seq { / }
+ {#1/\prop_item:Ne\g__tag_role_tags_NS_prop{#1}}
\tl_gset:Ne \g__tag_struct_tag_tl { \seq_item:Nn\l__tag_tmpa_seq {1} }
\tl_gset:Ne \g__tag_struct_tag_NS_tl{ \seq_item:Nn\l__tag_tmpa_seq {2} }
\__tag_check_structure_tag:N \g__tag_struct_tag_tl
@@ -2349,10 +2372,12 @@
\socket_new_plug:nnn { tag/struct/tag }{ pdf-tags }
{
- \seq_set_split:Nne \l__tag_tmpa_seq { / } {#1/\prop_item:Ne\g__tag_role_tags_NS_prop{#1}}
+ \seq_set_split:Nne \l__tag_tmpa_seq { / }
+ {#1/\prop_item:Ne\g__tag_role_tags_NS_prop{#1}}
\tl_gset:Ne \g__tag_struct_tag_tl { \seq_item:Nn\l__tag_tmpa_seq {1} }
\tl_gset:Ne \g__tag_struct_tag_NS_tl{ \seq_item:Nn\l__tag_tmpa_seq {2} }
- \__tag_role_get:VVNN \g__tag_struct_tag_tl\g__tag_struct_tag_NS_tl\l__tag_tmpa_tl\l__tag_tmpb_tl
+ \__tag_role_get:VVNN
+ \g__tag_struct_tag_tl \g__tag_struct_tag_NS_tl \l__tag_tmpa_tl \l__tag_tmpb_tl
\tl_gset:Ne \g__tag_struct_tag_tl {\l__tag_tmpa_tl}
\tl_gset:Ne \g__tag_struct_tag_NS_tl{\l__tag_tmpb_tl}
\__tag_check_structure_tag:N \g__tag_struct_tag_tl
@@ -2387,6 +2412,7 @@
}
},
parent .default:n = {-1},
+firstkid .code:n = { \tl_set:Nn \l__tag_struct_addkid_tl {left} },
tag .code:n = % S property
{
\socket_use:nn { tag/struct/tag }{#1}
@@ -2548,7 +2574,7 @@
}
\cs_generate_variant:Nn \__tag_struct_add_inline_AF:nn {on}
-\cs_new_protected:Npn \__tag_struct_add_AF:nn #1 #2 % #1 struct num #2 object reference
+\cs_new_protected:Npn \__tag_struct_add_AF:nn #1 #2
{
\tl_if_exist:cTF
{
@@ -2574,7 +2600,8 @@
{
\pdf_object_if_exist:eTF {#1}
{
- \__tag_struct_add_AF:ee { \int_use:N \c at g__tag_struct_abs_int }{\pdf_object_ref:e {#1}}
+ \__tag_struct_add_AF:ee
+ { \int_use:N \c at g__tag_struct_abs_int }{\pdf_object_ref:e {#1}}
\__tag_struct_prop_gput:nne
{ \int_use:N \c at g__tag_struct_abs_int }
{ AF }
@@ -2788,7 +2815,7 @@
%record this structure as kid:
%\tl_show:N \g__tag_struct_stack_current_tl
%\tl_show:N \l__tag_struct_stack_parent_tmpa_tl
- \__tag_struct_kid_struct_gput_right:ee
+ \use:c { __tag_struct_kid_struct_gput_ \l__tag_struct_addkid_tl :ee }
{ \l__tag_struct_stack_parent_tmpa_tl }
{ \g__tag_struct_stack_current_tl }
%\prop_show:c { g__tag_struct_\g__tag_struct_stack_current_tl _prop }
@@ -3515,9 +3542,9 @@
{\tagmcbegin{tag=Lbl}}
{#1}
}
- \tag_stop:n{hangfrom}
+ \tag_suspend:n{hangfrom}
\hangindent \wd\@tempboxa\noindent
- \tag_start:n{hangfrom}
+ \tag_resume:n{hangfrom}
\tagmcbegin{}\box\@tempboxa\tagmcend\tagstructend\tagmcbegin{}
}
}
@@ -3768,11 +3795,11 @@
\bool_gset_false:N \g__tag_in_mc_bool
}
\tag_mc_begin:n {artifact}
- \tag_stop:n{headfoot}
+ \tag_suspend:n{headfoot}
}
\cs_new_protected:Npn \__tag_exclude_headfoot_end:
{
- \tag_start:n{headfoot}
+ \tag_resume:n{headfoot}
\tag_mc_end:
\bool_if:NTF \g__tag_mode_lua_bool
{
@@ -3796,12 +3823,12 @@
}
\tag_struct_begin:n{tag=Artifact,attribute-class=__tag/attr/#1}
\tag_mc_begin:n {artifact=#1}
- \tag_stop:n{headfoot}
+ \tag_suspend:n{headfoot}
}
\cs_new_protected:Npn \__tag_exclude_struct_headfoot_end:
{
- \tag_start:n{headfoot}
+ \tag_resume:n{headfoot}
\tag_mc_end:
\tag_struct_end:
\bool_if:NTF \g__tag_mode_lua_bool
diff --git a/texmf/tex/latex/tagpdf/tagpdfdocu-patches.sty b/texmf/tex/latex/tagpdf/tagpdfdocu-patches.sty
deleted file mode 100644
index 5619d595..00000000
--- a/texmf/tex/latex/tagpdf/tagpdfdocu-patches.sty
+++ /dev/null
@@ -1,293 +0,0 @@
-%\RequirePackage[enable-debug]{expl3}[2018/06/14]
-\ProvidesExplPackage {tagpdfdocu-patches} {2024-09-11} {0.99e}
- {patches/commands for the tagpdf documentation}
-\RequirePackage{etoolbox,xpatch}
-
-%Logos
-% only spacing changes:
-\ExplSyntaxOn
-\DeclareRobustCommand\TeX{
- \leavevmode
- T\kern-.1667em\lower.5ex\hbox{E}\kern-.05emX\@ %changed from -.125em
- }
-\DeclareRobustCommand{\LaTeX}{
- \leavevmode
- L\kern-.25em % %changed from -0.36em
- \sbox\z@ T%
- \vbox to\ht\z@{\hbox{\check at mathfonts
- \fontsize\sf at size\z@
- \math at fontsfalse\selectfont
- A}%
- \vss}%
- \kern-.1em % %changed from 0.15em
- T\kern-.1667em\lower.5ex\hbox{E}\kern-.05emX\@ %changed from -0.125
- }
-
-% minisec, correct tagging is still unclear.
-\newcommand\minisec[1]{%
- \if at noskipsec \leavevmode \fi
- \par
- \@afterindentfalse
- \if at nobreak
- \everypar{}%
- \else
- \addpenalty\@secpenalty\addvspace{1.5ex}%
- \fi
- {\tagpdfsetup{para/maintag=P,para/tag=Strong}\parindent \z@
- \setlength{\parfillskip}{\z@ plus 1fil}%
- \raggedright\normalfont\bfseries\nobreak
- \nobreak\interlinepenalty \@M #1\par\nobreak%
- }\nobreak
- \@afterheading
-}
-
-% listings. Unclear how to make it work for the original lstlisting, so we make a
-% copy taglstlisting for now
-\DeclareInstance{blockenv}{lstlisting}{display}
-{
- env-name = lstlisting,
- tag-name = verbatim,
- tag-class = ,
- tagging-recipe = standard,
- inner-level-counter = ,
- level-increase = false,
- setup-code = ,
- block-instance = displayblock ,
- inner-instance = ,
- final-code = \tl_set:Nn \l__tag_para_main_tag_tl {codeline}\tagtool{paratag=Code},
-}
-
-\lstnewenvironment{taglstlisting}[2][]{%
- \UseInstance{blockenv}{lstlisting} {}
- \lst at TestEOLChar{#2}%
- \lstset{#1}%
- \csname\@lst @SetFirstNumber\endcsname%
- }{%
- \@nobreakfalse
- \csname\@lst @SaveFirstNumber\endcsname%
- \endblockenv
- }
-
-% ======== marginnote ==========
-% 2024-03-23 currently marginnote is no longer used, we use marginpar
-% TODO marginnote has a bug (a \par is missing) so it messes up tagging.
-% but currently unneeded as we marked them up as artifacts anyway as they don't contain
-% meaningful contents
-%\renewcommand*{\mn at parboxrestore}{\tagpdfparaOff}%
-
-%\NewDocumentCommand\sidenote{m}
-% {%
-% %\tag_mc_artifact_group_begin:n{notype}\tagpdfparaOff\marginnote{#1}\tag_mc_artifact_group_end:
-% \marginpar{#1}%
-% }
-
-\ExplSyntaxOff
-
-%======== tcolorbox ========
-% We switch of paratagging at the begin and reenable it locally in before upper.
-% the before upper setting is dangerous as it can be overwritten by
-% users. So a more stable hook is needed.
-% we force also a \par and add a div structure, to avoid clashes with the block
-% tagging code. This needs revisiting!
-
-\AddToHook{env/tcolorbox/before}{\par\tagstructbegin{tag=Div}}
-\AddToHook{env/tcolorbox/begin}{\tagpdfparaOff \tcbset{before upper=\tagpdfparaOn}}
-\AddToHook{env/tcolorbox/after}{\par\tagstructend}
-
-% ========= doc Commands from tcolorbox
-% Not sure if this is generally usable but one must avoid tagstop if there can
-% be a pagebreak
-\DeclareInstance{blockenv}{docCommand}{display}
-{
- env-name = docCommand,
- tag-name = Div,
- tag-class = ,
- tagging-recipe = standalone,
- inner-level-counter = ,
- level-increase = false,
- setup-code = ,
- block-instance = displayblock ,
-}
-
-\RenewDocumentEnvironment{tcb at manual@entry}{}
- {\UseInstance{blockenv}{docCommand}
- {tag-name=Div,
- leftmargin=\kvtcb at doc@left,
- rightmargin=\kvtcb at doc@right,
- }%
- \tagtool{para=false}%
- \AssignSocketPlug{tagsupport/minipage/before}{noop}
- \AssignSocketPlug{tagsupport/minipage/after}{noop}
- \AssignSocketPlug{tagsupport/parbox/before}{noop}
- \AssignSocketPlug{tagsupport/parbox/after}{noop}
- }
- {\endblockenv }
-
-\tcbset{
- doc head command=
- {before upper=\tagstructbegin{tag=Code}\tagmcbegin{},
- after upper=\tagmcend\tagstructend},
- }
-
-
-
-% ======= footnote ========
-% done in testphase code
-
-% ====== hyperref ========
-% this should probably go into tagpdf, but it is related to
-% problem of pdf strings and context ....
-
-\AddToHook{package/hyperref/after}
- {%
- \pdfstringdefDisableCommands{%
- \let\tagstructbegin\@gobble
- \let\tagmcbegin\@gobble
- \let\tagmcend\relax
- \let\tagstructend\relax
- }}{}
-
-%====== tikz picture =======
-% first draft to tag. The main problem is to handle paragraphs. One
-\ExplSyntaxOn
-\cs_new_protected:Npn\__tag_tikz_savepos:n #1
- {
- \tex_savepos:D
- \tikz at resetexpandcount%
- \tikz at scan@one at point\pgfutil at firstofone(current~bounding~box.north~east)\relax
- \pgf at pos@transform{\pgf at x}{\pgf at y}%
- \property_record:nn{#1}{xpos,ypos,abspage}
- \property_record:nn{#1-tr}{pgfx,pgfy}
- \tikz at scan@one at point\pgfutil at firstofone(current~bounding~box.south~west)\relax
- \pgf at pos@transform{\pgf at x}{\pgf at y}%
- \property_record:nn{#1-bl}{pgfx,pgfy}
- \tex_savepos:D
- }
-\cs_generate_variant:Nn \__tag_tikz_savepos:n {e}
-
-\NewProperty{pgfx}{now}{0}
- {
- \dim_compare:nNnTF {\dim_abs:n {\pgf at x}} > {15999pt}
- { 0 }
- { \dim_to_decimal_in_sp:n{\pgf at x} }
- }
-\NewProperty{pgfy}{now}{0}
- {
- \dim_compare:nNnTF {\dim_abs:n {\pgf at y}} > {15999pt}
- { 0 }
- { \dim_to_decimal_in_sp:n{\pgf at y} }
- }
-
-\cs_new_protected:Npn \__tag_tikz_getbbox:
- {
- \int_gincr:N\g__tag_graphic_int
- \tl_set:Ne\l__tag_graphic_currentlabel_tl {__tag_graphic_\int_use:N \g__tag_graphic_int}
- \tl_gset:Ne\g__tag_graphic_lx_tl
- {
- \dim_to_decimal_in_bp:n
- { \property_ref:een {\l__tag_graphic_currentlabel_tl}{xpos}{0}sp
- + \property_ref:een {\l__tag_graphic_currentlabel_tl-bl}{pgfx}{0}sp
- }
- }
- \tl_gset:Ne\g__tag_graphic_ly_tl
- {
- \dim_to_decimal_in_bp:n
- { \property_ref:een {\l__tag_graphic_currentlabel_tl}{ypos}{0}sp
- + \property_ref:een {\l__tag_graphic_currentlabel_tl-bl}{pgfy}{0}sp
- }
- }
- \tl_gset:Ne\g__tag_graphic_ux_tl
- {
- \dim_to_decimal_in_bp:n
- { \property_ref:een {\l__tag_graphic_currentlabel_tl}{xpos}{0}sp
- + \property_ref:een {\l__tag_graphic_currentlabel_tl-tr}{pgfx}{0}sp
- }
- }
- \tl_gset:Ne\g__tag_graphic_uy_tl
- {
- \dim_to_decimal_in_bp:n
- { \property_ref:een {\l__tag_graphic_currentlabel_tl}{ypos}{0}sp
- + \property_ref:een {\l__tag_graphic_currentlabel_tl-tr}{pgfy}{0}sp
- }
- }
- }
-
-\cs_new_protected:Npn \__tag_graphic_tikz_begin_picture:
- {
- \tag_mc_end_push:
- \bool_if:NTF \l__tag_graphic_artifact_bool
- { \tagmcbegin{artifact} }
- {
- \__tag_tikz_getbbox:
- \tagstructbegin{tag=Figure,alt=\l__tag_graphic_alt_tl}\tagmcbegin{}
- \__tag_prop_gput:cne
- { g__tag_struct_\int_eval:n {\c at g__tag_struct_abs_int}_prop }
- { A }
- {
- <<
- /O /Layout /BBox~
- [
- \g__tag_graphic_lx_tl\c_space_tl
- \g__tag_graphic_ly_tl\c_space_tl
- \g__tag_graphic_ux_tl\c_space_tl
- \g__tag_graphic_uy_tl
- ]
- >>
- }
- \bool_if:NT\l__tag_graphic_debug_bool
- {
- \__tag_graphic_show_bbox:VVVVne
- \g__tag_graphic_lx_tl
- \g__tag_graphic_ly_tl
- \g__tag_graphic_ux_tl
- \g__tag_graphic_uy_tl
- {red}
- {\int_use:N\g__tag_graphic_int}
- }
- }
- \SuspendTagging{tikz}
- }
-
-\cs_new_protected:Npn \__tag_graphic_tikz_end_picture:
- {
- \ResumeTagging{tikz}\tagmcend
- \bool_if:NF \l__tag_graphic_artifact_bool
- {
- \tagstructend
- \__tag_tikz_savepos:e {__tag_graphic_\int_use:N \g__tag_graphic_int}
- }
- \tag_mc_begin_pop:n{}
- }
-
-\tikzset
- {
- every~picture/.style=
- {
- artifact,
- execute~at~begin~picture=\__tag_graphic_tikz_begin_picture:,
- execute~at~end~picture=\__tag_graphic_tikz_end_picture:
- }
- }
-\AddToHook{env/tikzpicture/before}{\leavevmode}
-
-\tikzset
- {
- alt/.code=
- {
- \bool_set_false:N \l__tag_graphic_artifact_bool
- \tl_set:Nn \l__tag_graphic_alt_tl{#1}
- }
- }
-\tikzset
- {
- artifact/.code=
- \bool_set_true:N \l__tag_graphic_artifact_bool
- }
-
-\ExplSyntaxOff
-
-
-
-
-
-\endinput
More information about the latex3-commits
mailing list.