summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tagpdf/tagpdf-struct.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/tagpdf/tagpdf-struct.dtx')
-rw-r--r--macros/latex/contrib/tagpdf/tagpdf-struct.dtx96
1 files changed, 55 insertions, 41 deletions
diff --git a/macros/latex/contrib/tagpdf/tagpdf-struct.dtx b/macros/latex/contrib/tagpdf/tagpdf-struct.dtx
index 3d2dace5d7..610d631333 100644
--- a/macros/latex/contrib/tagpdf/tagpdf-struct.dtx
+++ b/macros/latex/contrib/tagpdf/tagpdf-struct.dtx
@@ -50,7 +50,7 @@
% }^^A
% }
%
-% \date{Version 0.91, released 2021-07-03}
+% \date{Version 0.92, released 2021-08-27}
% \maketitle
% \begin{documentation}
% \section{Public Commands}
@@ -123,15 +123,15 @@
% Commands are not expanded. |title-o| will expand the value once.
% \end{function}
%
-% \begin{function}{alttext,alttext-o}
+% \begin{function}{alttext}
% This key inserts an \texttt{/Alt} value in the dictionary of structure object.
% The value is handled as verbatim string and hex encoded.
-% |alttext-o| will expand the value once.
+% The value will be expanded first once.
% \end{function}
-% \begin{function}{actualtext,actualtext-o}
+% \begin{function}{actualtext}
% This key inserts an \texttt{/ActualText} value in the dictionary of structure object.
% The value is handled as verbatim string and hex encoded.
-% |actualtext-o| will expand the value once.
+% The value will be expanded first once.
% \end{function}
% \begin{function}{lang}
% This key allows to set the language for a structure element. The value should be a bcp-identifier,
@@ -211,7 +211,7 @@
% \begin{macrocode}
%<@@=tag>
%<*header>
-\ProvidesExplPackage {tagpdf-struct-code} {2021-07-03} {0.91}
+\ProvidesExplPackage {tagpdf-struct-code} {2021-08-27} {0.92}
{part of tagpdf - code related to storing structure}
%</header>
% \end{macrocode}
@@ -238,6 +238,16 @@
\@@_seq_new:N \g_@@_struct_objR_seq
% \end{macrocode}
% \end{variable}
+
+% \begin{variable}{\g_@@_struct_cont_mc_prop}
+% in generic mode it can happen after
+% a page break that we have to inject into a structure
+% sequence an additional mc after. We will store this additional
+% info in a property. The key is the absolut mc num, the value the pdf directory.
+% \begin{macrocode}
+\@@_prop_new:N \g_@@_struct_cont_mc_prop
+% \end{macrocode}
+% \end{variable}
%
% \begin{variable}{\g_@@_struct_stack_seq}
% A stack sequence for the structure stack.
@@ -426,28 +436,44 @@
% Commands to store the kids. Kids in a structure can be a reference to a mc-chunk,
% an object reference to another structure element, or a object reference to an
% annotation (through an OBJR object).
-% \begin{macro}{\@@_struct_kid_mc_gput_right:nn}
+% \begin{macro}{\@@_struct_kid_mc_gput_right:nn,\@@_struct_kid_mc_gput_right:nx}
% The command to store an mc-chunk, this is a dictionary of type MCR.
% It would be possible to write out the content directly as unnamed object
% and to store only the object reference, but probably this would be slower,
% and the PDF is more readable like this.
% The code doesn't try to avoid the use of the /Pg key by checking page numbers.
% That imho only slows down without much gain.
+% In generic mode the page break code will perhaps to have to insert
+% an additional mcid after an existing one. For this we use a property list
+% At first an auxiliary to write the MCID dict. This should normally be expanded!
+% \begin{macrocode}
+\cs_new:Npn \@@_struct_mcid_dict:n #1 %#1 MCID absnum
+ {
+ <<
+ /Type \c_space_tl /MCR \c_space_tl
+ /Pg
+ \c_space_tl
+ \pdf_pageobject_ref:n { \@@_ref_value:enn{mcid-#1}{tagabspage}{1} }
+ /MCID \c_space_tl \@@_ref_value:enn{mcid-#1}{tagmcid}{1}
+ >>
+ }
+% \end{macrocode}
% \begin{macrocode}
\cs_new_protected:Npn \@@_struct_kid_mc_gput_right:nn #1 #2 %#1 structure num, #2 MCID absnum%
{
\@@_seq_gput_right:cx
{ g_@@_struct_kids_#1_seq }
{
- <<
- /Type \c_space_tl /MCR \c_space_tl
- /Pg
- \c_space_tl
- \pdf_pageobject_ref:n { \@@_ref_value:enn{mcid-#2}{tagabspage}{1} }
- /MCID \c_space_tl \@@_ref_value:enn{mcid-#2}{tagmcid}{1}
- >>
+ \@@_struct_mcid_dict:n {#2}
+ }
+ \@@_seq_gput_right:cn
+ { g_@@_struct_kids_#1_seq }
+ {
+ \prop_item:Nn \g_@@_struct_cont_mc_prop {#2}
}
}
+\cs_generate_variant:Nn \@@_struct_kid_mc_gput_right:nn {nx}
+
% \end{macrocode}
% \end{macro}
% \begin{macro}
@@ -522,6 +548,18 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_struct_fill_kid_key:n #1 %#1 is the struct num
{
+ \bool_if:NF\g_@@_mode_lua_bool
+ {
+ \seq_clear:N \l_@@_tmpa_seq
+ \seq_map_inline:cn { g_@@_struct_kids_#1_seq }
+ { \seq_put_right:Nx \l_@@_tmpa_seq { ##1 } }
+ %\seq_show:c { g_@@_struct_kids_#1_seq }
+ %\seq_show:N \l_@@_tmpa_seq
+ \seq_remove_all:Nn \l_@@_tmpa_seq {}
+ %\seq_show:N \l_@@_tmpa_seq
+ \seq_gset_eq:cN { g_@@_struct_kids_#1_seq } \l_@@_tmpa_seq
+ }
+
\int_case:nnF
{
\seq_count:c
@@ -706,8 +744,8 @@
% {
% label,stash,tag,
% title,title-o,
-% alttext,alttext-o,
-% actualtext,actualtext-o
+% alttext,
+% actualtext,
% lang,ref,E
% }
% \begin{macrocode}
@@ -759,18 +797,6 @@
},
alttext .code:n = % Alt property
{
- \str_set_convert:Nnon
- \l_@@_tmpa_str
- { #1 }
- { default }
- { utf16/hex }
- \@@_prop_gput:cnx
- { g_@@_struct_\int_eval:n {\c@g_@@_struct_abs_int}_prop }
- { Alt }
- { <\l_@@_tmpa_str> }
- },
- alttext-o .code:n = % Alt property
- {
\str_set_convert:Noon
\l_@@_tmpa_str
{ #1 }
@@ -783,18 +809,6 @@
},
actualtext .code:n = % ActualText property
{
- \str_set_convert:Nnon
- \l_@@_tmpa_str
- { #1 }
- { default }
- { utf16/hex }
- \@@_prop_gput:cnx
- { g_@@_struct_\int_eval:n {\c@g_@@_struct_abs_int}_prop }
- { ActualText }
- { <\l_@@_tmpa_str>}
- },
- actualtext-o .code:n = % ActualText property
- {
\str_set_convert:Noon
\l_@@_tmpa_str
{ #1 }
@@ -1059,7 +1073,7 @@
% \section{Attributes and attribute classes}
% \begin{macrocode}
%<*header>
-\ProvidesExplPackage {tagpdf-attr-code} {2021-07-03} {0.91}
+\ProvidesExplPackage {tagpdf-attr-code} {2021-08-27} {0.92}
{part of tagpdf - code related to attributes and attribute classes}
%</header>
% \end{macrocode}