[latex3-commits] [git/LaTeX3-latex3-latex2e] develop: add no-op commands for the new linktarget interface of hyperref (#816) (0dceaa68)

GitHub noreply at github.com
Wed May 18 10:10:57 CEST 2022


Repository : https://github.com/latex3/latex2e
On branch  : develop
Link       : https://github.com/latex3/latex2e/commit/0dceaa6881d0f7b4d7cbe2ed0510f3b173be37f7

>---------------------------------------------------------------

commit 0dceaa6881d0f7b4d7cbe2ed0510f3b173be37f7
Author: Ulrike Fischer <news3 at nililand.de>
Date:   Wed May 18 10:10:57 2022 +0200

    add no-op commands for the new linktarget interface of hyperref (#816)
    
    * 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 at troubleshooting-tex.de>
    Co-authored-by: Frank Mittelbach <frank.mittelbach at latex-project.org>


>---------------------------------------------------------------

0dceaa6881d0f7b4d7cbe2ed0510f3b173be37f7
 base/changes.txt                                   |  5 +++
 base/doc/ltnews35.tex                              | 14 +++++++
 base/ltmeta.dtx                                    | 43 ++++++++++++++++++----
 ...tlb-latexrelease-rollback-2021-06-01.luatex.tlg |  2 +-
 .../tlb-latexrelease-rollback-2021-06-01.tlg       |  2 +-
 .../tlb-latexrelease-rollback-2021-06-01.xetex.tlg |  2 +-
 ...tlb-latexrelease-rollback-2021-11-15.luatex.tlg |  2 +-
 .../tlb-latexrelease-rollback-2021-11-15.tlg       |  2 +-
 .../tlb-latexrelease-rollback-2021-11-15.xetex.tlg |  2 +-
 9 files changed, 60 insertions(+), 14 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index db889fb1..4a77d73c 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -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 at latex-project.org>
+
+	* ltmeta.dtx:
+	Added dummy definitions for target commands.
+
 2022-05-08  Marcel Krüger  <Marcel.Krueger at latex-project.org>
 
   * utf8ienc.dtx:
diff --git a/base/doc/ltnews35.tex b/base/doc/ltnews35.tex
index 1bd87bbb..2cb8c0d1 100644
--- a/base/doc/ltnews35.tex
+++ b/base/doc/ltnews35.tex
@@ -205,6 +205,9 @@ Documentation about the new command and
 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}
 
@@ -494,7 +497,18 @@ in captions and sectioning commands. The package \pkg{ifthen} has been updated t
 \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}
 
diff --git a/base/ltmeta.dtx b/base/ltmeta.dtx
index edea7dfb..31c5d8db 100644
--- a/base/ltmeta.dtx
+++ b/base/ltmeta.dtx
@@ -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
@@ -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}%
      {}%
@@ -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>
diff --git a/base/testfiles/tlb-latexrelease-rollback-2021-06-01.luatex.tlg b/base/testfiles/tlb-latexrelease-rollback-2021-06-01.luatex.tlg
index c0ef4498..be300fe6 100644
--- a/base/testfiles/tlb-latexrelease-rollback-2021-06-01.luatex.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-2021-06-01.luatex.tlg
@@ -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 ....
diff --git a/base/testfiles/tlb-latexrelease-rollback-2021-06-01.tlg b/base/testfiles/tlb-latexrelease-rollback-2021-06-01.tlg
index d8aacd74..51bdbe78 100644
--- a/base/testfiles/tlb-latexrelease-rollback-2021-06-01.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-2021-06-01.tlg
@@ -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 ....
diff --git a/base/testfiles/tlb-latexrelease-rollback-2021-06-01.xetex.tlg b/base/testfiles/tlb-latexrelease-rollback-2021-06-01.xetex.tlg
index 9b44037b..7900e8fc 100644
--- a/base/testfiles/tlb-latexrelease-rollback-2021-06-01.xetex.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-2021-06-01.xetex.tlg
@@ -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 ....
diff --git a/base/testfiles/tlb-latexrelease-rollback-2021-11-15.luatex.tlg b/base/testfiles/tlb-latexrelease-rollback-2021-11-15.luatex.tlg
index 9f30e524..ab2ce841 100644
--- a/base/testfiles/tlb-latexrelease-rollback-2021-11-15.luatex.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-2021-11-15.luatex.tlg
@@ -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 ....
diff --git a/base/testfiles/tlb-latexrelease-rollback-2021-11-15.tlg b/base/testfiles/tlb-latexrelease-rollback-2021-11-15.tlg
index 54825fc4..9222f620 100644
--- a/base/testfiles/tlb-latexrelease-rollback-2021-11-15.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-2021-11-15.tlg
@@ -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 ....
diff --git a/base/testfiles/tlb-latexrelease-rollback-2021-11-15.xetex.tlg b/base/testfiles/tlb-latexrelease-rollback-2021-11-15.xetex.tlg
index 7b9e6b74..13208f99 100644
--- a/base/testfiles/tlb-latexrelease-rollback-2021-11-15.xetex.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-2021-11-15.xetex.tlg
@@ -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 ....





More information about the latex3-commits mailing list.