summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-01-13 21:05:40 +0000
committerKarl Berry <karl@freefriends.org>2022-01-13 21:05:40 +0000
commitd8a708abc1ed023e582f732ac87e906bba4d884c (patch)
tree3212c9992cf00ad728c8dceb83f414377b6fcebf /Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx
parent031d7dac6f41c0c635cb8e8fa08cf794a1cc80c1 (diff)
tagpdf (13jan22)
git-svn-id: svn://tug.org/texlive/trunk@61600 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx')
-rw-r--r--Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx124
1 files changed, 102 insertions, 22 deletions
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