diff options
author | Norbert Preining <norbert@preining.info> | 2023-05-17 03:01:58 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-05-17 03:01:58 +0000 |
commit | 92ffb9032b85f818a8d3b469ad4d3889c2a44ba1 (patch) | |
tree | 54bc1ce009357117a376baa5ffa223f904acee4f /macros/latex/contrib/tagpdf/tagpdf-struct.dtx | |
parent | 95bdae3d8a40af1f2f82f786dc29d3761fe431f1 (diff) |
CTAN sync 202305170301
Diffstat (limited to 'macros/latex/contrib/tagpdf/tagpdf-struct.dtx')
-rw-r--r-- | macros/latex/contrib/tagpdf/tagpdf-struct.dtx | 102 |
1 files changed, 81 insertions, 21 deletions
diff --git a/macros/latex/contrib/tagpdf/tagpdf-struct.dtx b/macros/latex/contrib/tagpdf/tagpdf-struct.dtx index 6d4d14fb89..81211bd445 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-struct.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-struct.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98f, released 2023-04-24} +% \date{Version 0.98g, released 2023-05-16} % \maketitle % \begin{documentation} % \section{Public Commands} @@ -247,7 +247,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-struct-code} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf-struct-code} {2023-05-16} {0.98g} {part of tagpdf - code related to storing structure} %</header> % \end{macrocode} @@ -303,13 +303,6 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}{\g_@@_struct_tag_NS_prop} -% For the parent-child check, we need the tag and NS of every structure -% \begin{macrocode} -\prop_new:N\g_@@_struct_tag_NS_prop -% \end{macrocode} -% \end{variable} -% % % \begin{variable}{\g_@@_struct_stack_current_tl,\l_@@_struct_stack_parent_tmpa_tl} % The global variable will hold the current structure number. It is already @@ -516,16 +509,17 @@ { parentrole } { {StructTreeRoot}{pdf} } -\prop_gput:Nnn \g_@@_struct_tag_NS_prop {0}{{StructTreeRoot}{pdf}} % \end{macrocode} -% Namespaces are pdf 2.0 but it doesn't harm -% to have an empty entry. We could add a test, but if the code moves into -% the kernel, timing could get tricky. +% Namespaces are pdf 2.0. +% If the code moves into the kernel, the setting must be probably delayed. % \begin{macrocode} -\@@_prop_gput:cnx - { g_@@_struct_0_prop } - { Namespaces } - { \pdf_object_ref:n { @@/tree/namespaces } } +\pdf_version_compare:NnF < {2.0} + { + \@@_prop_gput:cnx + { g_@@_struct_0_prop } + { Namespaces } + { \pdf_object_ref:n { @@/tree/namespaces } } + } % \end{macrocode} % \end{variable} % @@ -562,7 +556,6 @@ { g_@@_struct_#1_prop } { S } { \pdf_name_from_unicode_e:n {#2} } % - \prop_gput:Nnn \g_@@_struct_tag_NS_prop {#1}{{#2}{#3}} } } { @@ -579,7 +572,6 @@ { NS } { \l_@@_get_tmpc_tl } % } - \prop_gput:Nnn \g_@@_struct_tag_NS_prop {#1}{{#2}{#3}} } } \cs_generate_variant:Nn \@@_struct_set_tag_info:nnn {eVV} @@ -1553,7 +1545,75 @@ %</package> % \end{macrocode} % \end{macro} -% +% \begin{macro}{\tag_struct_use_num:n} +% This command allows to use a stashed structure in another place. +% differently to the previous command it doesn't use a label but directly +% a structure number to find the parent. +% TODO: decide how it should be guarded. Probably by the struct-check. +% \begin{macrocode} +%<base>\cs_new_protected:Npn \tag_struct_use_num:n #1 {} +%<*package> +\cs_set_protected:Npn \tag_struct_use_num:n #1 %#1 is structure number + { + \@@_check_if_active_struct:T + { + \prop_if_exist:cTF + { g_@@_struct_#1_prop } % + { + \prop_get:cnNT + {g_@@_struct_#1_prop} + {P} + \l_@@_tmpa_tl + { + \msg_warning:nnn { tag } {struct-used-twice} {#1} + } + %add the label structure as kid to the current structure (can be the root) + \@@_struct_kid_struct_gput_right:xx + { \g_@@_struct_stack_current_tl } + { #1 } + %add the current structure to the labeled one as parents + \@@_prop_gput:cnx + { g_@@_struct_#1_prop } + { P } + { + \pdf_object_ref:e { @@/struct/\g_@@_struct_stack_current_tl } + } +% \end{macrocode} +% check if the tag is allowed as child. Here we have to retrieve the +% tag info for the child, while the data for the parent is in +% the global tl-vars: +% \begin{macrocode} + \@@_struct_get_parentrole:eNN + {#1} + \l_@@_tmpa_tl + \l_@@_tmpb_tl + \@@_check_parent_child:VVVVN + \g_@@_struct_tag_tl + \g_@@_struct_tag_NS_tl + \l_@@_tmpa_tl + \l_@@_tmpb_tl + \l_@@_parent_child_check_tl + \int_compare:nNnT {\l_@@_parent_child_check_tl}<0 + { + \cs_set_eq:NN \l_@@_role_remap_tag_tl \g_@@_struct_tag_tl + \cs_set_eq:NN \l_@@_role_remap_NS_tl \g_@@_struct_tag_NS_tl + \@@_role_remap: + \cs_gset_eq:NN \g_@@_struct_tag_tl \l_@@_role_remap_tag_tl + \cs_gset_eq:NN \g_@@_struct_tag_NS_tl \l_@@_role_remap_NS_tl + \@@_struct_set_tag_info:eVV + { \int_eval:n {\c@g_@@_struct_abs_int} } + \g_@@_struct_tag_tl + \g_@@_struct_tag_NS_tl + } + } + { + \msg_warning:nnn{ tag }{struct-label-unknown}{#1} + } + } + } +%</package> +% \end{macrocode} +% \end{macro} % \begin{macro}[EXP]{\tag_struct_object_ref:n} % This is a command that allows to reference a structure. The argument is the % number which can be get for the current structure with |\tag_get:n{struct_num}| @@ -1643,7 +1703,7 @@ % \section{Attributes and attribute classes} % \begin{macrocode} %<*header> -\ProvidesExplPackage {tagpdf-attr-code} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf-attr-code} {2023-05-16} {0.98g} {part of tagpdf - code related to attributes and attribute classes} %</header> % \end{macrocode} |