diff options
author | Karl Berry <karl@freefriends.org> | 2021-06-14 20:30:18 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-06-14 20:30:18 +0000 |
commit | 6edc677a3c031d7dbf451d7abfb1016abe58e0c8 (patch) | |
tree | c3fc8df036be972928824e81643915bd9f2c9120 /Master/texmf-dist/source | |
parent | ea584efe11866db25e596b86b3b7ae07e39e18f4 (diff) |
tagpdf (14jun21)
git-svn-id: svn://tug.org/texlive/trunk@59592 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
8 files changed, 81 insertions, 29 deletions
diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx index 42620d46e5e..1010c79b7a5 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-2020 Ulrike Fischer +% Copyright (C) 2019-2021 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 @@ -27,7 +27,7 @@ % \begin{macrocode} %<@@=tag> %<*luatex> -\ProvidesExplFile {tagpdf-luatex.def} {2021/05/14} {0.81} +\ProvidesExplFile {tagpdf-luatex.def} {2021-06-14} {0.82} {tagpdf~driver~for~luatex} \newattribute \l_@@_mc_type_attr %the value represent the type @@ -114,7 +114,7 @@ % % \begin{macrocode} %<*pdftex> -\ProvidesExplFile {tagpdf-pdftex.def} {2021/05/14} {0.81} +\ProvidesExplFile {tagpdf-pdftex.def} {2021-06-14} {0.82} {tagpdf~driver~for~pdftex} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -149,8 +149,8 @@ local ProvidesLuaModule = { name = "tagpdf", - version = "0.81", --TAGVERSION - date = "2021-05-14", --TAGDATE + version = "0.82", --TAGVERSION + date = "2021-06-14", --TAGDATE description = "tagpdf lua code", license = "The LATEX Project Public License 1.3c" } diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx index eb0f41e89b1..87f493d0d82 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx @@ -27,7 +27,7 @@ % \begin{macrocode} %<@@=tag> %<*checks> -\ProvidesExplPackage {tagpdf-checks-code} {2021/05/14} {0.81} +\ProvidesExplPackage {tagpdf-checks-code} {2021-06-14} {0.82} {part of tagpdf - code related to checks and messages} diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc.dtx index 565e41b372c..4842c8b9931 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc.dtx @@ -27,7 +27,7 @@ % \begin{macrocode} %<@@=tag> %<*shared> -\ProvidesExplPackage {tagpdf-mc-code-shared} {2021/05/14} {0.81} +\ProvidesExplPackage {tagpdf-mc-code-shared} {2021-06-14} {0.82} {part of tagpdf - code related to marking chunks - code shared by generic and luamode } % I use a latex counter for the absolute count, so that it is added to @@ -173,7 +173,7 @@ % \end{macrocode} % \begin{macrocode} %<*generic> -\ProvidesExplPackage {tagpdf-mc-code-generic} {2021/05/14} {0.81} +\ProvidesExplPackage {tagpdf-mc-code-generic} {2021-06-14} {0.82} {part of tagpdf - code related to marking chunks - generic mode} % for the label system @@ -472,7 +472,7 @@ % \end{macrocode} % \begin{macrocode} %<*luamode> -\ProvidesExplPackage {tagpdf-mc-code-lua} {2021/05/14} {0.81} +\ProvidesExplPackage {tagpdf-mc-code-lua} {2021-06-14} {0.82} {tagpdf - mc code only for the luamode } % the two attibutes are defined in the driver file. diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx index 2254ad420a4..7955226573f 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx @@ -27,7 +27,7 @@ % \begin{macrocode} %<@@=tag> %<*roles> -\ProvidesExplPackage {tagpdf-roles-code} {2021/05/14} {0.81} +\ProvidesExplPackage {tagpdf-roles-code} {2021-06-14} {0.82} {part of tagpdf - code related to roles and structure names} % \end{macrocode} % \section{Variables} diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx index bfe85344b64..55021a74d2b 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx @@ -27,7 +27,7 @@ % \begin{macrocode} %<@@=tag> %<*space> -\ProvidesExplPackage {tagpdf-space-code} {2021/05/14} {0.81} +\ProvidesExplPackage {tagpdf-space-code} {2021-06-14} {0.82} {part of tagpdf - code related to real space chars} % luatex uses an attribute (declared in the driver file) and some luacode in tagpdf.lua % perhaps I will split the code by engine in the future diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx index 9e66d4913d6..e385fea951d 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-2020 Ulrike Fischer +% Copyright (C) 2019-2021 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 @@ -27,7 +27,7 @@ % \begin{macrocode} %<@@=tag> %<*struct> -\ProvidesExplPackage {tagpdf-struct-code} {2021/05/14} {0.81} +\ProvidesExplPackage {tagpdf-struct-code} {2021-06-14} {0.82} {part of tagpdf - code related to storing structure} % \end{macrocode} % I will use a latex counter for the structure count @@ -207,7 +207,7 @@ } } -\cs_new:Nn\@@_struct_kid_link_gput_right:nn %#1 num of parent struct, #2 obj reference +\cs_new:Nn\@@_struct_kid_OBJR_gput_right:nn %#1 num of parent struct, #2 obj reference { \pdf_object_unnamed_write:nx { dict } @@ -222,7 +222,7 @@ } } -\cs_generate_variant:Nn\@@_struct_kid_link_gput_right:nn { nx } +\cs_generate_variant:Nn\@@_struct_kid_OBJR_gput_right:nn { nx } \cs_new:Nn\@@_struct_exchange_kid_command:N %N= seq { @@ -668,11 +668,30 @@ } -%%%% Code to tag links +%%%% Code to tag annotations like links. +% Annotations used as structure content must +% (1) add a StructParent integer to their dictionary +% (2) push the object reference as OBJR object in the structure +% (3) Add a Stuctparent/obj-nr reference to the parent three. +% For a link this looks like this +% \tag_struct_begin:n { tag=Link } +% \tag_mc_begin:n { tag=Link } +% (1) \pdfannot_dict_put:nnx +% { link/URI } +% { StructParent } +% { \int_use:N\c@g_@@_parenttree_obj_int } +% <start link> link text <stop link> +% (2+3) \@@_struct_insert_annot:nn {obj ref}{parent num} +% \tag_mc_end: +% \tag_struct_end: +% %%%% this works for url, see exp-link.pdf. %%%% it must be checked for other links -\cs_new_protected:Nn \@@_struct_finish_link: + +% this will probably be used for xform too, but then we can rename it. +\cs_new_protected:Npn \@@_struct_insert_annot:nn #1 #2 %#1 object reference to the annotation/xform + %#2 structparent number { \bool_if:NT \g_@@_active_struct_bool { @@ -684,17 +703,18 @@ \msg_error:nn { tag } { struct-faulty-nesting } } %put the obj number of link annot in the kid entry: - \@@_struct_kid_link_gput_right:nx + \@@_struct_kid_OBJR_gput_right:nx { \l_@@_struct_stack_parent_tmp_tl } { - \pdfannot_link_ref_last: + #1 % } % add the parent obj number to the parent tree: + \exp_args:Nnx \@@_parenttree_add_objr:nn { - \int_use:N\c@g_@@_parenttree_obj_int + #2 } { \prop_item:cn @@ -706,12 +726,26 @@ } } + + +% Code to add an annot to the structure. +% This is for example needed for widget annotations and form field +% It reuses the command used by links +\cs_new_protected:Npn \tag_struct_insert_annot:nn #1 #2 %#1 should be an object reference + %#2 struct parent num + { + \@@_struct_insert_annot:nn {#1}{#2} + } + +\cs_generate_variant:Nn \tag_struct_insert_annot:nn {xx} +\cs_new:Npn \tag_struct_parent_int: {\int_use:c { c@g_@@_parenttree_obj_int }} + %</struct> % \end{macrocode} % \begin{macrocode} %<*attr> -\ProvidesExplPackage {tagpdf-attr-code} {2021/05/14} {0.81} +\ProvidesExplPackage {tagpdf-attr-code} {2021-06-14} {0.82} {part of tagpdf - code related to attributes and attribute classes} % the obj is written in tagpdf-tree-code. diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx index dd6b7863c79..c3e5d6d71b2 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-2020 Ulrike Fischer +% Copyright (C) 2019-2021 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 @@ -27,7 +27,7 @@ % \begin{macrocode} %<@@=tag> %<*tree> -\ProvidesExplPackage {tagpdf-tree-code} {2021/05/14} {0.81} +\ProvidesExplPackage {tagpdf-tree-code} {2021-06-14} {0.82} {part of tagpdf - code related to writing trees and dictionaries to the pdf} %this does the actual finishing: diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx index ba473d7022f..959e7c0097b 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx @@ -27,7 +27,7 @@ % \begin{macrocode} %<@@=tag> %<*package> -\ProvidesExplPackage {tagpdf} {2021/05/14} {0.81} +\ProvidesExplPackage {tagpdf} {2021-06-14} {0.82} { A package to experiment with pdf tagging } \bool_if:nF @@ -335,7 +335,7 @@ % % \begin{macrocode} %<*user> -\ProvidesExplPackage {tagpdf-user} {2021/05/14} {0.81} +\ProvidesExplPackage {tagpdf-user} {2021-06-14} {0.82} {tagpdf - user commands} % \end{macrocode} @@ -351,6 +351,24 @@ \cs_set_eq:NN\tagpdfifpdftexT \sys_if_engine_pdftex:T % \end{macrocode} % \end{macro} +% \begin{macro}{\tag_if_active:} +% This is a test it tagging is active. This allows packages +% to add conditional code. We probably will need a better +% test in the end, but for now it should be ok. +% \begin{macrocode} +\prg_new_conditional:Npnn \tag_if_active: { p , T , TF, F } + { + \bool_if:NTF\g_@@_active_struct_bool + { + \prg_return_true: + } + { + \prg_return_false: + } + } +% \end{macrocode} +% \end{macro} +% % We need a command to stop tagging in some places. % % \begin{macro}{ \tag_stop_group_begin:, \tag_stop_group_end: } @@ -590,7 +608,7 @@ \pdfannot_dict_put:nnx { link/URI } { StructParent } - { \int_use:N\c@g_@@_parenttree_obj_int } + { \tag_struct_parent_int: } } } @@ -600,7 +618,7 @@ { \bool_if:NT \g_@@_active_struct_bool { - \@@_struct_finish_link: + \tag_struct_insert_annot:xx {\pdfannot_link_ref_last:}{\tag_struct_parent_int:} \tag_mc_end: \tag_struct_end: \tag_mc_begin_pop:n{} @@ -619,7 +637,7 @@ \pdfannot_dict_put:nnx { link/GoTo } { StructParent } - { \int_use:N\c@g_@@_parenttree_obj_int } + { \tag_struct_parent_int: } } } @@ -629,7 +647,7 @@ { \bool_if:NT \g_@@_active_struct_bool { - \@@_struct_finish_link: + \tag_struct_insert_annot:xx {\pdfannot_link_ref_last:}{\tag_struct_parent_int:} \tag_mc_end: \tag_struct_end: \tag_mc_begin_pop:n{} |