diff options
author | Karl Berry <karl@freefriends.org> | 2022-01-13 21:05:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-01-13 21:05:40 +0000 |
commit | d8a708abc1ed023e582f732ac87e906bba4d884c (patch) | |
tree | 3212c9992cf00ad728c8dceb83f414377b6fcebf /Master/texmf-dist/source | |
parent | 031d7dac6f41c0c635cb8e8fa08cf794a1cc80c1 (diff) |
tagpdf (13jan22)
git-svn-id: svn://tug.org/texlive/trunk@61600 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
12 files changed, 666 insertions, 160 deletions
diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx index f28a02ea6eb..dcf7afb8234 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx @@ -2,7 +2,7 @@ % %% File: tagpdf-backend.dtx % -% Copyright (C) 2019-2021 Ulrike Fischer +% Copyright (C) 2019-2022 Ulrike Fischer % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -51,13 +51,13 @@ % }^^A % } % -% \date{Version 0.92, released 2021-08-27} +% \date{Version 0.93, released 2022-01-13} % \maketitle % \begin{implementation} % \begin{macrocode} %<@@=tag> %<*luatex> -\ProvidesExplFile {tagpdf-luatex.def} {2021-08-27} {0.92} +\ProvidesExplFile {tagpdf-luatex.def} {2022-01-13} {0.93} {tagpdf~driver~for~luatex} % \end{macrocode} % \section{Loading the lua} @@ -161,8 +161,8 @@ local ProvidesLuaModule = { name = "tagpdf", - version = "0.92", --TAGVERSION - date = "2021-08-27", --TAGDATE + version = "0.93", --TAGVERSION + date = "2022-01-13", --TAGDATE description = "tagpdf lua code", license = "The LATEX Project Public License 1.3c" } @@ -739,11 +739,6 @@ end ltx.@@.func.markspaceoff=@@_deactivate_mark_space % \end{macrocode} % \end{macro} -% \begin{macro} -% { -% default_space_char, -% default_fontid, -% } % We need two local variable to setup a default space char. % \begin{macrocode} local default_space_char = node.new(GLYPH) @@ -751,7 +746,6 @@ local default_fontid = font.id("TU/lmr/m/n/10") default_space_char.char = 32 default_space_char.font = default_fontid % \end{macrocode} -% \end{macro} % \begin{macro} % { % @@_space_chars_shipout, diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx index 5cdbc60cf65..53f97383f88 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx @@ -2,7 +2,7 @@ % %% File: tagpdf-checks.dtx % -% Copyright (C) 2019-2021 Ulrike Fischer +% Copyright (C) 2019-2022 Ulrike Fischer % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -52,7 +52,7 @@ % }^^A % } % -% \date{Version 0.92, released 2021-08-27} +% \date{Version 0.93, released 2022-01-13} % \maketitle % \begin{documentation} % \section{Commands} @@ -245,13 +245,60 @@ % INFO PARENTTREE-NUMENTRY & 3 \\ % INFO PARENTTREE-STRUCT-OBJREF & 4 % \end{longtable} - +% +% \subsection{Debug mode messages and code} +% If the package tagpdf-debug is loaded a number of commands are redefined and +% enhanced with additional commands which can be used to output debug messages or +% collect statistics. The commands are present but do nothing if the log-level is zero. +% \begin{tabular}{llll} +% command & name & action & remark\\\hline +% |\tag_mc_begin:n| & mc-begin-insert & msg \\ +% & mc-begin-ignore & msg & if inactive \\ +% \end{tabular} +% +% \subsection{Messages} +% \begin{function}{ +% mc-nested, +% mc-tag-missing, +% mc-label-unknown, +% mc-used-twice, +% mc-used-twice, +% mc-not-open, +% mc-pushed, +% mc-popped, +% mc-current} +% Various messages related to mc-chunks. TODO document their meaning. +% \end{function} +% \begin{function}{struct-no-objnum,struct-faulty-nesting, +% struct-missing-tag,struct-used-twice,struct-label-unknown,struct-show-closing} +% Various messages related to structure. TODO document their meaning. +% \end{function} +% +% \begin{function}{attr-unknown} +% Message if an attribute i sunknown. +% \end{function} +% +% \begin{function}{role-missing,role-unknown,role-unknown-tag,role-tag,new-tag} +% Messages related to role mapping. +% \end{function} +% +% \begin{function}{tree-mcid-index-wrong} +% Used in the tree code, typically indicates the document must be rerun. +% \end{function} +% +% \begin{function}{sys-no-interwordspace} +% Message if an engine doesn't support inter word spaces +% \end{function} +% +% \begin{function}{para-hook-count-wrong} +% Message if the number of begin paragraph and end paragraph differ. This normally means faulty structure. +% \end{function} % \end{documentation} % \begin{implementation} % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-checks-code} {2021-08-27} {0.92} +\ProvidesExplPackage {tagpdf-checks-code} {2022-01-13} {0.93} {part of tagpdf - code related to checks, conditionals, debugging and messages} %</header> % \end{macrocode} @@ -791,5 +838,88 @@ % \begin{macrocode} %</package> % \end{macrocode} +% \begin{macrocode} +%<*debug> +% \end{macrocode} +% Code for tagpdf-debug. This will probably change over time. +% At first something for the mc commands. +% \begin{macrocode} +\msg_new:nnn { tag / debug } {mc-begin} { MC~begin~#1~with~options:~\tl_to_str:n{#2}~[\msg_line_context:] } +\msg_new:nnn { tag / debug } {mc-end} { MC~end~#1~[\msg_line_context:] } + +\cs_new_protected:Npn \@@_debug_mc_begin_insert:n #1 + { + \int_compare:nNnT { \l_@@_loglevel_int } > {0} + { + \msg_note:nnnn { tag / debug } {mc-begin} {inserted} { #1 } + } + } +\cs_new_protected:Npn \@@_debug_mc_begin_ignore:n #1 + { + \int_compare:nNnT { \l_@@_loglevel_int } > {0} + { + \msg_note:nnnn { tag / debug } {mc-begin } {ignored} { #1 } + } + } +\cs_new_protected:Npn \@@_debug_mc_end_insert: + { + \int_compare:nNnT { \l_@@_loglevel_int } > {0} + { + \msg_note:nnn { tag / debug } {mc-end} {inserted} + } + } +\cs_new_protected:Npn \@@_debug_mc_end_ignore: + { + \int_compare:nNnT { \l_@@_loglevel_int } > {0} + { + \msg_note:nnn { tag / debug } {mc-end } {ignored} + } + } +% \end{macrocode} +% And now something for the structures +% \begin{macrocode} +\msg_new:nnn { tag / debug } {struct-begin} + { + Struct~begin~#1~with~options:~\tl_to_str:n{#2}~[\msg_line_context:] + } +\msg_new:nnn { tag / debug } {struct-end} + { + Struct~end~#1~[\msg_line_context:] + } + +\cs_new_protected:Npn \@@_debug_struct_begin_insert:n #1 + { + \int_compare:nNnT { \l_@@_loglevel_int } > {0} + { + \msg_note:nnnn { tag / debug } {struct-begin} {inserted} { #1 } + \seq_log:N \g_@@_struct_tag_stack_seq + } + } +\cs_new_protected:Npn \@@_debug_struct_begin_ignore:n #1 + { + \int_compare:nNnT { \l_@@_loglevel_int } > {0} + { + \msg_note:nnnn { tag / debug } {struct-begin } {ignored} { #1 } + } + } +\cs_new_protected:Npn \@@_debug_struct_end_insert: + { + \int_compare:nNnT { \l_@@_loglevel_int } > {0} + { + \msg_note:nnn { tag / debug } {struct-end} {inserted} + \seq_log:N \g_@@_struct_tag_stack_seq + } + } +\cs_new_protected:Npn \@@_debug_struct_end_ignore: + { + \int_compare:nNnT { \l_@@_loglevel_int } > {0} + { + \msg_note:nnn { tag / debug } {struct-end } {ignored} + } + } +% \end{macrocode} +% \begin{macrocode} +%</debug> +% \end{macrocode} % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx index 903b38d5a35..994e3b0b851 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx @@ -2,7 +2,7 @@ % %% File: tagpdf-mc.dtx % -% Copyright (C) 2019-2021 Ulrike Fischer +% Copyright (C) 2019-2022 Ulrike Fischer % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -50,7 +50,7 @@ % }^^A % } % -% \date{Version 0.92, released 2021-08-27} +% \date{Version 0.93, released 2022-01-13} % \maketitle % \begin{documentation} % \end{documentation} @@ -59,9 +59,13 @@ % \begin{macrocode} %<@@=tag> %<*generic> -\ProvidesExplPackage {tagpdf-mc-code-generic} {2021-08-27} {0.92} +\ProvidesExplPackage {tagpdf-mc-code-generic} {2022-01-13} {0.93} {part of tagpdf - code related to marking chunks - generic mode} %</generic> +%<*debug> +\ProvidesExplPackage {tagpdf-debug-generic} {2022-01-13} {0.93} + {part of tagpdf - debugging code related to marking chunks - generic mode} +%</debug> % \end{macrocode} % %\subsection{Variables} @@ -653,6 +657,7 @@ % It is use by the get command. % \begin{macrocode} \cs_new:Nn \@@_get_data_mc_tag: { \g_@@_mc_key_tag_tl } +%</generic> % \end{macrocode} % \end{macro} % @@ -663,10 +668,20 @@ % the state is passed to the end command through a global var and % a global boolean. % \begin{macrocode} +%<*generic|debug> +%<*generic> \cs_new_protected:Npn \tag_mc_begin:n #1 %#1 keyval { \@@_check_if_active_mc:T { +%</generic> +%<*debug> +\cs_set_protected:Npn \tag_mc_begin:n #1 %#1 keyval + { + \@@_check_if_active_mc:TF + { + \@@_debug_mc_begin_insert:n { #1 } +%</debug> \group_begin: %hm \@@_check_mc_if_nested: \bool_gset_true:N \g_@@_in_mc_bool @@ -695,18 +710,38 @@ } \group_end: } +%<*debug> + { + \@@_debug_mc_begin_ignore:n { #1 } + } +%</debug> } +%<*generic> \cs_new_protected:Nn \tag_mc_end: { \@@_check_if_active_mc:T { +%</generic> +%<*debug> +\cs_set_protected:Nn \tag_mc_end: + { + \@@_check_if_active_mc:TF + { + \@@_debug_mc_end_insert: +%</debug> \@@_check_mc_if_open: \bool_gset_false:N \g_@@_in_mc_bool \tl_gset:Nn \g_@@_mc_key_tag_tl { } \@@_mc_emc: \@@_mc_end_marks: } +%<*debug> + { + \@@_debug_mc_end_ignore: + } +%</debug> } +%</generic|debug> % \end{macrocode} % \end{macro} @@ -717,12 +752,15 @@ % we assume that their values are safe. % \begin{macro} % { -% tag,raw, -% alttext, -% actualtext, -% label,artifact +% tag (mc-key), +% raw (mc-key), +% alttext (mc-key), +% actualtext (mc-key), +% label (mc-key), +% artifact (mc-key) % } % \begin{macrocode} +%<*generic> \keys_define:nn { @@ / mc } { tag .code:n = % the name (H,P,Span) etc diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx index 2698b7ad594..d8dba57fd1b 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx @@ -2,7 +2,7 @@ % %% File: tagpdf-mc.dtx % -% Copyright (C) 2019-2021 Ulrike Fischer +% Copyright (C) 2019-2022 Ulrike Fischer % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -50,9 +50,8 @@ % }^^A % } % -% \date{Version 0.92, released 2021-08-27} +% \date{Version 0.93, released 2022-01-13} % \maketitle - % \begin{implementation} % The code is splitted into three parts: code shared by all engines, % code specific to luamode and code not used by luamode. @@ -91,7 +90,7 @@ % \begin{macrocode} %<@@=tag> %<*luamode> -\ProvidesExplPackage {tagpdf-mc-code-lua} {2021-08-27} {0.92} +\ProvidesExplPackage {tagpdf-mc-code-lua} {2022-01-13} {0.93} {tagpdf - mc code only for the luamode } %</luamode> % \end{macrocode} @@ -159,7 +158,7 @@ \cs_new_protected:Npn \@@_add_missing_mcs_to_stream:Nn #1#2 {} % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_mc_if_in:,\tag_mc_if_in:} +% \begin{macro}[pTF]{\@@_mc_if_in:,\tag_mc_if_in:} % This tests, if we are in an mc, for attributes % this means to check against a number. % \begin{macrocode} @@ -358,10 +357,12 @@ % \subsection{Key definitions} % \begin{macro} % { -% tag,raw, -% alttext, -% actualtext, -% label,artifact +% tag (mc-key), +% raw (mc-key), +% alttext (mc-key), +% actualtext (mc-key), +% label (mc-key), +% artifact (mc-key) % } % TODO: check conversion, check if local/global setting is right. % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx index 17f6df0fcfc..852f1d0846f 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx @@ -2,7 +2,7 @@ % %% File: tagpdf-mc.dtx % -% Copyright (C) 2019-2021 Ulrike Fischer +% Copyright (C) 2019-2022 Ulrike Fischer % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -50,7 +50,7 @@ % }^^A % } % -% \date{Version 0.92, released 2021-08-27} +% \date{Version 0.93, released 2022-01-13} % \maketitle % \begin{documentation} % \section{Public Commands} @@ -120,7 +120,7 @@ % The following keys can be used with |\tag_mc_begin:n|, |\tagmcbegin|, % |\tag_mc_begin_pop:n|, % -% \begin{function}{tag} +% \begin{function}{tag (mc-key)} % This key is required, unless artifact is used. % The value is a tag like |P| or |H1| without a slash at the begin, % this is added by the code. @@ -131,7 +131,7 @@ % (some ascii with numbers like \texttt{H4} is fine). % \end{function} % -% \begin{function}{artifact} +% \begin{function}{artifact (mc-key)} % This will setup the marked content as an artifact. The key should be used % for content that should be ignored. % The key can take one of the values |pagination|, @@ -139,33 +139,33 @@ % (this is the default). % \end{function} % -% \begin{function}{raw} +% \begin{function}{raw (mc-key)} % This key allows to add more entries to the properties dictionary. % The value must be correct, low-level PDF. E.g. % \verb+raw=/Alt (Hello)+ will insert an alternative Text. % \end{function} % -% \begin{function}{alttext} +% \begin{function}{alttext (mc-key)} % This key inserts an \texttt{/Alt} value in the property dictionary of the BDC operator. % The value is handled as verbatim string, commands are not expanded. % The value will be expanded first once. % \end{function} % -% \begin{function}{actualtext} +% \begin{function}{actualtext (mc-key)} % This key inserts an \texttt{/ActualText} value in the property dictionary % of the BDC operator. The value is handled as verbatim string, % commands are not expanded. % The value will be expanded first once. % \end{function} % -% \begin{function}{label} +% \begin{function}{label (mc-key)} % This key sets a label by which one can call the marked content % later in another structure % (if it has been stashed with the |stash| key). % Internally the label name will start with \texttt{tagpdf-}. % \end{function} % -% \begin{function}{stash} +% \begin{function}{stash (mc-key)} % This \enquote{stashes} an mc-chunk: it is not inserted into the current structure. % It should be normally be used along with a label to be able to use the mc-chunk % in another place. @@ -178,7 +178,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-mc-code-shared} {2021-08-27} {0.92} +\ProvidesExplPackage {tagpdf-mc-code-shared} {2022-01-13} {0.93} {part of tagpdf - code related to marking chunks - code shared by generic and luamode } %</header> @@ -407,7 +407,7 @@ % \subsection{Keys} % This are the keys where the code can be shared between the modes. % -% \begin{macro}{stash,__artifact-bool,__artifact-type} +% \begin{macro}{stash (mc-key),__artifact-bool,__artifact-type} % the two internal artifact keys are use to define the public |artifact|. % For now we add support for the subtypes Header and Footer. % Watermark,PageNum, LineNum,Redaction,Bates will be added if some use case diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx index 78dccdc02ac..f8b0589bb5f 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx @@ -2,7 +2,7 @@ % %% File: tagpdf-roles.dtx % -% Copyright (C) 2019-2021 Ulrike Fischer +% Copyright (C) 2019-2022 Ulrike Fischer % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -50,13 +50,48 @@ % }^^A % } % -% \date{Version 0.92, released 2021-08-27} +% \date{Version 0.93, released 2022-01-13} % \maketitle +% \begin{documentation} +% \begin{function} +% { +% add-new-tag (setup-key), +% tag (rolemap-key), +% namespace (rolemap-key), +% role (rolemap-key), +% role-namespace (rolemap-key) +% } +% This key can be used in \cs{tagpdfsetup} to declare and rolemap new tags. +% It takes as value a key-value list or a simple |new-tag/old-tag|. +% +% The key-value list knows the following keys: +% \begin{description} +% \item[\texttt{tag}] This is the name of the new type as it should then be used in \cs{tagstructbegin}. +% \item[\texttt{namespace}] This is the namespace of the new type. +% The value should be a shorthand of a namespace. +% The allowed values are currently |pdf|, |pdf2|, |mathml| and |user|. +% The default value (and recommended value for a new tag) is |user|. +% The public name of the user namespace is |tag/NS/user|. This can be used to reference +% the namespace e.g. in attributes. +% \item[\texttt{role}] This is the type the tag should be mapped too. +% In a PDF 1.7 or earlier this is normally a type from the |pdf| set, +% in PDF 2.0 from the |pdf|, |pdf2| and |mathml| set. +% It can also be a user type, or a still unknown type. +% The PDF format allows mapping to be done transitively. +% But tagpdf can't/won't check such unusual role mapping. +% \item[\texttt{role-namespace}] If the role is a known type +% the default value is the default namespace of this type. +% If the role is unknown, |user| is used and +% the code hopes that the type will be defined later. With this key a specific +% namespace can be forced. +% \end{description} +% \end{function} +% \end{documentation} % \begin{implementation} % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-roles-code} {2021-08-27} {0.92} +\ProvidesExplPackage {tagpdf-roles-code} {2022-01-13} {0.93} {part of tagpdf - code related to roles and structure names} %</header> % \end{macrocode} @@ -631,9 +666,15 @@ % \end{macrocode} % \end{macro} % \subsection{Key-val user interface} -% The user interface use the key |add-new-tag|, which takes either a +% The user interface uses the key |add-new-tag|, which takes either a % keyval list as argument, or a tag/role. -% \begin{macro}{tag,tag-namespace,role,role-namespace,add-new-tag} +% \begin{macro} +% { +% tag (rolemap-key), +% tag-namespace (rolemap-key), +% role (rolemap-key), +% role-namespace (rolemap-key), +% add-new-tag (setup-key)} % \begin{macrocode} \keys_define:nn { @@ / tag-role } { diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx index c2a999cc1bd..40c4367ba2a 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx @@ -2,7 +2,7 @@ % %% File: tagpdf-space.dtx % -% Copyright (C) 2019-2021 Ulrike Fischer +% Copyright (C) 2019-2022 Ulrike Fischer % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -50,13 +50,25 @@ % }^^A % } % -% \date{Version 0.92, released 2021-08-27} +% \date{Version 0.93, released 2022-01-13} % \maketitle +% \begin{documentation} +% \begin{function}{interwordspace (setup-key)} +% This key allows to activate/deactivate the real space chars if the engine supports +% it. The allowed values are |true|, |on|, |false|, |off|. +% \end{function} +% \begin{function}{show-spaces (setup-key)} +% This key works only with luatex and shows with small red +% bars where spaces have been inserted. This is only for debugging and +% is not completly reliable (and change affect other literals and tagging), so it +% should be used with care. +% \end{function} +% \end{documentation} % \begin{implementation} % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-space-code} {2021-08-27} {0.92} +\ProvidesExplPackage {tagpdf-space-code} {2022-01-13} {0.93} {part of tagpdf - code related to real space chars} %</header> % \end{macrocode} @@ -65,7 +77,7 @@ % support real space chars. Most of the code for luatex which uses attributes % is in the lua code, here are only the keys. % -% \begin{macro}{interwordspace,show-spaces} +% \begin{macro}{interwordspace (setup-key),show-spaces (setup-key)} % \begin{macrocode} %<*package> \sys_if_engine_pdftex:T diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx index 610d6313331..6f03c5ac0fe 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx @@ -2,7 +2,7 @@ % %% File: tagpdf-struct.dtx % -% Copyright (C) 2019-2021 Ulrike Fischer +% Copyright (C) 2019-2022 Ulrike Fischer % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -50,7 +50,7 @@ % }^^A % } % -% \date{Version 0.92, released 2021-08-27} +% \date{Version 0.93, released 2022-01-13} % \maketitle % \begin{documentation} % \section{Public Commands} @@ -94,9 +94,9 @@ % \end{function} % \section{Public keys} % \subsection{Keys for the structure commands} -% \begin{function}{tag} +% \begin{function}{tag (struct-key)} % This is required. The value of the key is normally one of the -% standard types listed in section \ref{sec:new-tag}. +% standard types listed in the main tagpdf documentation. % It is possible to setup new tags/types. % The value can also be of the form |type/NS|, where |NS| is the % shorthand of a declared name space. @@ -104,54 +104,54 @@ % This allows to use a different name space than % the one connected by default to the tag. But normally this should not be needed. % \end{function} -% \begin{function}{stash} +% \begin{function}{stash (struct-key)} % Normally a new structure inserts itself as a kid % into the currently active structure. This key prohibits this. % The structure is nevertheless from now on % \enquote{the current active structure} % and parent for following marked content and structures. % \end{function} -% \begin{function}{label} +% \begin{function}{label (struct-key)} % This key sets a label by which % one can use the structure later in another structure. % Internally the label name will start with \texttt{tagpdfstruct-}. % \end{function} -% \begin{function}{title,title-o} +% \begin{function}{title (struct-key),title-o (struct-key)} % This keys allows to set the dictionary entry % \texttt{/Title} in the structure object. % The value is handled as verbatim string and hex encoded. % Commands are not expanded. |title-o| will expand the value once. % \end{function} % -% \begin{function}{alttext} +% \begin{function}{alttext (struct-key)} % This key inserts an \texttt{/Alt} value in the dictionary of structure object. % The value is handled as verbatim string and hex encoded. % The value will be expanded first once. % \end{function} -% \begin{function}{actualtext} +% \begin{function}{actualtext (struct-key)} % This key inserts an \texttt{/ActualText} value in the dictionary of structure object. % The value is handled as verbatim string and hex encoded. % The value will be expanded first once. % \end{function} -% \begin{function}{lang} +% \begin{function}{lang (struct-key)} % This key allows to set the language for a structure element. The value should be a bcp-identifier, % e.g. |de-De|. % \end{function} -% \begin{function}{ref} +% \begin{function}{ref (struct-key)} % This key allows to add references to other structure elements, % it adds the |/Ref| array to the structure. % The value should be a comma separated list of structure labels % set with the |label| key. e.g. |ref={label1,label2}|. % \end{function} -% \begin{function}{E} +% \begin{function}{E (struct-key)} % This key sets the |/E| key, the expanded form of an % abbreviation or an acronym % (I couldn't think of a better name, so I sticked to E). % \end{function} -% \begin{function}{AF,AFinline,AFinline-o} +% \begin{function}{AF (struct-key),AFinline (struct-key),AFinline-o (struct-key)} % \begin{syntax} % AF = \meta{object name}\\ -% AF-inline = \meta{text content} +% AF-inline = \meta{text content}\\ % \end{syntax} % These keys allows to reference an associated file in the structure element. % The value \meta{object name} should be the name of an object pointing @@ -165,9 +165,11 @@ % Future versions will perhaps extend this to more mime types, but it is % still a research task to find out what is really needed. % +% |AF| can be used more than once, to associate more than one file. The inline +% keys can be used only once per structure. Additional calls are ignored. % \end{function} % -% \begin{function}{attribute} +% \begin{function}{attribute (struct-key)} % This key takes as argument a comma list of attribute names % (use braces to protect the commas from the external key-val parser) % and allows to add one or more attribute dictionary entries in @@ -179,7 +181,7 @@ % % \end{function} % -% \begin{function}{attribute-class} +% \begin{function}{attribute-class (struct-key)} % This key takes as argument a comma list of attribute class names % (use braces to protect the commas from the external key-val parser) % and allows to add one or more attribute classes to the structure object. @@ -188,7 +190,7 @@ % must be declared first in \cs{tagpdfsetup}. % \end{function} % \subsection{Setup keys} -% \begin{function}{newattribute} +% \begin{function}{newattribute (setup-key)} % \begin{syntax} % newattribute = \Arg{name}\Arg{Content} % \end{syntax} @@ -206,12 +208,20 @@ % \end{verbatim} % % \end{function} +% \begin{function}{root-AF (setup-key)} +% \begin{syntax} +% root-AF = \meta{object name} +% \end{syntax} +% This key can be used in the setup command \cs{tagpdfsetup} and allows +% to add associated files to the root structure. Like |AF| it can be used more than +% once to add more than one file. +% \end{function} % \end{documentation} % \begin{implementation} % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-struct-code} {2021-08-27} {0.92} +\ProvidesExplPackage {tagpdf-struct-code} {2022-01-13} {0.93} {part of tagpdf - code related to storing structure} %</header> % \end{macrocode} @@ -313,7 +323,8 @@ ParentTreeNextKey, % optional RoleMap, ClassMap, - Namespaces + Namespaces, + AF %pdf 2.0 } \seq_const_from_clist:Nn \c_@@_struct_StructElem_entries_seq @@ -742,11 +753,16 @@ % at the begin. % \begin{macro} % { -% label,stash,tag, -% title,title-o, -% alttext, -% actualtext, -% lang,ref,E +% label (struct-key), +% stash (struct-key), +% tag (struct-key), +% title (struct-key), +% title-o (struct-key), +% alttext (struct-key), +% actualtext (struct-key), +% lang (struct-key), +% ref (struct-key), +% E (struct-key) % } % \begin{macrocode} \keys_define:nn { @@ / struct } @@ -854,22 +870,51 @@ } % \end{macrocode} % \end{macro} -% \begin{macro}{AF,AFinline,AFinline-o} +% \begin{macro}{AF (struct-key),AFinline (struct-key),AFinline-o (struct-key)} % keys for the AF keys (associated files). They use commands from l3pdffile! % The stream variants use txt as extension to get the mimetype. % TODO: check if this should be configurable. For math we will perhaps need another % extension. +% AF is an array and can be used more than once, so we store it in a tl. +% which is expanded. +% AFinline can be use only once (more quite probably doesn't make sense). % \begin{macrocode} +\cs_new_protected:Npn \@@_struct_add_AF:nn #1 #2 % #1 struct num #2 object name + { + \tl_if_exist:cTF + { + g_@@_struct_#1_AF_tl + } + { + \tl_gput_right:cx + { g_@@_struct_#1_AF_tl } + { ~ \pdf_object_ref:n {#2} } + } + { + \tl_new:c + { g_@@_struct_#1_AF_tl } + \tl_gset:cx + { g_@@_struct_#1_AF_tl } + { \pdf_object_ref:n {#2} } + } + } +\cs_generate_variant:Nn \@@_struct_add_AF:nn {en,ee} \keys_define:nn { @@ / struct } { AF .code:n = % AF property { \pdf_object_if_exist:nTF {#1} { + \@@_struct_add_AF:en { \int_eval:n {\c@g_@@_struct_abs_int} }{#1} \@@_prop_gput:cnx { g_@@_struct_\int_eval:n {\c@g_@@_struct_abs_int}_prop } { AF } - { \pdf_object_ref:n {#1} } + { + [ + \tl_use:c + { g_@@_struct_\int_eval:n {\c@g_@@_struct_abs_int}_AF_tl } + ] + } } { @@ -879,16 +924,24 @@ { \group_begin: \pdf_object_if_exist:eF {@@/fileobj\int_use:N\c@g_@@_struct_abs_int} - { - \pdffile_embed_stream:nxx - {#1} - {tag-AFfile\int_use:N\c@g_@@_struct_abs_int.txt} - {@@/fileobj\int_use:N\c@g_@@_struct_abs_int} - } - \@@_prop_gput:cnx - { g_@@_struct_\int_use:N\c@g_@@_struct_abs_int _prop } - { AF } - { \pdf_object_ref:e {@@/fileobj\int_use:N\c@g_@@_struct_abs_int } } + { + \pdffile_embed_stream:nxx + {#1} + {tag-AFfile\int_use:N\c@g_@@_struct_abs_int.txt} + {@@/fileobj\int_use:N\c@g_@@_struct_abs_int} + \@@_struct_add_AF:ee + { \int_eval:n {\c@g_@@_struct_abs_int} } + { @@/fileobj\int_use:N\c@g_@@_struct_abs_int } + \@@_prop_gput:cnx + { g_@@_struct_\int_use:N\c@g_@@_struct_abs_int _prop } + { AF } + { + [ + \tl_use:c + { g_@@_struct_\int_eval:n {\c@g_@@_struct_abs_int}_AF_tl } + ] + } + } \group_end: } ,AFinline-o .code:n = @@ -900,24 +953,63 @@ {#1} {tag-AFfile\int_use:N\c@g_@@_struct_abs_int.txt} {@@/fileobj\int_use:N\c@g_@@_struct_abs_int} + \@@_struct_add_AF:ee + { \int_eval:n {\c@g_@@_struct_abs_int} } + { @@/fileobj\int_use:N\c@g_@@_struct_abs_int } + \@@_prop_gput:cnx + { g_@@_struct_\int_use:N\c@g_@@_struct_abs_int _prop } + { AF } + { + [ + \tl_use:c + { g_@@_struct_\int_eval:n {\c@g_@@_struct_abs_int}_AF_tl } + ] + } } - \@@_prop_gput:cnx - { g_@@_struct_\int_use:N\c@g_@@_struct_abs_int _prop } - { AF } - { \pdf_object_ref:e {@@/fileobj\int_use:N\c@g_@@_struct_abs_int } } \group_end: } } +%</package> +% \end{macrocode} +% \end{macro} +% \begin{macro}{root-AF (setup-key)} +% The root structure can take AF keys too, so we provide a key for it. +% This key is used with |\tagpdfsetup|, not in a structure! +% \begin{macrocode} +\keys_define:nn { @@ / setup } + { + root-AF .code:n = + { + \pdf_object_if_exist:nTF {#1} + { + \@@_struct_add_AF:en { 0 }{#1} + \@@_prop_gput:cnx + { g_@@_struct_0_prop } + { AF } + { + [ + \tl_use:c + { g_@@_struct_0_AF_tl } + ] + } + } + { + + } + }, + } % \end{macrocode} % \end{macro} -% % \section{User commands} % % \begin{macro}{\tag_struct_begin:n,\tag_struct_end:} % \begin{macrocode} -\cs_new_protected:Npn \tag_struct_begin:n #1 %#1 key-val +%<*package|debug> +%<package>\cs_new_protected:Npn \tag_struct_begin:n #1 %#1 key-val +%<debug>\cs_set_protected:Npn \tag_struct_begin:n #1 %#1 key-val { - \@@_check_if_active_struct:T +%<package>\@@_check_if_active_struct:T +%<debug>\@@_check_if_active_struct:TF { \group_begin: \int_gincr:N \c@g_@@_struct_abs_int @@ -970,16 +1062,18 @@ } %\prop_show:c { g_@@_struct_\g_@@_struct_stack_current_tl _prop } %\seq_show:c {g_@@_struct_kids_\l_@@_struct_stack_parent_tmpa_tl _seq} +%<debug> \@@_debug_struct_begin_insert:n { #1 } \group_end: } +%<debug>{ \@@_debug_struct_begin_ignore:n { #1 }} } - - -\cs_new_protected:Nn \tag_struct_end: +%<package>\cs_new_protected:Nn \tag_struct_end: +%<debug>\cs_set_protected:Nn \tag_struct_end: { %take the current structure num from the stack: %the objects are written later, lua mode hasn't all needed info yet %\seq_show:N \g_@@_struct_stack_seq - \@@_check_if_active_struct:T +%<package>\@@_check_if_active_struct:T +%<debug>\@@_check_if_active_struct:TF { \seq_gpop:NN \g_@@_struct_tag_stack_seq \l_@@_tmpa_tl \seq_gpop:NNTF \g_@@_struct_stack_seq \l_@@_tmpa_tl @@ -999,14 +1093,18 @@ { \tl_gset:NV \g_@@_struct_tag_tl \l_@@_tmpa_tl } +%<debug>\@@_debug_struct_end_insert: } +%<debug>{\@@_debug_struct_end_ignore:} } +%</package|debug> % \end{macrocode} % \end{macro} % \begin{macro}{\tag_struct_use:n} % This command allows to use a stashed structure in another place. % TODO: decide how it should be guarded. Probably by the struct-check. % \begin{macrocode} +%<*package> \cs_new_protected:Nn \tag_struct_use:n %#1 is the label { \@@_check_if_active_struct:T @@ -1073,7 +1171,7 @@ % \section{Attributes and attribute classes} % \begin{macrocode} %<*header> -\ProvidesExplPackage {tagpdf-attr-code} {2021-08-27} {0.92} +\ProvidesExplPackage {tagpdf-attr-code} {2022-01-13} {0.93} {part of tagpdf - code related to attributes and attribute classes} %</header> % \end{macrocode} @@ -1101,7 +1199,7 @@ % \end{macrocode} % \end{variable} % \subsection{Commands and keys} -% \begin{macro}{\@@_attr_new_entry:nn,newattribute} +% \begin{macro}{\@@_attr_new_entry:nn,newattribute (setup-key)} % This allows to define attributes. Defined attributes % are stored in a global property. |newattribute| expects % two brace group, the name and the content. The content typically @@ -1132,7 +1230,7 @@ } % \end{macrocode} % \end{macro} -% \begin{macro}{attribute-class} +% \begin{macro}{attribute-class (struct-key)} % attribute-class has to store the used attribute names so that % they can be added to the ClassMap later. % \begin{macrocode} @@ -1172,7 +1270,7 @@ } % \end{macrocode} % \end{macro} -% \begin{macro}{attribute} +% \begin{macro}{attribute (struct-key)} % \begin{macrocode} \keys_define:nn { @@ / struct } { diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx index b8e1b0d54ac..e6964666d93 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx @@ -2,7 +2,7 @@ % %% File: tagpdf-tree.dtx % -% Copyright (C) 2019-2021 Ulrike Fischer +% Copyright (C) 2019-2022 Ulrike Fischer % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -51,13 +51,13 @@ % }^^A % } % -% \date{Version 0.92, released 2021-08-27} +% \date{Version 0.93, released 2022-01-13} % \maketitle % \begin{implementation} % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-tree-code} {2021-08-27} {0.92} +\ProvidesExplPackage {tagpdf-tree-code} {2022-01-13} {0.93} {part of tagpdf - code related to writing trees and dictionaries to the pdf} %</header> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx index 23737dfc292..2b58d816594 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx @@ -2,7 +2,7 @@ % %% File: tagpdf-user.dtx % -% Copyright (C) 2019-2021 Ulrike Fischer +% Copyright (C) 2019-2022 Ulrike Fischer % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -50,7 +50,7 @@ % }^^A % } % -% \date{Version 0.92, released 2021-08-27} +% \date{Version 0.93, released 2022-01-13} % \maketitle % \begin{documentation} % \section{Setup commands} @@ -60,7 +60,18 @@ % \end{syntax} % This is the main setup command to adapt the behaviour of tagpdf. % It can be used in the preamble and in the document (but not all keys make sense there). +% \end{function} % +% \begin{function}{activate (setup-key)} +% And additional setup key which combine the other activate keys +% |activate-mc|, |activate-tree|, |activate-struct| and additionally +% add a document structure. +% \end{function} +% +% +% \begin{function}{\tagpdfifluatexTF,\tagpdfifluatexT,\tagpdfifpdftexT} +% small wrappers around engine tests. This functions should not be used and will be removed +% in one of the next versions. % \end{function} % % \section{Commands related to mc-chunks} @@ -76,7 +87,7 @@ % and \cs{tagmcend} will issue in horizontal mode an \cs{unskip}. % \end{function} % -% \begin{function}{\tagmcifin} +% \begin{function}{\tagmcifinTF} % \begin{syntax} % \cs{tagmcifin} \Arg{true code}\Arg{false code} % \end{syntax} @@ -112,7 +123,7 @@ % necessarly stops the compilation. The keys and their function are described below. % \end{function} % -% \begin{function}{mc-data} +% \begin{function}{mc-data (show-key)} % \begin{syntax} % |mc-data| = \meta{number} % \end{syntax} @@ -123,7 +134,7 @@ % newpage. The value is a positive integer and sets the first mc-shown. If no value % is given, 1 is used and so all mc-chunks created so far are shown. % \end{function} -% \begin{function}{mc-current} +% \begin{function}{mc-current (show-key)} % \begin{syntax} % |mc-current| % \end{syntax} @@ -131,7 +142,14 @@ % chunk is open it shows only the state of the abs count. It works in all mode, % but the output in luamode looks different. % \end{function} -% \begin{function}{struct-stack} +% \begin{function}{mc-marks (show-key)} +% \begin{syntax} +% |mc-marks| = |show|\verb+|+|use| +% \end{syntax} +% This key helps to debug the page marks. It should only be used at shipout in +% header or footer. +% \end{function} +% \begin{function}{struct-stack (show-key)} % \begin{syntax} % |struct-stack| = |log|\verb+|+|show| % \end{syntax} @@ -163,7 +181,7 @@ % faulty code, e.g. a missing |\par| at the end of a low-level vbox can highly % confuse the tagging. The tags should be carefully checked if this is used. % -% \begin{function}{paratagging,paratagging-show} +% \begin{function}{paratagging (setup-key),paratagging-show (setup-key)} % \begin{syntax} % |paratagging| = |true|\verb+|+|false|\\ % |paratagging-show| = |true|\verb+|+|false|\\ @@ -179,15 +197,34 @@ % faster then |\tagpdfsetup|. But I'm not sure if the names are good. % \end{function} % +% \begin{function}{\tagpdfsuppressmarks} +% This command allows to suppress the creation of the marks. It takes an argument +% which should normally be one of the mc-commands, puts a group around it and +% suppress the marks creation in this group. This command should be used if +% the begin and end command are at different boxing levels. E.g. +% \begin{verbatim} +% \@hangfrom +% { +% \tagstructbegin{tag=H1}% +% \tagmcbegin {tag=H1}% +% #2 +% } +% {#3\tagpdfsuppressmarks{\tagmcend}\tagstructend}% +% \end{verbatim} +% \end{function} +% % \subsection{Header and footer} -% Header and footer are automatically excluded from tagging. This can for -% now to allow debugging be disabled with the following key, but probably -% this key will disappear again. If some real content is in the header and +% Header and footer are automatically excluded from tagging. This can +% be disabled with the following key. +% If some real content is in the header and % footer, tagging must be restarted there explicitly. +% The key accepts the values |true| which surrounds the header with an artifact +% mc-chunk, |false| which disables the automatic tagging, and |pagination| which +% additionally adds an artifact structure with an pagination attribute. % -% \begin{function}{exclude-header-footer} +% \begin{function}{exclude-header-footer (setup-key)} % \begin{syntax} -% |exclude-header-footer| = |true|\verb+|+|false| +% |exclude-header-footer| = |true|\verb+|+|false|\verb+|+pagination % \end{syntax}% % \end{function} @@ -213,7 +250,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-user} {2021-08-27} {0.92} +\ProvidesExplPackage {tagpdf-user} {2022-01-13} {0.93} {tagpdf - user commands} %</header> % \end{macrocode} @@ -288,14 +325,6 @@ % \end{macro} % % -% \begin{macro}{\tagpdfifluatexTF,\tagpdfifluatexT,\tagpdfifpdftexTF} -% I should deprecate them ... -% \begin{macrocode} -\cs_set_eq:NN\tagpdfifluatexTF \sys_if_engine_luatex:TF -\cs_set_eq:NN\tagpdfifluatexT \sys_if_engine_luatex:T -\cs_set_eq:NN\tagpdfifpdftexT \sys_if_engine_pdftex:T -% \end{macrocode} -% \end{macro} % % \section{Debugging} % \begin{macro}{\ShowTagging} @@ -310,7 +339,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{mc-data} +% \begin{macro}{mc-data (show-key)} % This key is (currently?) relevant for lua mode only. % It shows the data of all mc-chunks created so far. % It is accurate only after shipout, so typically should be issued after a @@ -330,7 +359,7 @@ % \end{macrocode} % \end{macro} -% \begin{macro}{mc-current} +% \begin{macro}{mc-current (show-key)} % This shows some info about the current mc-chunk. It works in generic and lua-mode. % \begin{macrocode} \keys_define:nn { @@ / show } @@ -397,7 +426,7 @@ } % \end{macrocode} % \end{macro} -% \begin{macro}{mc-marks} +% \begin{macro}{mc-marks (show-key)} % It maps the mc-marks into the sequences and then shows them. % This allows to inspect the first and last mc-Mark on a page. % It should only be used in the shipout (header/footer). @@ -447,7 +476,7 @@ } % \end{macrocode} % \end{macro} -% \begin{macro}{struct-stack} +% \begin{macro}{struct-stack (show-key)} % \begin{macrocode} \keys_define:nn { @@ / show } { @@ -466,7 +495,7 @@ % This part should be regularly revisited to check if the code should go to a % better place or can be improved. % \subsection{Document structure} -% \begin{macro}{\@@_add_document_structure:n,activate} +% \begin{macro}{\@@_add_document_structure:n,activate (setup-key)} % \begin{macrocode} \cs_new_protected:Npn \@@_add_document_structure:n #1 { @@ -485,6 +514,28 @@ } % \end{macrocode} % \end{macro} +% \subsection{Structure destinations} +% In TeXlive 2022 pdftex and luatex will offer support for structure destinations. +% The pdfmanagement has already backend support. We activate them if the +% prerequisites are there: The pdf version should be 2.0, structures should be activated, +% the code in the pdfmanagement must be there. +% \begin{macrocode} +\AddToHook{begindocument/before} + { + \bool_lazy_all:nT + { + { \g_@@_active_struct_dest_bool } + { \g_@@_active_struct_bool } + { \cs_if_exist_p:N \pdf_activate_structure_destination: } + { ! \pdf_version_compare_p:Nn < {2.0} } + } + { + \tl_set:Nn \l_pdf_current_structure_destination_tl { __tag/struct/\g__tag_struct_stack_current_tl } + \pdf_activate_structure_destination: + } + } +% \end{macrocode} + % \subsection{Fake space} % \begin{macro}{\pdffakespace} % We need a luatex variant for |\pdffakespace|. This should probably go into @@ -518,8 +569,8 @@ % %\begin{macro} % { -% paratagging, -% paratagging-show, +% paratagging (setup-key), +% paratagging-show (setup-key), % } % These keys enable/disable locally paratagging, and the debug modus. % It can affect the typesetting if |paratagging-show| is used. The small numbers @@ -593,7 +644,7 @@ \tl_put_right:Nn \@mult@ptagging@hook { \@@_check_typeout_v:n {====>~In~\string\page@sofar} - \process@cols\mult@gfirstbox + \process@cols\mult@firstbox { \@@_add_missing_mcs_to_stream:Nn \count@ {multicol} } @@ -686,7 +737,41 @@ \bool_gset_eq:NN \g_@@_in_mc_bool\g_@@_saved_in_mc_bool } } +% \end{macrocode} +% This version allows to use an Artifact structure +% \begin{macrocode} +\@@_attr_new_entry:nn {@@/attr/pagination}{/O/Artifact/Type/Pagination} +\cs_new_protected:Npn \@@_exclude_struct_headfoot_begin:n #1 + { + \bool_set_false:N \l_@@_para_bool + \bool_if:NTF \g_@@_mode_lua_bool + { + \tag_mc_end_push: + } + { + \bool_gset_eq:NN \g_@@_saved_in_mc_bool \g_@@_in_mc_bool + \bool_gset_false:N \g_@@_in_mc_bool + } + \tag_struct_begin:n{tag=Artifact,attribute-class=@@/attr/#1} + \tag_mc_begin:n {artifact=#1} + } +\cs_new_protected:Npn \@@_exclude_struct_headfoot_end: + { + \tag_mc_end: + \tag_struct_end: + \bool_if:NTF \g_@@_mode_lua_bool + { + \tag_mc_begin_pop:n{} + } + { + \bool_gset_eq:NN \g_@@_in_mc_bool\g_@@_saved_in_mc_bool + } + } +% \end{macrocode} +% And now the keys +% \begin{macro}{exclude-header-footer (setup-key)} +% \begin{macrocode} \keys_define:nn { @@ / setup } { exclude-header-footer .choice:, @@ -697,6 +782,13 @@ \cs_set_eq:NN \@@_hook_kernel_after_head: \@@_exclude_headfoot_end: \cs_set_eq:NN \@@_hook_kernel_after_foot: \@@_exclude_headfoot_end: }, + exclude-header-footer / pagination .code:n = + { + \cs_set:Nn \@@_hook_kernel_before_head: { \@@_exclude_struct_headfoot_begin:n {pagination} } + \cs_set:Nn \@@_hook_kernel_before_foot: { \@@_exclude_struct_headfoot_begin:n {pagination} } + \cs_set_eq:NN \@@_hook_kernel_after_head: \@@_exclude_struct_headfoot_end: + \cs_set_eq:NN \@@_hook_kernel_after_foot: \@@_exclude_struct_headfoot_end: + }, exclude-header-footer / false .code:n = { \cs_set_eq:NN \@@_hook_kernel_before_head: \prg_do_nothing: @@ -708,7 +800,7 @@ exclude-header-footer .initial:n = true } % \end{macrocode} - +% \end{macro} % \subsection{Links} % We need to close and reopen mc-chunks around links. % Currently we handle URI and GoTo (internal) links. diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx index 0aeac22d7fb..5406505c597 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx @@ -2,7 +2,7 @@ % %% File: tagpdf.dtx % -% Copyright (C) 2019-2021 Ulrike Fischer +% Copyright (C) 2019-2022 Ulrike Fischer % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -23,13 +23,64 @@ % for those people who are interested. % % \fi +% \begin{documentation} +% \begin{function}{\ref_value:nnn} +% This is a temporary definition which will have to +% move to l3ref. It allows to locally set a default value if the label or the attribute +% doesn't exist. See issue \#4 in Accessible-xref. +% \begin{syntax} +% \cs{ref_value:nnn}\Arg{label}\Arg{attribute}\Arg{fallback default} +% \end{syntax} +% \end{function} +% +% \begin{function}{ \tag_stop_group_begin:, \tag_stop_group_end: } +% We need a command to stop tagging in some places. +% This simply switches the two local booleans. +% \end{function} +% +% \begin{function}{activate-space (setup-key)} +% |activate-space| activates the additional parsing needed for +% interword spaces. It is not documented, the parsing is currently +% implicitly activated by the known key |interwordspace|, as the code will +% perhaps move to some other place, now that it is better separated. +% \end{function} +% +% \begin{function}{activate-mc (setup-key), +% activate-tree (setup-key), +% activate-struct (setup-key), +% activate-all (setup-key)} +% Keys to activate the various tagging steps +% \end{function} +%\begin{function}{no-struct-dest (setup-key)} +% The key allows to suppress the creation of structure destinations +% \end{function} +% +% \begin{function}{log (setup-key)} +% The |log| takes currently the values |none|, |v|, |vv|, |vvv|, |all|. +% More details are in \texttt{tagpdf-checks}. +% \end{function} +% +% \begin{function}{tagunmarked (setup-key)} +% This key allows to set if (in luamode) unmarked text should be +% marked up as artifact. The initial value is true. +% \end{function} +% +% \begin{function}{tabsorder (setup-key)} +% This sets the tabsorder on a page. The values are |row|, |column|, |structure| (default) +% or |none|. Currently this is set more or less globally. More finer control can be +% added if needed. +% \end{function} % +% \begin{function}{tagstruct,tagstructobj,tagabspage,tagmcabs,tagmcid} +% These are attributes used by the label/ref system. +% \end{function} +% \end{documentation} % \begin{implementation} % \section{Initialization and test if pdfmanagement is active.} % \begin{macrocode} %<@@=tag> %<*package> -\ProvidesExplPackage {tagpdf} {2021-08-27} {0.92} +\ProvidesExplPackage {tagpdf} {2022-01-13} {0.93} { A package to experiment with pdf tagging } \bool_if:nF @@ -51,18 +102,33 @@ before~\string\documentclass } } +%</package> % \end{macrocode} +%<*debug> +% \begin{macrocode} +\ProvidesExplPackage {tagpdf-debug} {2022-01-13} {0.93} + { debug code for tagpdf } +\@ifpackageloaded{tagpdf}{}{\PackageWarning{tagpdf-debug}{tagpdf~not~loaded,~quitting}\endinput} + \end{macrocode} +%</debug> % We map the internal module name \enquote{tag} to \enquote{tagpdf} in messages. % \begin{macrocode} -\prop_if_exist:NT \g_msg_module_name_prop - { - \prop_gput:Nnn \g_msg_module_name_prop { tag }{ tagpdf } - } +%<*package> +\prop_gput:Nnn \g_msg_module_name_prop { tag }{ tagpdf } +%</package> +% \end{macrocode} +% Debug mode has its special mapping: +% \begin{macrocode} +%<*debug> +\prop_gput:Nnn \g_msg_module_type_prop { tag / debug} {} +\prop_gput:Nnn \g_msg_module_name_prop { tag / debug }{tagpdf~DEBUG} +%</debug> % \end{macrocode} %\section{Package options} % There are only two options to switch for luatex between generic and luamode, % TODO try to get rid of them. % \begin{macrocode} +%<*package> \bool_new:N\g_@@_mode_lua_bool \DeclareOption {luamode} { \sys_if_engine_luatex:T { \bool_gset_true:N \g_@@_mode_lua_bool } } \DeclareOption {genericmode}{ \bool_gset_false:N\g_@@_mode_lua_bool } @@ -105,10 +171,6 @@ % \begin{macro}{\ref_value:nnn} % This allows to locally set a default value if the label or the attribute % doesn't exist. -% See issue \#4 in Accessible-xref. -% \begin{syntax} -% \cs{ref_value:nnn}\Arg{label}\Arg{attribute}\Arg{Fallback default} -% \end{syntax} % \begin{macrocode} \cs_if_exist:NF \ref_value:nnn { @@ -180,7 +242,8 @@ % \g_@@_active_space_bool, % \g_@@_active_mc_bool, % \g_@@_active_tree_bool, -% \g_@@_active_struct_bool +% \g_@@_active_struct_bool, +% \g_@@_active_struct_dest_bool % } % These booleans should help to control the global behaviour of tagpdf. % Ideally it should more or less do nothing if all are false. @@ -190,6 +253,8 @@ % commands, the struct-boolean activates the storing of the structure data. % In a normal document all should be active, the split is only there for % debugging purpose. +% Structure destination will be activated automatically if pdf version 2.0 is detected, +% but with the boolean struct-dest-boolean one can suppress them. % Also we assume currently that they are set only at begin document. But % if some control passing over groups are needed they could be perhaps % used in a document too. @@ -199,6 +264,8 @@ \bool_new:N \g_@@_active_mc_bool \bool_new:N \g_@@_active_tree_bool \bool_new:N \g_@@_active_struct_bool +\bool_new:N \g_@@_active_struct_dest_bool +\bool_gset_true:N \g_@@_active_struct_dest_bool % \end{macrocode} % \end{variable} @@ -369,17 +436,19 @@ % % \begin{macro} % { -% activate-space, -% activate-mc, -% activate-tree, -% activate-struct, -% activate-all, +% activate-space (setup-key), +% activate-mc (setup-key), +% activate-tree (setup-key), +% activate-struct (setup-key), +% activate-all (setup-key), +% no-struct-dest (setup-key) % } % Keys to (globally) activate tagging. % |activate-space| activates the additional parsing needed for % interword spaces. It is not documented, the parsing is currently % implicitly activated by the known key |interwordspace|, as the code will % perhaps move to some other place, now that it is better separated. +% |no-struct-dest| allows to suppress structure destinations. % \begin{macrocode} \keys_define:nn { @@ / setup } { @@ -388,10 +457,12 @@ activate-tree .bool_gset:N = \g_@@_active_tree_bool, activate-struct .bool_gset:N = \g_@@_active_struct_bool, activate-all .meta:n = - {activate-mc,activate-tree,activate-struct}, + {activate-mc={#1},activate-tree={#1},activate-struct={#1}}, + activate-all .default:n = true, + no-struct-dest .bool_gset_inverse:N = \g_@@_active_struct_dest_bool, % \end{macrocode} % \end{macro} -% \begin{macro}{log} +% \begin{macro}{log (setup-key)} % The |log| takes currently the values |none|, |v|, |vv|, |vvv|, |all|. % The description of the log levels is in tagpdf-checks. % \begin{macrocode} @@ -407,7 +478,7 @@ log / all .code:n = {\int_set:Nn \l_@@_loglevel_int { 10 }}, % \end{macrocode} % \end{macro} -% \begin{macro}{tagunmarked} +% \begin{macro}{tagunmarked (setup-key)} % This key allows to set if (in luamode) unmarked text should be % marked up as artifact. The initial value is true. % \begin{macrocode} @@ -415,9 +486,9 @@ tagunmarked .initial:n = true, % \end{macrocode} % \end{macro} -% \begin{macro}{tabsorder} -% This sets the tabsorder one a page. The values are |row|, |column|, |structure| (default) -% or |none|. Currently this is set more or less globally. More finer controll can be +% \begin{macro}{tabsorder (setup-key)} +% This sets the tabsorder on a page. The values are |row|, |column|, |structure| (default) +% or |none|. Currently this is set more or less globally. More finer control can be % added if needed. % \begin{macrocode} tabsorder .choice:, @@ -452,6 +523,15 @@ \RequirePackage {tagpdf-mc-code-generic} % } %</mcloading> +%<*debug> +\bool_if:NTF \g_@@_mode_lua_bool + { + \RequirePackage {tagpdf-debug-lua} + } + { + \RequirePackage {tagpdf-debug-generic} % + } +%</debug> % \end{macrocode} % \end{implementation} % \PrintIndex diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf.ins b/Master/texmf-dist/source/latex/tagpdf/tagpdf.ins index 583509d4a24..e212ae48b27 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf.ins +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf.ins @@ -2,7 +2,7 @@ File: tagpdf.ins -Copyright (C) 2019-2021 Ulrike Fischer +Copyright (C) 2019-2022 Ulrike Fischer It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this @@ -34,7 +34,7 @@ for those people who are interested. \let\MetaPrefix\relax \preamble -Copyright (C) 2019-2021 Ulrike Fischer +Copyright (C) 2019-2022 Ulrike Fischer It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of @@ -59,13 +59,13 @@ and all files in that bundle must be distributed together. { \from{tagpdf.dtx}{package} \from{tagpdf-checks.dtx}{package} - \from{tagpdf-user.dtx}{package} \from{tagpdf-mc-shared.dtx}{shared} \from{tagpdf.dtx}{mcloading} \from{tagpdf-tree.dtx}{package} \from{tagpdf-roles.dtx}{package} \from{tagpdf-struct.dtx}{package}%contains also the attr code. \from{tagpdf-space.dtx}{package} + \from{tagpdf-user.dtx}{package} } } @@ -76,6 +76,26 @@ and all files in that bundle must be distributed together. \generate {\file{tagpdf-mc-code-lua.sty}{\from{tagpdf-mc-luacode.dtx}{luamode}}} +% check later if the mc-code uses debug guards too. +\generate + {\file{tagpdf-debug.sty} + { + \from{tagpdf.dtx}{debug} + \from{tagpdf-checks.dtx}{debug} + \from{tagpdf-user.dtx}{debug} + \from{tagpdf-mc-shared.dtx}{debug} + \from{tagpdf-tree.dtx}{debug} + \from{tagpdf-roles.dtx}{debug} + \from{tagpdf-struct.dtx}{debug}% + \from{tagpdf-space.dtx}{debug} + } + } + +\generate + {\file{tagpdf-debug-generic.sty}{\from{tagpdf-mc-generic.dtx}{debug}}} + +\generate + {\file{tagpdf-debug-lua.sty}{\from{tagpdf-mc-luacode.dtx}{debug}}} \def\MetaPrefix{-- } \def\defaultpostamble{% |