diff options
Diffstat (limited to 'macros/latex/contrib/tagpdf/tagpdf-struct.dtx')
-rw-r--r-- | macros/latex/contrib/tagpdf/tagpdf-struct.dtx | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/macros/latex/contrib/tagpdf/tagpdf-struct.dtx b/macros/latex/contrib/tagpdf/tagpdf-struct.dtx index 81211bd445..542671bd15 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.98g, released 2023-05-16} +% \date{Version 0.98h, released 2023-06-06} % \maketitle % \begin{documentation} % \section{Public Commands} @@ -247,7 +247,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-struct-code} {2023-05-16} {0.98g} +\ProvidesExplPackage {tagpdf-struct-code} {2023-06-06} {0.98h} {part of tagpdf - code related to storing structure} %</header> % \end{macrocode} @@ -837,16 +837,35 @@ { \pdf_object_if_exist:nTF { @@/struct/#1 } { +% \end{macrocode} +% It can happen that a structure is not used and so has not parent. +% Simply ignoring it is problematic as it is also recorded in +% the IDTree, so we make an artifact out of it. +% \begin{macrocode} + \prop_get:cnNF { g_@@_struct_#1_prop } {P}\l_@@_tmpb_tl + { + \prop_gput:cnx { g_@@_struct_#1_prop } {P}{\pdf_object_ref:n { @@/struct/0 }} + \prop_gput:cnx { g_@@_struct_#1_prop } {S}{/Artifact} + \seq_if_empty:cF {g_@@_struct_kids_#1_seq} + { + \msg_warning:nnxx + {tag} + {struct-orphan} + { #1 } + {\seq_count:c{g_@@_struct_kids_#1_seq}} + } + } \@@_struct_fill_kid_key:n { #1 } \@@_struct_get_dict_content:nN { #1 } \l_@@_tmpa_tl \exp_args:Nx - \pdf_object_write:nnx - { @@/struct/#1 } - {dict} - { - \l_@@_tmpa_tl\c_space_tl - /ID~\@@_struct_get_id:n{#1} - } + \pdf_object_write:nnx + { @@/struct/#1 } + {dict} + { + \l_@@_tmpa_tl\c_space_tl + /ID~\@@_struct_get_id:n{#1} + } + } { \msg_error:nnn { tag } { struct-no-objnum } { #1} @@ -1470,6 +1489,10 @@ { \tl_gset:Nx \g_@@_struct_tag_tl { \exp_last_unbraced:NV\use_i:nn \l_@@_tmpa_tl } + \prop_get:NVNT\g_@@_role_tags_NS_prop \g_@@_struct_tag_tl\l_@@_tmpa_tl + { + \tl_gset:Nx \g_@@_struct_tag_NS_tl { \l_@@_tmpa_tl } + } } %<debug>\@@_debug_struct_end_insert: } @@ -1703,7 +1726,7 @@ % \section{Attributes and attribute classes} % \begin{macrocode} %<*header> -\ProvidesExplPackage {tagpdf-attr-code} {2023-05-16} {0.98g} +\ProvidesExplPackage {tagpdf-attr-code} {2023-06-06} {0.98h} {part of tagpdf - code related to attributes and attribute classes} %</header> % \end{macrocode} |