[latex3-commits] [latex3/tagpdf] develop: do not use null in K (8f3c48a)

github at latex-project.org github at latex-project.org
Sat Jan 13 00:50:57 CET 2024


Repository : https://github.com/latex3/tagpdf
On branch  : develop
Link       : https://github.com/latex3/tagpdf/commit/8f3c48a3b278dd35d4f511511d1af411edfdaf8e

>---------------------------------------------------------------

commit 8f3c48a3b278dd35d4f511511d1af411edfdaf8e
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sat Jan 13 00:50:57 2024 +0100

    do not use null in K


>---------------------------------------------------------------

8f3c48a3b278dd35d4f511511d1af411edfdaf8e
 CHANGELOG.md                       |  5 +++++
 tagpdf-struct.dtx                  | 40 +++++++++++++++++++++++++++++++-------
 testfiles/test-empty-mc.luatex.tpf | 28 +++++++++++++-------------
 3 files changed, 52 insertions(+), 21 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5cfc39d..6e2f89a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,8 +4,13 @@ All notable changes to the `tagpdf` package since the
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 this project uses date-based 'snapshot' version identifiers.
+## [Unreleased]
+
+### Fixed
+ - do not use null with luatex if there is no Kid.
 
 ## [2023-12-18]
+Version 0.98r
 
 ### Added 
   - support for tagging-sockets 
diff --git a/tagpdf-struct.dtx b/tagpdf-struct.dtx
index dd92598..7ba85b1 100644
--- a/tagpdf-struct.dtx
+++ b/tagpdf-struct.dtx
@@ -312,6 +312,12 @@
 \@@_seq_new:N  \g_@@_struct_objR_seq
 %    \end{macrocode}
 % \end{variable}
+% \begin{variable}{\c_@@_struct_null_tl}
+% In lua mode we have to test if the kids a null
+%    \begin{macrocode}
+\tl_const:Nn\c_@@_struct_null_tl {null}
+%    \end{macrocode}
+% \end{variable}
 
 % \begin{variable}{\g_@@_struct_cont_mc_prop}
 % in generic mode it can happen after
@@ -833,20 +839,40 @@
          {
            % in this case we need a special command in
            % luamode to get the array right. See issue #13
-           \bool_if:NT\g_@@_mode_lua_bool
+           \bool_if:NTF\g_@@_mode_lua_bool
              {
                \@@_struct_exchange_kid_command:c
                 {g_@@_struct_kids_#1_seq}
+%    \end{macrocode}
+% check if we get null
+%    \begin{macrocode}
+                \tl_set:Ne\l_@@_tmpa_tl
+                  {\use:e{\seq_item:cn {g__tag_struct_kids_#1_seq} {1}}}
+                \tl_if_eq:NNF\l__tag_tmpa_tl \c_@@_struct_null_tl 
+                  {   
+                    \@@_struct_prop_gput:nne
+                      {#1}            
+                      {K}
+                      {
+                        \seq_item:cn
+                          {
+                            g_@@_struct_kids_#1_seq
+                          }
+                          {1}
+                      } 
+                  }                 
              }
-           \@@_struct_prop_gput:nne
-             {#1}            
-             {K}
              {
-               \seq_item:cn
+               \@@_struct_prop_gput:nne
+                 {#1}            
+                 {K}
                  {
-                   g_@@_struct_kids_#1_seq
+                   \seq_item:cn
+                     {
+                       g_@@_struct_kids_#1_seq
+                     }
+                     {1}
                  }
-                 {1}
              }
          } %
       }
diff --git a/testfiles/test-empty-mc.luatex.tpf b/testfiles/test-empty-mc.luatex.tpf
index 6940046..46264f1 100644
--- a/testfiles/test-empty-mc.luatex.tpf
+++ b/testfiles/test-empty-mc.luatex.tpf
@@ -45,7 +45,7 @@ endobj
 <<  /Type /StructElem /S /Document /P 5 0 R /K [10 0 R 11 0 R] /ID (ID.01) >>
 endobj
 10 0 obj
-<<  /Type /StructElem /S /H1 /P 9 0 R /K null /ID (ID.02) >>
+<<  /Type /StructElem /S /H1 /P 9 0 R /ID (ID.02) >>
 endobj
 11 0 obj
 <<  /Type /StructElem /S /P /P 9 0 R /K <</Type /MCR /Pg 13 0 R /MCID 0>>  /ID (ID.03) >>
@@ -127,31 +127,31 @@ xref
 0000000003 00000 f 
 0000000004 00000 f 
 0000000008 00000 f 
-0000001583 00000 n 
+0000001575 00000 n 
 0000000536 00000 n 
 0000000715 00000 n 
 0000000000 00000 f 
 0000001307 00000 n 
 0000001400 00000 n 
-0000001477 00000 n 
+0000001469 00000 n 
 0000000366 00000 n 
 0000000224 00000 n 
 0000000020 00000 n 
-0000003783 00000 n 
-0000004137 00000 n 
+0000003775 00000 n 
+0000004129 00000 n 
 0000000500 00000 n 
 0000000577 00000 n 
 0000000678 00000 n 
-0000001684 00000 n 
-0000002767 00000 n 
-0000001737 00000 n 
-0000001803 00000 n 
-0000003003 00000 n 
-0000003937 00000 n 
-0000004199 00000 n 
-0000004301 00000 n 
+0000001676 00000 n 
+0000002759 00000 n 
+0000001729 00000 n 
+0000001795 00000 n 
+0000002995 00000 n 
+0000003929 00000 n 
+0000004191 00000 n 
+0000004293 00000 n 
 trailer
 << /Size 28 /Root 26 0 R /Info 27 0 R /ID [ <2350CAD05F8A7AF0AA4058486855344F> <2350CAD05F8A7AF0AA4058486855344F> ] >>
 startxref
-4435
+4427
 %%EOF





More information about the latex3-commits mailing list.