[latex3-commits] [git/LaTeX3-latex3-hyperref] cleanup-patches: add interface for hyperxmp (ebd773f)

Ulrike Fischer fischer at troubleshooting-tex.de
Sat Jun 18 19:33:07 CEST 2022


Repository : https://github.com/latex3/hyperref
On branch  : cleanup-patches
Link       : https://github.com/latex3/hyperref/commit/ebd773fcb9e710b2afa1a1453e486c8bc432a347

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

commit ebd773fcb9e710b2afa1a1453e486c8bc432a347
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sat Jun 18 19:33:07 2022 +0200

    add interface for hyperxmp


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

ebd773fcb9e710b2afa1a1453e486c8bc432a347
 hyperref.dtx                            | 34 +++++++++++++++++++++++++++++++++
 testfiles/documentproperties.etex.tlg   | 25 ++++++++++++++++++++++++
 testfiles/documentproperties.luatex.tlg | 25 ++++++++++++++++++++++++
 testfiles/documentproperties.lvt        | 25 ++++++++++++++++++++++++
 testfiles/documentproperties.tlg        | 25 ++++++++++++++++++++++++
 5 files changed, 134 insertions(+)

diff --git a/hyperref.dtx b/hyperref.dtx
index 0fe1e79..1cfdce3 100644
--- a/hyperref.dtx
+++ b/hyperref.dtx
@@ -4435,7 +4435,35 @@
 %    \end{macrocode}
 %
 % \subsection{Help macros}
+% Package like hyperxmp want to retrieve the value of keys like |pdfauthor|.
+% To avoid that we have two parallel interfaces we provide the interface from
+% the pdfmanagement/ltdocinit if it doesn't exist.
 %
