[latex3-commits] [latex3/tagpdf] changetagstop: change tagstop (dee83ba)
github at latex-project.org
github at latex-project.org
Fri Dec 8 14:58:31 CET 2023
Repository : https://github.com/latex3/tagpdf
On branch : changetagstop
Link : https://github.com/latex3/tagpdf/commit/dee83ba47d7a0042193dd04d21fa45a579b8616d
>---------------------------------------------------------------
commit dee83ba47d7a0042193dd04d21fa45a579b8616d
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Fri Dec 8 14:58:31 2023 +0100
change tagstop
>---------------------------------------------------------------
dee83ba47d7a0042193dd04d21fa45a579b8616d
CHANGELOG.md | 4 +++
doc/tagpdf.tex | 20 ++++--------
tagpdf-mc-shared.dtx | 6 ++--
tagpdf.dtx | 38 +++++++---------------
testfiles-luatex/debug-structures-2.tlg | 12 +++++++
testfiles-luatex/debug-structures.tlg | 12 +++++++
testfiles-pdftex/debug-structures-2.pdftexmain.tlg | 12 +++++++
testfiles-pdftex/debug-structures-2.tlg | 12 +++++++
testfiles-pdftex/debug-structures.pdftexmain.tlg | 12 +++++++
testfiles-pdftex/debug-structures.tlg | 12 +++++++
testfiles/test-start-stop.lvt | 18 ++++++++--
testfiles/test-start-stop.tlg | 13 ++++++--
12 files changed, 124 insertions(+), 47 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1075140..c0546fb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,10 +11,14 @@ this project uses date-based 'snapshot' version identifiers.
- ignore AFref, AFinline-key with empty value.
- Documentation changes
- move para bool to tagpdf-base
+ - \tag_stop:/\tag_start: keep tracking of nesting with a counter.
### Fixed
- test for structure end if tagging has been stopped.
+### Removed
+ - \tag_stop_group_begin: and \tag_stop_group_end:
+
## [2023-11-19]
Version: 0.98q
diff --git a/doc/tagpdf.tex b/doc/tagpdf.tex
index 5a84f38..f925247 100644
--- a/doc/tagpdf.tex
+++ b/doc/tagpdf.tex
@@ -1961,27 +1961,19 @@ the commands will disappear again if we realize that they are not fitting!}
\begin{docCommand}[nosep]{tag_start:}{}\end{docCommand}
\begin{docCommand}[nosep]{tagstop}{}\end{docCommand}
\begin{docCommand}[nosep]{tagstart}{}\end{docCommand}
-\begin{docCommand}[nosep]{tag_stop_group_begin:}{}\end{docCommand}
-\begin{docCommand}{tag_start_group_end:}{}\end{docCommand}
+\begin{docCommand}[nosep]{tag_stop:n}{\marg{label}}\end{docCommand}
+\begin{docCommand}{tag_start:n}{\marg{label}}\end{docCommand}
This commands stop and start tagging in the current group by switching
\emph{local} booleans. They also stop the increasing of the counters which
-keep track of paragraphs if the correct wrapper commands are used. The
-grouping commands also open and close a group.
+keep track of paragraphs if the correct wrapper commands are used.
Restarting tagging is normally only needed if groups can't be used and then
must be done with care: |\tagstart| should normally only restart tagging if
-the corresponding stop command actually stopped tagging. In complicated
-case the following labeled version can be used:
-
-\begin{docCommand}[nosep]{tag_stop:n}{\marg{label}}\end{docCommand}
-\begin{docCommand}{tag_start:n}{\marg{label}}\end{docCommand}
+the corresponding stop command actually stopped tagging. This is implement
+through a local counter which keeps track of the level.
-This commands stop and start tagging in the current group
-by switching \emph{local} booleans, but |\tag_start:n|
-only restarts if the corresponding |tag_stop:n| actually
-stopped something. This is meant for a situation like the following,
-where you don't want that the inner |\tag_start:n| restarts tagging.
+The \meta{label} can be used to identify the command in debugging message.
\begin{taglstlisting}
\tag_stop:n{outer}
diff --git a/tagpdf-mc-shared.dtx b/tagpdf-mc-shared.dtx
index 8fd91f9..3f26e97 100644
--- a/tagpdf-mc-shared.dtx
+++ b/tagpdf-mc-shared.dtx
@@ -364,12 +364,14 @@
{
\tag_mc_end_push:
\tag_mc_begin:n {artifact=#1}
- \tag_stop_group_begin:
+ \group_begin:
+ \tag_stop:n{artifact-group}
}
\cs_set_protected:Npn \tag_mc_artifact_group_end:
{
- \tag_stop_group_end:
+ \tag_start:n{artifact-group}
+ \group_end:
\tag_mc_end:
\tag_mc_begin_pop:n{}
}
diff --git a/tagpdf.dtx b/tagpdf.dtx
index bb8e362..80146b0 100644
--- a/tagpdf.dtx
+++ b/tagpdf.dtx
@@ -33,12 +33,11 @@
% \end{syntax}
% \end{function}
%
-% \begin{function}{ \tag_stop_group_begin:, \tag_stop_group_end:,
+% \begin{function}{
% \tag_stop:, \tag_start:,
% \tagstop, \tagstart }
% We need commands to stop tagging in some places.
-% They simply switches the two local booleans. The grouping commands
-% can be used to group the effect.
+% They simply switches the two local booleans.
% \end{function}
%
% \begin{function}{\tag_stop:n, \tag_start:n }%
@@ -462,16 +461,17 @@
%
% \section{General tagging commands}
%
-% \begin{macro}{\tag_stop_group_begin:,
-% \tag_stop_group_end:,
+% \begin{macro}{
% \tag_stop:,\tag_start:,
% \tag_stop:n,\tag_start:n}
% We need commands to stop tagging in some places.
% This simply switches the two local booleans.
-% In some cases tagging should only restart, if
-% it actually was stopped before. For this it is possible
-% to label a stop.
-
+% The commands keep track of the nesting with a local
+% 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.
+%
% \begin{variable}{\l_@@_tag_stop_int}
% When stop/start pairs are nested we do not want the inner
% start command to restart tagging. To control this we use a
@@ -485,22 +485,6 @@
% \end{variable}
%
% \begin{macrocode}
-%<package>\cs_new_protected:Npn \tag_stop_group_begin:
-%<debug>\cs_set_protected:Npn \tag_stop_group_begin:
- {
- \group_begin:
-%<debug> \msg_note:nnx {tag / debug }{tag-stop}{ \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
- \@@_stop_para_ints:
- }
-%<package>\cs_set_eq:NN \tag_stop_group_end: \group_end:
-%<debug>\cs_set_protected:Npn \tag_stop_group_end:
-%<debug> {
-%<debug> \group_end:
-%<debug> \msg_note:nnx {tag / debug }{tag-start}{ \int_use:N \l_@@_tag_stop_int }
-%<debug> }
\cs_set_protected:Npn \tag_stop:
{
%<debug> \msg_note:nnx {tag / debug }{tag-stop}{ \int_use:N \l_@@_tag_stop_int }
@@ -511,7 +495,7 @@
}
\cs_set_protected:Npn \tag_start:
{
- \int_decr:N \l_@@_tag_stop_int
+ \int_if_zero:nF { \l_@@_tag_stop_int } { \int_decr:N \l_@@_tag_stop_int }
\int_if_zero:nT { \l_@@_tag_stop_int }
{
\bool_set_true:N \l_@@_active_struct_bool
@@ -534,7 +518,7 @@
}
\cs_set_protected:Npn \tag_start:n #1
{
- \int_decr:N \l_@@_tag_stop_int
+ \int_if_zero:nF { \l_@@_tag_stop_int } { \int_decr:N \l_@@_tag_stop_int }
\int_if_zero:nT { \l_@@_tag_stop_int }
{
\bool_set_true:N \l_@@_active_struct_bool
diff --git a/testfiles-luatex/debug-structures-2.tlg b/testfiles-luatex/debug-structures-2.tlg
index 8da2172..303872b 100644
--- a/testfiles-luatex/debug-structures-2.tlg
+++ b/testfiles-luatex/debug-structures-2.tlg
@@ -1,6 +1,18 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: hangfrom [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: hangfrom [on line ...]
Package tagpdf Warning: structure with label blub has already been used
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: headfoot [on line ...]
[1
] (debug-structures-2.aux)
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
diff --git a/testfiles-luatex/debug-structures.tlg b/testfiles-luatex/debug-structures.tlg
index c1e7a8d..6295de7 100644
--- a/testfiles-luatex/debug-structures.tlg
+++ b/testfiles-luatex/debug-structures.tlg
@@ -1,6 +1,18 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: hangfrom [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: hangfrom [on line ...]
Package tagpdf Warning: structure with label blub has already been used
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: headfoot [on line ...]
[1
] (debug-structures.aux)
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
diff --git a/testfiles-pdftex/debug-structures-2.pdftexmain.tlg b/testfiles-pdftex/debug-structures-2.pdftexmain.tlg
index 730bb46..5af293b 100644
--- a/testfiles-pdftex/debug-structures-2.pdftexmain.tlg
+++ b/testfiles-pdftex/debug-structures-2.pdftexmain.tlg
@@ -1,5 +1,17 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: hangfrom [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: hangfrom [on line ...]
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: headfoot [on line ...]
[1
] (debug-structures-2.aux)
=========================
diff --git a/testfiles-pdftex/debug-structures-2.tlg b/testfiles-pdftex/debug-structures-2.tlg
index 730bb46..5af293b 100644
--- a/testfiles-pdftex/debug-structures-2.tlg
+++ b/testfiles-pdftex/debug-structures-2.tlg
@@ -1,5 +1,17 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: hangfrom [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: hangfrom [on line ...]
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: headfoot [on line ...]
[1
] (debug-structures-2.aux)
=========================
diff --git a/testfiles-pdftex/debug-structures.pdftexmain.tlg b/testfiles-pdftex/debug-structures.pdftexmain.tlg
index d954cf0..9ce4aa3 100644
--- a/testfiles-pdftex/debug-structures.pdftexmain.tlg
+++ b/testfiles-pdftex/debug-structures.pdftexmain.tlg
@@ -1,5 +1,17 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: hangfrom [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: hangfrom [on line ...]
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: headfoot [on line ...]
[1
] (debug-structures.aux)
=========================
diff --git a/testfiles-pdftex/debug-structures.tlg b/testfiles-pdftex/debug-structures.tlg
index d954cf0..9ce4aa3 100644
--- a/testfiles-pdftex/debug-structures.tlg
+++ b/testfiles-pdftex/debug-structures.tlg
@@ -1,5 +1,17 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: hangfrom [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: hangfrom [on line ...]
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: headfoot [on line ...]
[1
] (debug-structures.aux)
=========================
diff --git a/testfiles/test-start-stop.lvt b/testfiles/test-start-stop.lvt
index b2aa94e..4af29c6 100644
--- a/testfiles/test-start-stop.lvt
+++ b/testfiles/test-start-stop.lvt
@@ -36,15 +36,29 @@
\ASSERTSTR{\tag_status:}{ACTIVE}
}
-\TEST{tag-stop-label2}
+\TEST{tag-stop-label1}
+ {
+ \ASSERTSTR{\tag_status:}{ACTIVE}
+ \tag_stop:n{L1}
+ \ASSERTSTR{\tag_status:}{NOT~ACTIVE}
+ \tag_start:n{L1}
+ \ASSERTSTR{\tag_status:}{ACTIVE}
+ }
+
+\TEST{tag-stop-label-nested}
{
\ASSERTSTR{\tag_status:}{ACTIVE}
\tag_stop:n{L1}
\ASSERTSTR{\tag_status:}{NOT~ACTIVE}
- \tag_start:n{LXX}
+ \tag_stop:n{L2}
+ \ASSERTSTR{\tag_status:}{NOT~ACTIVE}
+ \tag_start:n{L2}
\ASSERTSTR{\tag_status:}{NOT~ACTIVE}
+ \tag_start:n{L1}
+ \ASSERTSTR{\tag_status:}{ACTIVE}
}
+
\tag_stop:
\TEST{tag-stop-label2}
diff --git a/testfiles/test-start-stop.tlg b/testfiles/test-start-stop.tlg
index 1b2723f..ce161f4 100644
--- a/testfiles/test-start-stop.tlg
+++ b/testfiles/test-start-stop.tlg
@@ -19,14 +19,23 @@ PASSED
PASSED
============================================================
============================================================
-TEST 4: tag-stop-label2
+TEST 4: tag-stop-label1
============================================================
PASSED
PASSED
PASSED
============================================================
============================================================
-TEST 5: tag-stop-label2
+TEST 5: tag-stop-label-nested
+============================================================
+PASSED
+PASSED
+PASSED
+PASSED
+PASSED
+============================================================
+============================================================
+TEST 6: tag-stop-label2
============================================================
PASSED
PASSED
More information about the latex3-commits
mailing list.