Skip to content

Commit

Permalink
suspend/resume command
Browse files Browse the repository at this point in the history
  • Loading branch information
u-fischer committed Sep 16, 2024
1 parent 2c35ffb commit 733085a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
10 changes: 5 additions & 5 deletions tagpdf-checks.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -1137,19 +1137,19 @@
}
}
% \end{macrocode}
% This tracks tag stop and start.
% The tag-stop message should go before the int is increased.
% The tag-start message after the int is decreased.
% This tracks tag suspend and resume.
% The tag-suspend message should go before the int is increased.
% The tag-resume message after the int is decreased.
% \begin{macrocode}
\msg_new:nnn { tag / debug } {tag-stop}
\msg_new:nnn { tag / debug } {tag-suspend}
{
\int_if_zero:nTF
{#1}
{Tagging~stopped}
{Tagging~(not)~stopped~(already~inactive)}\\
level:~#1~==>~\int_eval:n{#1+1}\tl_if_empty:nF{#2}{,~label:~#2}~[\msg_line_context:]
}
\msg_new:nnn { tag / debug } {tag-start}
\msg_new:nnn { tag / debug } {tag-resume}
{
\int_if_zero:nTF
{#1}
Expand Down
25 changes: 17 additions & 8 deletions tagpdf.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@
% \section{General tagging commands}
%
% \begin{macro}{
% \tag_suspend:n,\tag_resume:n,
% \tag_stop:,\tag_start:,
% \tag_stop:n,\tag_start:n}
% We need commands to stop tagging in some places.
Expand All @@ -534,7 +535,8 @@
% counter. Tagging only is only restarted at the outer level,
% if the current level is 1.
% The commands with argument allow to give a label. This is only used
% in debugging messages to allow to follow the nesting.
% in debugging messages to allow to follow the nesting. The label is
% not expand so can e.g. be a single command token.
%
% \begin{variable}{\l_@@_tag_stop_int}
% When stop/start pairs are nested we do not want the inner
Expand All @@ -551,7 +553,7 @@
% \begin{macrocode}
\cs_set_protected:Npn \tag_stop:
{
%<debug> \msg_note:nne {tag / debug }{tag-stop}{ \int_use:N \l_@@_tag_stop_int }
%<debug> \msg_note:nne {tag / debug }{tag-suspend}{ \int_use:N \l_@@_tag_stop_int }
\int_incr:N \l_@@_tag_stop_int
\bool_set_false:N \l_@@_active_struct_bool
\bool_set_false:N \l_@@_active_mc_bool
Expand All @@ -568,23 +570,24 @@
\bool_set_true:N \l_@@_active_socket_bool
\@@_start_para_ints:
}
%<debug> \msg_note:nne {tag / debug }{tag-start}{ \int_use:N \l_@@_tag_stop_int }
%<debug> \msg_note:nne {tag / debug }{tag-resume}{ \int_use:N \l_@@_tag_stop_int }
}
\cs_set_eq:NN\tagstop\tag_stop:
\cs_set_eq:NN\tagstart\tag_start:
% \end{macrocode}
% \begin{macrocode}
\cs_set_protected:Npn \tag_stop:n #1
\cs_set_protected:Npn \tag_suspend:n #1
{
%<debug> \msg_note:nnee {tag / debug }{tag-stop}
%<debug> \msg_note:nnee {tag / debug }{tag-suspend}
%<debug> { \int_use:N \l_@@_tag_stop_int }{\exp_not:n{#1}}
\int_incr:N \l_@@_tag_stop_int
\bool_set_false:N \l_@@_active_struct_bool
\bool_set_false:N \l_@@_active_mc_bool
\bool_set_false:N \l_@@_active_socket_bool
\@@_stop_para_ints:
}
\cs_set_protected:Npn \tag_start:n #1
\cs_set_eq:NN \tag_stop:n \tag_suspend:n
\cs_set_protected:Npn \tag_resume:n #1
{
\int_if_zero:nF { \l_@@_tag_stop_int } { \int_decr:N \l_@@_tag_stop_int }
\int_if_zero:nT { \l_@@_tag_stop_int }
Expand All @@ -593,10 +596,11 @@
\bool_set_true:N \l_@@_active_mc_bool
\bool_set_true:N \l_@@_active_socket_bool
\@@_start_para_ints:
}
%<debug> \msg_note:nnee {tag / debug }{tag-start}
}
%<debug> \msg_note:nnee {tag / debug }{tag-resume}
%<debug> { \int_use:N \l_@@_tag_stop_int }{\exp_not:n{#1}}
}
\cs_set_eq:NN \tag_start:n \tag_resume:n
%</package|debug>
%<*base>
\cs_new_protected:Npn \tag_stop:{}
Expand All @@ -605,6 +609,11 @@
\cs_new_protected:Npn \tagstart{}
\cs_new_protected:Npn \tag_stop:n #1 {}
\cs_new_protected:Npn \tag_start:n #1 {}
% \end{macrocode}
% Until the commands are provided by the kernel we provide them here too
% \begin{macrocode}
\cs_set_eq:NN \tag_suspend:n \tag_stop:n
\cs_set_eq:NN \tag_resume:n \tag_resume:n
%</base>
% \end{macrocode}
% \end{macro}
Expand Down

0 comments on commit 733085a

Please sign in to comment.