+%    \begin{macro}{\AddToDocumentProperties}
+%    \begin{macro}{\GetDocumentProperties}
+%    \begin{macrocode}
+\ExplSyntaxOn
+\@ifundefined{AddToDocumentProperties}
+  {
+   \prop_new:N \g__hyp_documentproperties_prop
+   \NewDocumentCommand\AddToDocumentProperties{O{\@currname}mm}
+    {
+      \exp_args:NNx
+      \prop_gput:Nnn \g__hyp_documentproperties_prop
+        {
+          \tl_if_blank:eTF {#1}{top-level/}{#1/} #2
+        }
+        { #3}
+    }
+   \NewExpandableDocumentCommand\GetDocumentProperties{m}
+     {
+       \prop_item:Nn \g__hyp_documentproperties_prop {#1}
+     }
+  }{}
+\ExplSyntaxOff
+%    \end{macrocode}
+%    \end{macro}
+%    \end{macro}
 %    \begin{macro}{\IfHyperBooleanExists}
 %    \begin{macrocode}
 \def\IfHyperBooleanExists#1{%
@@ -6202,21 +6230,25 @@
   \endgroup
 }
 \define at key{Hyp}{pdftitle}{%
+  \AddToDocumentProperties[hyperref]{pdftitle}{#1}%
   \HyXeTeX at CheckUnicode
   \HyPsd at PrerenderUnicode{#1}%
   \pdfstringdef\@pdftitle{#1}%
 }
 \define at key{Hyp}{pdfauthor}{%
+  \AddToDocumentProperties[hyperref]{pdfauthor}{#1}%
   \HyXeTeX at CheckUnicode
   \HyPsd at PrerenderUnicode{#1}%
   \pdfstringdef\@pdfauthor{#1}%
 }
 \define at key{Hyp}{pdfproducer}{%
+  \AddToDocumentProperties[hyperref]{pdfproducer}{#1}%
   \HyXeTeX at CheckUnicode
   \HyPsd at PrerenderUnicode{#1}%
   \pdfstringdef\@pdfproducer{#1}%
 }
 \define at key{Hyp}{pdfcreator}{%
+  \AddToDocumentProperties[hyperref]{pdfcreator}{#1}%
   \HyXeTeX at CheckUnicode
   \HyPsd at PrerenderUnicode{#1}%
   \pdfstringdef\@pdfcreator{#1}%
@@ -6239,11 +6271,13 @@
   \endgroup
 }
 \define at key{Hyp}{pdfsubject}{%
+  \AddToDocumentProperties[hyperref]{pdfsubject}{#1}%
   \HyXeTeX at CheckUnicode
   \HyPsd at PrerenderUnicode{#1}%
   \pdfstringdef\@pdfsubject{#1}%
 }
 \define at key{Hyp}{pdfkeywords}{%
+  \AddToDocumentProperties[hyperref]{pdfkeywords}{#1}%
   \HyXeTeX at CheckUnicode
   \HyPsd at PrerenderUnicode{#1}%
   \pdfstringdef\@pdfkeywords{#1}%
diff --git a/testfiles/documentproperties.etex.tlg b/testfiles/documentproperties.etex.tlg
new file mode 100644
index 0000000..05c2788
--- /dev/null
+++ b/testfiles/documentproperties.etex.tlg
@@ -0,0 +1,25 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+The property list \g__hyp_documentproperties_prop contains the pairs (without
+outer braces):
+>  {hyperref/pdfauthor}  =>  {(author1,xxx, gr^^fc^^dfe)}
+>  {hyperref/pdfkeywords}  =>  {keywords}
+>  {hyperref/pdfsubject}  =>  {subject}
+>  {hyperref/pdftitle}  =>  {title ^^e4^^fc^^df \blub yyy}.
+<recently read> }
+l. ...\prop_show:N\g__hyp_documentproperties_prop
+> \test=macro:
+->(author1,xxx, gr^^fc^^dfe).
+l. ...\show\test
+> \test=macro:
+->title ^^e4^^fc^^df \blub yyy.
+l. ...\show\test
+> \test=macro:
+->keywords.
+l. ...\show\test
+> \test=macro:
+->subject.
+l. ...\show\test
+(documentproperties.aux)
+Package rerunfilecheck Info: File `documentproperties.out' has not changed.
+(rerunfilecheck)             Checksum: D41D8CD98F00B204E9800998ECF8427E;0.
diff --git a/testfiles/documentproperties.luatex.tlg b/testfiles/documentproperties.luatex.tlg
new file mode 100644
index 0000000..05c2788
--- /dev/null
+++ b/testfiles/documentproperties.luatex.tlg
@@ -0,0 +1,25 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+The property list \g__hyp_documentproperties_prop contains the pairs (without
+outer braces):
+>  {hyperref/pdfauthor}  =>  {(author1,xxx, gr^^fc^^dfe)}
+>  {hyperref/pdfkeywords}  =>  {keywords}
+>  {hyperref/pdfsubject}  =>  {subject}
+>  {hyperref/pdftitle}  =>  {title ^^e4^^fc^^df \blub yyy}.
+<recently read> }
+l. ...\prop_show:N\g__hyp_documentproperties_prop
+> \test=macro:
+->(author1,xxx, gr^^fc^^dfe).
+l. ...\show\test
+> \test=macro:
+->title ^^e4^^fc^^df \blub yyy.
+l. ...\show\test
+> \test=macro:
+->keywords.
+l. ...\show\test
+> \test=macro:
+->subject.
+l. ...\show\test
+(documentproperties.aux)
+Package rerunfilecheck Info: File `documentproperties.out' has not changed.
+(rerunfilecheck)             Checksum: D41D8CD98F00B204E9800998ECF8427E;0.
diff --git a/testfiles/documentproperties.lvt b/testfiles/documentproperties.lvt
new file mode 100644
index 0000000..f6ea850
--- /dev/null
+++ b/testfiles/documentproperties.lvt
@@ -0,0 +1,25 @@
+\documentclass{article}
+\input{regression-test}
+
+\def\blub{xxx}
+\usepackage[pdfauthor={(author1,\blub, grüße)},pdfkeywords=keywords,pdfsubject=subject]{hyperref}
+\hypersetup{pdftitle={title äüß \blub yyy}}
+
+\begin{document}
+
+\START
+
+\ExplSyntaxOn
+\prop_show:N\g__hyp_documentproperties_prop
+%\str
+\edef\test{\GetDocumentProperties{hyperref/pdfauthor}}
+\show\test
+\edef\test{\GetDocumentProperties{hyperref/pdftitle}}
+\show\test
+\edef\test{\GetDocumentProperties{hyperref/pdfkeywords}}
+\show\test
+\edef\test{\GetDocumentProperties{hyperref/pdfsubject}}
+\show\test
+
+\ExplSyntaxOff
+\end{document}
\ No newline at end of file
diff --git a/testfiles/documentproperties.tlg b/testfiles/documentproperties.tlg
new file mode 100644
index 0000000..b64336c
--- /dev/null
+++ b/testfiles/documentproperties.tlg
@@ -0,0 +1,25 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+The property list \g__hyp_documentproperties_prop contains the pairs (without
+outer braces):
+>  {hyperref/pdfauthor}  =>  {(author1,xxx, gr^^c3^^bc^^c3^^9fe)}
+>  {hyperref/pdfkeywords}  =>  {keywords}
+>  {hyperref/pdfsubject}  =>  {subject}
+>  {hyperref/pdftitle}  =>  {title ^^c3^^a4^^c3^^bc^^c3^^9f \blub yyy}.
+<recently read> }
+l. ...\prop_show:N\g__hyp_documentproperties_prop
+> \test=macro:
+->(author1,xxx, gr^^c3^^bc^^c3^^9fe).
+l. ...\show\test
+> \test=macro:
+->title ^^c3^^a4^^c3^^bc^^c3^^9f \blub yyy.
+l. ...\show\test
+> \test=macro:
+->keywords.
+l. ...\show\test
+> \test=macro:
+->subject.
+l. ...\show\test
+(documentproperties.aux)
+Package rerunfilecheck Info: File `documentproperties.out' has not changed.
+(rerunfilecheck)             Checksum: D41D8CD98F00B204E9800998ECF8427E;0.





More information about the latex3-commits mailing list.