summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx')
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx108
1 files changed, 61 insertions, 47 deletions
diff --git a/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx b/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx
index a1616e6f17..c8f8812c45 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx
@@ -25,10 +25,9 @@
% for those people who are interested.
%
%<*driver>
-\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{pdfstandard=A-2b}
\documentclass{l3doc}
-\usepackage{tabularx,array,booktabs,hyperxmp}
+\usepackage{tabularx,array,booktabs}
\hypersetup{pdfauthor=The LaTeX Project,
pdftitle=generic hyperref driver (LaTeX PDF management testphase bundle)}
\premulticols=4cm
@@ -83,7 +82,7 @@
% }^^A
% }
%
-% \date{Version 0.95r, released 2022-08-24}
+% \date{Version 0.95s, released 2022-09-26}
%
% \maketitle
% \begin{documentation}
@@ -166,8 +165,9 @@
%
% \enquote{Metadata}, informations about the document, are stored in a PDF in two
% places: The |/Info| dictionary and the XMP-metadata. \pkg{hyperref} only handles the
-% |/Info| dictionary. The XMP-metadata can be added with like \pkg{pdfx} and
-% \pkg{hyperxmp}.
+% |/Info| dictionary. The XMP-metadata are added by code from \pkg{l3pdfmeta}.
+% (without the pdfmanagement the XMP-metadata can be added with packages like \pkg{pdfx} and
+% \pkg{hyperxmp}).
%
% The |/Info| dictionary can be filled with arbitrary keys, but the PDF viewer typically
% care only about a few, like |/Author|, |/Title| and |/Keywords|.
@@ -200,6 +200,18 @@
% \begin{verbatim}
% pdfauthor = {Bär, Peter Anteater, {Riley, the sloth}}
% \end{verbatim}
+%
+% \item It is possible to store titles in more than one language. If the value begins with
+% an \enquote{optional argument} which represents a language tag, the value is taken
+% as a comma list and splitted. The first value is used for the Info dictionary,
+% the others are used in the XMP-metadata. Commas in a title must then be
+% protected with braces:
+%
+% \begin{verbatim}
+% pdftitle = {[en]English Title,[de] Deutscher Titel,[fr]{titre français, avec comma}}
+% \end{verbatim}
+%
+%
% \item All values of relevant keys (including keys from the hyperxmp package)
% will be stored in a Metadata container, and can be retrieved with
% \cs{GetDocumentProperties}.
@@ -222,9 +234,6 @@
% \pkg{hyperref} has a few keys to set dates. They typically expect the date
% in \enquote{PDF} format: |D:YYYYMMDDhhmmss+01'00'|.
%
-% One should be aware that \pkg{hyperxmp} will sometimes
-% overwrites such settings.
-% ^^A XMP: yyyy-mm-ddThh:mm:ss+tt:tt, PDF: D:YYYYMMDDhhmmss+01'00'
%
% \section{PDF page size (mediabox)}
% The standard \pkg{hyperref} driver contain code to set the PDF page size.
@@ -877,9 +886,10 @@
% /D & \meta{array of numbers} & dash pattern (lines/gaps) (default [3])
% \end{tabular}
%
-% \DescribeHypkey{pdfcreationdate}\DescribeHypkey{pdfmoddate}
+% \DescribeHypkey{pdfcreationdate}\DescribeHypkey{pdfmoddate}\DescribeHypkey{pdfmetadate}
% Setting these keys is normally not needed. If they are used the values
-% are stored directly in the Info dictionary for |/Creationdate| and |/ModDate|.
+% of the first two keys are stored directly in the Info dictionary for
+% |/Creationdate| and |/ModDate|. All three keys are used in XMP-metadata.
% The values are converted to strings but not processed further, so they should
% have the correct PDF format without the enclosing parentheses,
% e.g. |D:20200202111111+01'00'|.
@@ -959,7 +969,7 @@
%<@@=hyp>
% \end{macrocode}
% \begin{macrocode}
-\ProvidesFile{hgeneric-testphase.def}[2022-08-24 v0.95r %
+\ProvidesFile{hgeneric-testphase.def}[2022-09-26 v0.95s %
generic Hyperref driver for the LaTeX PDF management testphase bundle]
\RequirePackage{etoolbox} %why?
@@ -2761,17 +2771,17 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_ocg_init:
{
- \pdf_object_new:nn { @@/OCG/View } { dict }
- \pdf_object_new:nn { @@/OCG/Print } { dict }
- \pdf_object_new:nn { @@/OCG/config } { dict }
- \pdf_object_new:nn { @@/OCG/refarray } { array }
- \pdf_object_write:nx { @@/OCG/refarray }
+ \pdf_object_new:n { @@/OCG/View }
+ \pdf_object_new:n { @@/OCG/Print }
+ \pdf_object_new:n { @@/OCG/config }
+ \pdf_object_new:n { @@/OCG/refarray }
+ \pdf_object_write:nnx { @@/OCG/refarray } { array }
{
\pdf_object_ref:n { @@/OCG/View }
\c_space_tl
\pdf_object_ref:n { @@/OCG/Print }
}
- \pdf_object_write:nn { @@/OCG/View }
+ \pdf_object_write:nnn { @@/OCG/View } { dict }
{
/Type/OCG
/Name(View)
@@ -2781,7 +2791,7 @@
/View <</ViewState/ON >>~
>>
}
- \pdf_object_write:nn { @@/OCG/Print }
+ \pdf_object_write:nnn { @@/OCG/Print } { dict }
{
/Type/OCG
/Name(Print)
@@ -2793,7 +2803,7 @@
}
\pdfmanagement_add:nnx { Catalog / OCProperties }{OCGs }{ \pdf_object_ref:n {@@/OCG/View} }
\pdfmanagement_add:nnx { Catalog / OCProperties }{OCGs }{ \pdf_object_ref:n {@@/OCG/Print} }
- \pdf_object_write:nx { @@/OCG/config }
+ \pdf_object_write:nnx { @@/OCG/config } { dict }
{
/OFF[\pdf_object_ref:n { @@/OCG/Print }]
/AS[
@@ -3171,6 +3181,7 @@
{
\pdfmanagement_add:nnx {Catalog} { URI }{ <</Base \l_@@_tmpa_tl>> }
}
+ \@@_store_metadata:nn {baseurl}{#1}
}
%only false does something ...
,bookmarks .choice:
@@ -3808,14 +3819,11 @@
{
,pdflang .code:n =
{
- \tl_if_empty:nTF { #1 }
- {
- \pdfmanagement_remove:nn {Catalog} { Lang }
- }
+ \tl_if_empty:nF { #1 }
{
\pdfmanagement_add:nnx {Catalog} { Lang } { (#1) }
+ \AddToDocumentProperties[document]{lang}{#1}
}
- \@@_store_metadata:nn {pdflang}{#1}
}
}
% \end{macrocode}
@@ -3823,10 +3831,14 @@
%
% \subsubsection{\enquote{info keys}}
% \begin{hypkey}{pdfauthor,pdftitle,pdfcreator,pdfsubject,pdfproducer,pdfkeywords}
-% The keys store their value also in the metadate container, so that hyperxmp can
+% The keys store their value also in the metadata container, so that hyperxmp can
% use them. Creator and Producer can't be removed with the pdfmanagement,
% but we allow to set an empty value.
+% If the value begin with an optional argument, we assume a multilanguage clist and
+% use only the first value.
% \begin{macrocode}
+\regex_new:N\l_@@_optlang_regex
+\regex_set:Nn\l_@@_optlang_regex {\A\[([A-Za-z\-]+)\](.*)}
\cs_new_protected:Npn \@@_setup_info_key:nn #1 #2
{
\keys_define:nn { hyp / setup }
@@ -3853,7 +3865,17 @@
}
}
{
- \@@_text_pdfstring_info:nN {##1}\l_@@_tmpa_str
+ \tl_set:Nx\l_@@_tmpa_tl {\clist_item:nn{##1}{1}}
+ \exp_args:NNV
+ \regex_extract_once:NnN \l_@@_optlang_regex \l_@@_tmpa_tl\l_@@_tmpa_seq
+ \seq_if_empty:NTF\l_@@_tmpa_seq
+ {
+ \@@_text_pdfstring_info:nN {##1}\l_@@_tmpa_str
+ }
+ {
+ \exp_args:Nx
+ \@@_text_pdfstring_info:nN {\seq_item:Nn \l_@@_tmpa_seq{3}}\l_@@_tmpa_str
+ }
\str_if_eq:VnF\l_@@_tmpa_str{<FEFF>}
{
\pdfmanagement_add:nnx {Info}{#2}{\l_@@_tmpa_str}
@@ -3900,7 +3922,7 @@
\@@_setup_info_key:nn {keywords} {Keywords}
% \end{macrocode}
% \end{hypkey}
-% \begin{hypkey}{pdfcreationdate,pdfmoddate}
+% \begin{hypkey}{pdfcreationdate,pdfmoddate,pdfmetadate}
% These keys are not really needed. We store them too in the container.
% CreationDate and ModDate should not use the hex encoding.
% \begin{macrocode}
@@ -3918,6 +3940,7 @@
\pdfmanagement_add:nnx {Info}{#2}{(##1)}
}
\@@_store_metadata:nn {pdf#1}{##1}
+ \AddToDocumentProperties[document]{#1}{#2}
}
}
\keys_define:nn { hyp / info }
@@ -3938,6 +3961,10 @@
\@@_setup_info_date_key:nn {creationdate} {CreationDate}
\@@_setup_info_date_key:nn {moddate} {ModDate}
+\keys_define:nn { hyp / setup }
+ {
+ pdfmetadate .code:n = { \@@_store_metadata:nn {pdfmetadate}{#1} }
+ }
% \end{macrocode}
% \end{hypkey}
% \begin{hypkey}{pdftrapped}
@@ -3995,7 +4022,7 @@
%
% \subsection{hyperxmp keys}
% hyperxmp defines lots of keys for \cs{hypersetup}.
-% They now longer work with this driver. So we provide them,
+% They now longer work with this driver. So we provide most of them,
% but they are only stored as metadata:
% \begin{macrocode}
\clist_map_inline:nn
@@ -4006,10 +4033,6 @@
,pdfauthortitle
,pdfcaptionwriter
,pdfmetalang
- ,pdfapart
- ,pdfaconformance
- ,pdfuapart
- ,pdfxstandard
,pdfsource
,pdfdocumentid
,pdfinstanceid
@@ -4049,15 +4072,6 @@
}
}
-\str_if_eq:eeT {A}{\pdfmeta_standard_item:n{type}}
- {
- \exp_args:Nnx
- \keys_set:nn {hyp / setup}
- {
- ,pdfapart = \pdfmeta_standard_item:n {level}
- ,pdfaconformance = \pdfmeta_standard_item:n {conformance}
- }
- }
% \end{macrocode}
%
% \subsection{Transitions}
@@ -4732,10 +4746,10 @@
\ExplSyntaxOn
\def\Hy@FormObjects
{
- \pdf_object_new:nn {@@/Encoding/pdfdoc } { dict }
- \pdf_object_new:nn {@@/Font/ZaDb } { dict }
- \pdf_object_new:nn {@@/Font/Helv } { dict }
- \pdf_object_write:nx {@@/Encoding/pdfdoc }
+ \pdf_object_new:n {@@/Encoding/pdfdoc }
+ \pdf_object_new:n {@@/Font/ZaDb }
+ \pdf_object_new:n {@@/Font/Helv }
+ \pdf_object_write:nnx {@@/Encoding/pdfdoc } { dict }
{
/Type/Encoding
/Differences[
@@ -4777,14 +4791,14 @@
/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis
]
}
- \pdf_object_write:nn {@@/Font/ZaDb }
+ \pdf_object_write:nnn {@@/Font/ZaDb } { dict }
{
/Type/Font
/Subtype/Type1
/Name/ZaDb
/BaseFont/ZapfDingbats
}
- \pdf_object_write:nx {@@/Font/Helv }
+ \pdf_object_write:nnx {@@/Font/Helv } { dict }
{
/Type/Font
/Subtype/Type1