Skip to content

Commit

Permalink
add no-op commands for the new linktarget interface of hyperref (#816)
Browse files Browse the repository at this point in the history
* add dummies for linktarget interface

* make no-op MakeLinkTarget behave like hyperref version

* correct date

* add test if DocumentMetadata has been used

* update the rollback tests

* revert change

* add target commands to ltmeta

* small docu update

Co-authored-by: Ulrike Fischer <fischer@troubleshooting-tex.de>
Co-authored-by: Frank Mittelbach <frank.mittelbach@latex-project.org>
  • Loading branch information
3 people committed May 18, 2022
1 parent 29daed6 commit 0dceaa6
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 14 deletions.
5 changes: 5 additions & 0 deletions base/changes.txt
Expand Up @@ -5,6 +5,11 @@ It is provided for convenience only. It therefore makes no claims to
completeness or accuracy and it contains some references to files that
are not part of the distribution.
================================================================================
2022-05-17 Ulrike Fischer <Ulrike.Fischer@latex-project.org>

* ltmeta.dtx:
Added dummy definitions for target commands.

2022-05-08 Marcel Krüger <Marcel.Krueger@latex-project.org>

* utf8ienc.dtx:
Expand Down
14 changes: 14 additions & 0 deletions base/doc/ltnews35.tex
Expand Up @@ -205,6 +205,9 @@ \section{Document metadata interface}
already existing keys are in \file{l3meta.pdf} and \file{documentmetadata-support.pdf}
and also in the documentation of the \pkg{pdfmanagement-testphase} package.

Package and class authors can test if a user has used \cs{DocumentMetadata}
with \cs{IfDocumentMetadataTF}.


\section{The \pkg{latex-lab} bundle}

Expand Down Expand Up @@ -494,7 +497,18 @@ \subsection{Starred command version for \cs{ref}, \cs{Ref} and \cs{pageref}}
\cs{pageref} can still be used inside tests like \cs{isodd}.


\subsection{Preparation for supporting PDF in backends}

At the current point in time, basic support for PDF in
backends is not part of \LaTeX{} core; it is provided by external
package like \pkg{hyperref}.
At some time in the future that work will be placed
into the kernel but for now it is separate and has to be
explicitly loaded in the document. To enable class and package authors
to support PDF specific task like the creation of link targets without
having to test first if \pkg{hyperref} has been loaded, dummy versions of
the commands \cs{MakeLinkTarget}, \cs{LinkTargetOn}, \cs{LinkTargetOff} and
\cs{NextLinkTarget} are provided.

\section{Code improvements}

Expand Down
43 changes: 35 additions & 8 deletions base/ltmeta.dtx
Expand Up @@ -14,14 +14,12 @@
%%% From File: ltmeta.dtx
%
% \begin{macrocode}
\def\ltmetaversion{v1.0a}
\def\ltmetadate{2021/12/07}
\def\ltmetaversion{v1.0b}
\def\ltmetadate{2022/05/18}
% \end{macrocode}
%<*driver>
\documentclass{l3doc}

%\usepackage{ltmeta}

% Fixing footnotes in functions and variables: this should be in l3doc!

\newcommand\fixfootnote[2]{\footnotemark
Expand Down Expand Up @@ -122,11 +120,12 @@
% \end{macrocode}
%
% \begin{macrocode}
%<latexrelease>\NewModuleRelease{2021/06/01}{ltmeta}
%<latexrelease>\NewModuleRelease{2022/06/01}{ltmeta}
%<latexrelease> {Document Metadata handling}
% \end{macrocode}
%
% \begin{macrocode}
\let \IfDocumentMetadataTF \@secondoftwo
\protected\def\DocumentMetadata{%
\InputIfFileExists{documentmetadata-support.ltx}%
{}%
Expand All @@ -149,16 +148,44 @@
% \begin{macrocode}
\let\DocumentMetadata\@gobble
}%
\let \IfDocumentMetadataTF \@firstoftwo
\DocumentMetadata
}
% \end{macrocode}
%
% To allow package and class author to support for document links
% we provide also the new interface commands of the hyperref package
% for the creation of targets.
% \changes{v1.0b}{2022/05/17}{Default definition for targets added}
% \begin{macro}{\MakeLinkTarget}
% \begin{macro}{\LinkTargetOn}
% \begin{macro}{\LinkTargetOff}
% \begin{macro}{\NextLinkTarget}
% \begin{macrocode}
\NewDocumentCommand\MakeLinkTarget{sO{}m}{%
\ifvmode
\special{}%
\else
\@savsf\spacefactor
\smash{}%
\spacefactor\@savsf
\fi}
\NewDocumentCommand\LinkTargetOn{}{}
\NewDocumentCommand\LinkTargetOff{}{}
\NewDocumentCommand\NextLinkTarget{m}{}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
%
%
% We do not undo \cs{MakeLinkTarget} and friends if we roll back, in
% case they are used in packages that themselves do not offer
% rollback. This way a roll forward adds them, but the dummies remain
% if you roll back and you don't get missing csname errors if they
% are used.
% \begin{macrocode}
%
%<latexrelease>\IncludeInRelease{0000/00/00}{ltmeta}%
%<latexrelease> {Undo Document Metadata handling}
%<latexrelease>
Expand Down
Expand Up @@ -160,7 +160,7 @@ END module: ltpara (....-..-..) on input line ....
BEGIN module: ltmeta (....-..-..) on input line ....
Document Metadata handling.
Skipping module ltmeta on input line ....
Skipping: [....-..-..] Undo Document Metadata handling on input line ....
Applying: [....-..-..] Undo Document Metadata handling on input line ....
END module: ltmeta (....-..-..) on input line ....
Applying: [....-..-..] Make commands robust on input line ....
LaTeX Info: Redefining \pagebreak on input line ....
Expand Down
2 changes: 1 addition & 1 deletion base/testfiles/tlb-latexrelease-rollback-2021-06-01.tlg
Expand Up @@ -149,7 +149,7 @@ END module: ltpara (....-..-..) on input line ....
BEGIN module: ltmeta (....-..-..) on input line ....
Document Metadata handling.
Skipping module ltmeta on input line ....
Skipping: [....-..-..] Undo Document Metadata handling on input line ....
Applying: [....-..-..] Undo Document Metadata handling on input line ....
END module: ltmeta (....-..-..) on input line ....
Applying: [....-..-..] Make commands robust on input line ....
LaTeX Info: Redefining \pagebreak on input line ....
Expand Down
Expand Up @@ -149,7 +149,7 @@ END module: ltpara (....-..-..) on input line ....
BEGIN module: ltmeta (....-..-..) on input line ....
Document Metadata handling.
Skipping module ltmeta on input line ....
Skipping: [....-..-..] Undo Document Metadata handling on input line ....
Applying: [....-..-..] Undo Document Metadata handling on input line ....
END module: ltmeta (....-..-..) on input line ....
Applying: [....-..-..] Make commands robust on input line ....
LaTeX Info: Redefining \pagebreak on input line ....
Expand Down
Expand Up @@ -160,7 +160,7 @@ END module: ltpara (....-..-..) on input line ....
BEGIN module: ltmeta (....-..-..) on input line ....
Document Metadata handling.
Skipping module ltmeta on input line ....
Skipping: [....-..-..] Undo Document Metadata handling on input line ....
Applying: [....-..-..] Undo Document Metadata handling on input line ....
END module: ltmeta (....-..-..) on input line ....
Applying: [....-..-..] Make commands robust on input line ....
LaTeX Info: Redefining \pagebreak on input line ....
Expand Down
2 changes: 1 addition & 1 deletion base/testfiles/tlb-latexrelease-rollback-2021-11-15.tlg
Expand Up @@ -149,7 +149,7 @@ END module: ltpara (....-..-..) on input line ....
BEGIN module: ltmeta (....-..-..) on input line ....
Document Metadata handling.
Skipping module ltmeta on input line ....
Skipping: [....-..-..] Undo Document Metadata handling on input line ....
Applying: [....-..-..] Undo Document Metadata handling on input line ....
END module: ltmeta (....-..-..) on input line ....
Applying: [....-..-..] Make commands robust on input line ....
LaTeX Info: Redefining \pagebreak on input line ....
Expand Down
Expand Up @@ -149,7 +149,7 @@ END module: ltpara (....-..-..) on input line ....
BEGIN module: ltmeta (....-..-..) on input line ....
Document Metadata handling.
Skipping module ltmeta on input line ....
Skipping: [....-..-..] Undo Document Metadata handling on input line ....
Applying: [....-..-..] Undo Document Metadata handling on input line ....
END module: ltmeta (....-..-..) on input line ....
Applying: [....-..-..] Make commands robust on input line ....
LaTeX Info: Redefining \pagebreak on input line ....
Expand Down

0 comments on commit 0dceaa6

Please sign in to comment.