Skip to content

Commit

Permalink
remove the mark id when extracting the data
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankMittelbach committed May 31, 2024
1 parent 7b33dec commit 7918384
Show file tree
Hide file tree
Showing 34 changed files with 1,095 additions and 995 deletions.
7 changes: 7 additions & 0 deletions base/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ to completeness or accuracy and it contains some references to files that are
not part of the distribution.
================================================================================

2024-05-31 Frank Mittelbach <Frank.Mittelbach@latex-project.org>

* ltmarks.dtx (subsection{Allocating new mark classes}):
Initialize all marks with an id, use 0 when a new class is made (gh/1359)
(subsection{Placing and retrieving marks}):
Remove the id when returning the mark value (gh/1359)

2024-05-30 Frank Mittelbach <Frank.Mittelbach@latex-project.org>

* ltmarks.dtx (subsection{Placing and retrieving marks}):
Expand Down
50 changes: 43 additions & 7 deletions base/ltmarks.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
%<*driver>
% \fi
\ProvidesFile{ltmarks.dtx}
[2024/05/30 v1.0f LaTeX Kernel (Marks)]
[2024/05/31 v1.0g LaTeX Kernel (Marks)]
% \iffalse
%
\documentclass{l3doc}
Expand Down Expand Up @@ -805,6 +805,32 @@
\tl_new:c { g_@@_last-column_top_ #1 _tl }
\tl_new:c { g_@@_last-column_first_ #1 _tl }
\tl_new:c { g_@@_last-column_last_ #1 _tl }
% \end{macrocode}
% All marks will have an identication at the beginning of the form
% \cs{@@_id:n}\texttt\{\meta{number}\texttt\} and therefore the
% initial empty values should have that too, so that data extraction
% is going to be uniform.
% \changes{v1.0g}{2024/05/31}{Initialize all marks with an id, use 0
% when a new class is made (gh/1359)}
% \begin{macrocode}
\tl_set:cn { g_@@_page_top_ #1 _tl }{ \@@_id:n{0} }
\tl_set:cn { g_@@_page_first_ #1 _tl }{ \@@_id:n{0} }
\tl_set:cn { g_@@_page_last_ #1 _tl }{ \@@_id:n{0} }
\tl_set:cn { g_@@_previous-page_top_ #1 _tl }{ \@@_id:n{0} }
\tl_set:cn { g_@@_previous-page_first_ #1 _tl }{ \@@_id:n{0} }
\tl_set:cn { g_@@_previous-page_last_ #1 _tl }{ \@@_id:n{0} }
\tl_set:cn { g_@@_column_top_ #1 _tl }{ \@@_id:n{0} }
\tl_set:cn { g_@@_column_first_ #1 _tl }{ \@@_id:n{0} }
\tl_set:cn { g_@@_column_last_ #1 _tl }{ \@@_id:n{0} }
\tl_set:cn { g_@@_previous-column_top_ #1 _tl }{ \@@_id:n{0} }
\tl_set:cn { g_@@_previous-column_first_ #1 _tl }{ \@@_id:n{0} }
\tl_set:cn { g_@@_previous-column_last_ #1 _tl }{ \@@_id:n{0} }
\tl_set:cn { g_@@_first-column_top_ #1 _tl }{ \@@_id:n{0} }
\tl_set:cn { g_@@_first-column_first_ #1 _tl }{ \@@_id:n{0} }
\tl_set:cn { g_@@_first-column_last_ #1 _tl }{ \@@_id:n{0} }
\tl_set:cn { g_@@_last-column_top_ #1 _tl }{ \@@_id:n{0} }
\tl_set:cn { g_@@_last-column_first_ #1 _tl }{ \@@_id:n{0} }
\tl_set:cn { g_@@_last-column_last_ #1 _tl }{ \@@_id:n{0} }
}
% \end{macrocode}
% \end{macro}
Expand Down Expand Up @@ -1413,7 +1439,7 @@
% \changes{v1.0f}{2024/05/30}{Use sequence marker to make all marks
% unique on nearby regions (gh/1359)}
% \begin{macrocode}
\@@_number:n{ \int_use:N\g_@@_int }
\@@_id:n{ \int_use:N\g_@@_int }
#2
}
%<*trace>
Expand Down Expand Up @@ -1454,7 +1480,7 @@
% \end{macro}
%
%
% \begin{macro}{\@@_number:n}
% \begin{macro}{\@@_id:n}
% A hidden marker is placed into every mark added by
% \cs{mark_insert:nn}. It will will not show up in the output but
% its argument (a counter value that is incremented) makes all
Expand All @@ -1463,7 +1489,7 @@
% \changes{v1.0f}{2024/05/30}{Use sequence marker to make all marks
% unique on nearby regions (gh/1359)}
% \begin{macrocode}
\cs_new_protected:Npn \@@_number:n #1 { }
\cs_new_protected:Npn \@@_id:n #1 { }
% \end{macrocode}
% \end{macro}
%
Expand Down Expand Up @@ -1510,10 +1536,20 @@
%
% If used with an unknown class or region they generate an error
% (fairly low-level because we are in an expandable context).
%
% Each mark starts with an id and while the id does not print it is
% nevertheless better to remove it when returning the mark, so that
% downstream manipulation of the data doesn't have to deal with it.
% \changes{v1.0g}{2024/05/31}{Remove the id when returning the mark value (gh/1359)}
% \begin{macrocode}
\cs_new:Npn \mark_use_first:nn #1#2 { \@@_use:v { g_@@_#1_first_#2_tl } }
\cs_new:Npn \mark_use_last:nn #1#2 { \@@_use:v { g_@@_#1_last_#2_tl } }
\cs_new:Npn \mark_use_top:nn #1#2 { \@@_use:v { g_@@_#1_top_#2_tl } }
% \end{macrocode}
% This is what the \cs{use_none:nn} accomplishes.
% \begin{macrocode}
\cs_new:Npn \mark_use_first:nn #1#2 { \exp_not:v { g_@@_#1_first_#2_tl } }
\cs_new:Npn \mark_use_last:nn #1#2 { \exp_not:v { g_@@_#1_last_#2_tl } }
\cs_new:Npn \mark_use_top:nn #1#2 { \exp_not:v { g_@@_#1_top_#2_tl } }
\cs_new:Npn \@@_use:n #1 { \exp_not:o { \use_none:nn #1 } }
\cs_generate_variant:Nn \@@_use:n { v }
% \end{macrocode}
% \end{macro}
%
Expand Down
12 changes: 6 additions & 6 deletions base/testfiles-doc/tlb-dox004.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -957,9 +957,9 @@ Completed box being shipped out [4]
.......\glue(\rightskip) 0.0
......\penalty 10000
......\glue 9.90276 plus 0.86108
......\marks1{\__mark_number:n {1}Index}
......\marks2{\__mark_number:n {2}Index}
......\marks3{\__mark_number:n {3}Index}
......\marks1{\__mark_id:n {1}Index}
......\marks2{\__mark_id:n {2}Index}
......\marks3{\__mark_id:n {3}Index}
......\mark{{Index}{Index}}
......\penalty 10000
......\glue(\parskip) 0.0
Expand Down Expand Up @@ -2131,9 +2131,9 @@ Completed box being shipped out [5]
.......\glue(\rightskip) 0.0
......\penalty 10000
......\glue 9.90276 plus 0.86108
......\marks1{\__mark_number:n {4}{Change History}}
......\marks2{\__mark_number:n {5}{Change History}}
......\marks3{\__mark_number:n {6}{Change History}}
......\marks1{\__mark_id:n {4}{Change History}}
......\marks2{\__mark_id:n {5}{Change History}}
......\marks3{\__mark_id:n {6}{Change History}}
......\mark{{{Change History}}{{Change History}}}
......\penalty 10000
......\glue -20.0 plus -2.0 minus -4.0
Expand Down
12 changes: 6 additions & 6 deletions base/testfiles-doc/tlb-dox005.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -801,9 +801,9 @@ Completed box being shipped out [3]
....\glue(\rightskip) 0.0
...\penalty 10000
...\glue 9.90276 plus 0.86108
...\marks1{\__mark_number:n {1}Index}
...\marks2{\__mark_number:n {2}Index}
...\marks3{\__mark_number:n {3}Index}
...\marks1{\__mark_id:n {1}Index}
...\marks2{\__mark_id:n {2}Index}
...\marks3{\__mark_id:n {3}Index}
...\mark{{Index}{Index}}
...\penalty 10000
...\glue(\parskip) 0.0 plus 1.0
Expand Down Expand Up @@ -1800,9 +1800,9 @@ Completed box being shipped out [3]
....\glue(\rightskip) 0.0
...\penalty 10000
...\glue 9.90276 plus 0.86108
...\marks1{\__mark_number:n {4}{Change History}}
...\marks2{\__mark_number:n {5}{Change History}}
...\marks3{\__mark_number:n {6}{Change History}}
...\marks1{\__mark_id:n {4}{Change History}}
...\marks2{\__mark_id:n {5}{Change History}}
...\marks3{\__mark_id:n {6}{Change History}}
...\mark{{{Change History}}{{Change History}}}
...\penalty 10000
...\glue 12.0 plus 4.0 minus 3.0
Expand Down
4 changes: 2 additions & 2 deletions base/testfiles-lthooks2/shipout2-006.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ Completed box being shipped out [2]
...\hbox(0.0+0.0)x0.0
...\glue 0.0 plus 1.0fil
...\write1{\@writefile{toc}{\protect \contentsline {part}{I\protect \hspace {1em}A}{\thepage }{}\protected@file@percent }}
...\marks1{\__mark_number:n {1}}
...\marks2{\__mark_number:n {2}}
...\marks1{\__mark_id:n {1}}
...\marks2{\__mark_id:n {2}}
...\mark{{}{}}
...\glue(\parskip) 0.0 plus 1.0
...\glue(\parskip) 0.0
Expand Down
1 change: 0 additions & 1 deletion base/testfiles-ltmarks/github-1359.lvt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ A short one

\lipsum[14]


\newpage

\OMIT
Expand Down
16 changes: 8 additions & 8 deletions base/testfiles-ltmarks/github-1359.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
===> page = 1:
top: 2e-left = | 2e-right-nonempty =
first: 2e-left = \__mark_number:n {1}1. First section | 2e-right-nonempty = \__mark_number:n {4}1.1. First subsection
last: 2e-left = \__mark_number:n {1}1. First section | 2e-right-nonempty = \__mark_number:n {4}1.1. First subsection
first: 2e-left = 1. First section | 2e-right-nonempty = 1.1. First subsection
last: 2e-left = 1. First section | 2e-right-nonempty = 1.1. First subsection
[1
]
===> page = 2:
top: 2e-left = \__mark_number:n {1}1. First section | 2e-right-nonempty = \__mark_number:n {4}1.1. First subsection
first: 2e-left = \__mark_number:n {5}2. Second section | 2e-right-nonempty = \__mark_number:n {8}2.1. Second subsection A
last: 2e-left = \__mark_number:n {5}2. Second section | 2e-right-nonempty = \__mark_number:n {10}2.2. Second subsection B
top: 2e-left = 1. First section | 2e-right-nonempty = 1.1. First subsection
first: 2e-left = 2. Second section | 2e-right-nonempty = 2.1. Second subsection A
last: 2e-left = 2. Second section | 2e-right-nonempty = 2.2. Second subsection B
[2]
===> page = 3:
top: 2e-left = \__mark_number:n {5}2. Second section | 2e-right-nonempty = \__mark_number:n {10}2.2. Second subsection B
first: 2e-left = \__mark_number:n {11}3. Third section | 2e-right-nonempty = \__mark_number:n {16}4.1. Forth subsection
last: 2e-left = \__mark_number:n {13}4. Forth section | 2e-right-nonempty = \__mark_number:n {16}4.1. Forth subsection
top: 2e-left = 2. Second section | 2e-right-nonempty = 2.2. Second subsection B
first: 2e-left = 3. Third section | 2e-right-nonempty = 4.1. Forth subsection
last: 2e-left = 4. Forth section | 2e-right-nonempty = 4.1. Forth subsection
[3]
10 changes: 5 additions & 5 deletions base/testfiles-ltmarks/github-1359b.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
===> page = 1:
top: 2e-left = | 2e-right-nonempty =
first: 2e-left = \__mark_number:n {1}1. First section | 2e-right-nonempty = \__mark_number:n {4}Introduction
last: 2e-left = \__mark_number:n {1}1. First section | 2e-right-nonempty = \__mark_number:n {4}Introduction
first: 2e-left = 1. First section | 2e-right-nonempty = Introduction
last: 2e-left = 1. First section | 2e-right-nonempty = Introduction
[1
]
===> page = 2:
top: 2e-left = \__mark_number:n {1}1. First section | 2e-right-nonempty = \__mark_number:n {4}Introduction
first: 2e-left = \__mark_number:n {5}2. Second section | 2e-right-nonempty = \__mark_number:n {8}Introduction
last: 2e-left = \__mark_number:n {5}2. Second section | 2e-right-nonempty = \__mark_number:n {10}Second subsection
top: 2e-left = 1. First section | 2e-right-nonempty = Introduction
first: 2e-left = 2. Second section | 2e-right-nonempty = Introduction
last: 2e-left = 2. Second section | 2e-right-nonempty = Second subsection
[2]
Loading

0 comments on commit 7918384

Please sign in to comment.