summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-11-27 22:49:11 +0000
committerKarl Berry <karl@freefriends.org>2018-11-27 22:49:11 +0000
commitba6c8067b06aab22748d17dd915ace7b659fe334 (patch)
tree391e26d06e66170382a7dc7c37f43031259c7388 /Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx
parent862805248e71a28775dd7d469e5149397f710a68 (diff)
hyperxmp (27nov18)
git-svn-id: svn://tug.org/texlive/trunk@49261 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx')
-rw-r--r--Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx86
1 files changed, 71 insertions, 15 deletions
diff --git a/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx b/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx
index 541b37943b3..7edb195c983 100644
--- a/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx
+++ b/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2017 by Scott Pakin <scott+hyxmp@pakin.org>
+% Copyright (C) 2018 by Scott Pakin <scott+hyxmp@pakin.org>
% -------------------------------------------------------
%
% This file may be distributed and/or modified under the
@@ -22,7 +22,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{hyperxmp}
%<*package>
- [2017/11/26 v3.4 Store hyperref metadata in XMP format]
+ [2018/11/27 v3.5 Store hyperref metadata in XMP format]
%</package>
%
%<*driver>
@@ -55,7 +55,7 @@
pdftitle={The hyperxmp package},
pdfsubject={LaTeX2e support for XMP metadata},
pdfkeywords={LaTeX, embedded metadata, XMP, PDF, copyright, license, comments},
- pdfcopyright={Copyright (C) 2017, Scott Pakin},
+ pdfcopyright={Copyright (C) 2018, Scott Pakin},
pdflicenseurl={http://www.latex-project.org/lppl/},
pdfcaptionwriter={Scott Pakin},
pdfcontactemail={scott+hyxmp@pakin.org},
@@ -82,7 +82,7 @@
%</driver>
% \fi
%
-% \CheckSum{1825}
+% \CheckSum{1845}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -403,6 +403,8 @@
% \item \optname{pdfcontacturl}
% \item \optname{pdfcopyright}
% \item \optname{pdfdate}
+% \item \optname{pdfdocumentid}
+% \item \optname{pdfinstanceid}
% \item \optname{pdflicenseurl}
% \item \optname{pdfmetadate}
% \item \optname{pdfmetalang}
@@ -474,6 +476,22 @@
% \optname{pdflicenseurl} identifies a \acro{URL} that points to the
% document's license agreement.
%
+% \acro{XMP} can include a universally unique identifier (\acro{UUID})
+% for each document and for each instance of a given document. By
+% default, \pkgname{hyperxmp} assigns a version~4 (i.e.,~pseudorandom)
+% \acro{UUID}~\cite{Leach2005:uuid} for each of these. However, a
+% document can alternatively specify a particular document identifier
+% using \optname{pdfdocumentid} and (not normally recommended) a
+% particular instance identifier using \optname{pdfinstanceid}. These
+% should be of the form
+% \texttt{uuid:}\textit{xxxxxxxx}\texttt{-}\textit{xxxx}\texttt{-}\textit{xxxx}\texttt{-}\textit{xxxx}\texttt{-}\textit{xxxxxxxxxxxx},
+% where ``\textit{x}'' is a lowercase hexadecimal number. For example,
+% \texttt{uuid:53ab7f19-a48c-5177-8bb2-403ad907f632} is a valid argument
+% to \optname{pdfdocumentid} (or \optname{pdfinstanceid}). See Leach,
+% Mealling, and Salz's \acro{UUID} specification document for details on
+% how to produce the various forms of
+% \acro{UUID}s~\cite{Leach2005:uuid}.
+%
% \optname{pdfmetalang} indicates the natural language in which certain
% metadata---specifically, the document's title, subject, and copyright
% statement---are written. The language should be specified using an
@@ -553,6 +571,7 @@
% http://einstein.biz/,
% https://www.facebook.com/AlbertEinstein
% },
+% pdfdocumentid={uuid:6d1ac9ec-4ff2-515a-954b-648eeb4853b0},
% pdflang={en},
% pdfmetalang={en},
% baseurl={http://mirror.ctan.org/macros/latex/contrib/hyperxmp/}
@@ -1171,6 +1190,27 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\hyxmp@DocumentID}
+% Prepare to store a \acro{UUID} that represents the document.
+% \changes{v3.5}{2018/11/27}{Added the \protect\optname{pdfdocumentid}
+% option, at Michael Osipov's request}
+% \begin{macrocode}
+\def\hyxmp@DocumentID{}
+\define@key{Hyp}{pdfdocumentid}{\hyxmp@pdfstringdef\hyxmp@DocumentID{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\hyxmp@InstanceID}
+% Prepare to store a \acro{UUID} that represents the current instance of
+% the document.
+% \changes{v3.5}{2018/11/27}{Added the \protect\optname{pdfinstanceid}
+% option, at Michael Osipov's request}
+% \begin{macrocode}
+\def\hyxmp@InstanceID{}
+\define@key{Hyp}{pdfinstanceid}{\hyxmp@pdfstringdef\hyxmp@InstanceID{#1}}
+% \end{macrocode}
+% \end{macro}
+%
% The following eight macros---|\@pdfcontactaddress|,
% |\@pdfcontactcity|, |\@pdfcontactregion|, |\@pdfcontactpostcode|,
% |\@pdfcontactcountry|, |\@pdfcontactphone|, |\@pdfcontactemail|, and
@@ -2015,7 +2055,7 @@ disabled}%
% \end{macro}
%
% \begin{macro}{\hyxmp@today@define}
-% Use \TeX\ primitives to define a given macro as today's date in
+% Use \tex\ primitives to define a given macro as today's date in
% \textsc{yyyy}-\textsc{mm}-\textsc{dd}|T|hh|:|mm format.
% \changes{v2.4}{2013/12/21}{Added this macro}
% \changes{v3.0}{2016/07/03}{Modified to accept the name of a macro
@@ -2024,7 +2064,7 @@ disabled}%
% \begin{macrocode}
\def\hyxmp@today@define#1{%
% \end{macrocode}
-% The date is a straightforward representation of \TeX's |\year|,
+% The date is a straightforward representation of \tex's |\year|,
% |\month|, and |\day| primitives, with the latter two zero-padded to
% two digits apiece.
% \begin{macrocode}
@@ -2040,9 +2080,9 @@ disabled}%
\xdef#1{#1-\the\day}%
\fi
% \end{macrocode}
-% \TeX\ does not provide the time in terms of separate hours and minutes
+% \tex\ does not provide the time in terms of separate hours and minutes
% but rather as the total number of minutes since midnight (|\time|).
-% There's no mechanism in \TeX\ to query the number of seconds since
+% There's no mechanism in \tex\ to query the number of seconds since
% midnight or the timezone so we omit those fields when defining
% macro~|#1|.
% \begin{macrocode}
@@ -2223,7 +2263,7 @@ disabled}%
%
% \begin{macro}{\hyxmp@xmlify}
% \changes{v2.0}{2012/08/02}{Completely rewritten by Heiko Oberdiek to
-% better support Unicode-enabled \tex\ programs}
+% better support Unicode-enabled \TeX\ programs}
% \begin{macro}{\hyxmp@xmlified}
% \begin{macro}{\hyxmp@text}
% Given a piece of text defined using |\pdfstringdef| (i.e.,~with many
@@ -2861,10 +2901,20 @@ disabled}%
% Seed the random-number generator with a function of the current
% filename, \acro{PDF} document title, \acro{PDF} author, and the
% current timestamp, then invoke |\hyxmp@create@uuid| to define
-% |\hyxmp@InstanceID| as a random \acro{UUID}.
+% |\hyxmp@InstanceID| as a random \acro{UUID}. For the current
+% timestamp, we use both the document-specified timestamp from
+% \optname{pdfdate} and the \tex\ time. The former can be more precise
+% (to sub-seconds) but may be less random (as it depends on manual
+% document modifications) while the latter is typically less precise (to
+% minutes) but may be more random (as it is updated automatically).
+% \changes{v3.5}{2018/11/27}{Seed with the \protect\TeX\ timestamp in
+% addition to the document-specified timestamp}
% \begin{macrocode}
\newcommand*{\hyxmp@def@InstanceID}{%
- \edef\hyxmp@seed@string{\jobname:\@pdftitle:\@pdfauthor:\hyxmp@today}%
+ \hyxmp@today@define{\hyxmp@seed@string}%
+ \edef\hyxmp@seed@string{%
+ \jobname:\@pdftitle:\@pdfauthor:\hyxmp@today:\hyxmp@seed@string
+ }%
\expandafter\hyxmp@seed@rng\expandafter{\hyxmp@seed@string}%
\edef\hyxmp@rand@num{\the\@tempcnta}%
\hyxmp@create@uuid\hyxmp@InstanceID
@@ -3335,15 +3385,21 @@ ______</rdf:Description>^^J%
% from within a \tex-based workflow.
% \changes{v1.4}{2011/05/29}{Renamed the \texttt{xapMM} namespace
% prefix to \texttt{xmpMM}}
+% \changes{v3.5}{2018/11/27}{Generate \protect\cs{hyxmp@DocumentID} and
+% \protect\cs{hyxmp@InstanceID} only if the document does not already
+% define these using the \protect\optname{pdfdocumentid} and
+% \protect\optname{pdfinstanceid} options}
% \begin{macrocode}
\gdef\hyxmp@mm@schema{%
- \hyxmp@def@DocumentID
- \hyxmp@def@InstanceID
+ \@ifmtargexp{\hyxmp@DocumentID}{\hyxmp@def@DocumentID}{}%
+ \@ifmtargexp{\hyxmp@InstanceID}{\hyxmp@def@InstanceID}{}%
\hyxmp@add@to@xml{%
______<rdf:Description rdf:about=""^^J%
____________xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/">^^J%
-_________<xmpMM:DocumentID>\hyxmp@DocumentID</xmpMM:DocumentID>^^J%
-_________<xmpMM:InstanceID>\hyxmp@InstanceID</xmpMM:InstanceID>^^J%
+ }%
+ \hyxmp@add@simple{xmpMM:DocumentID}{\hyxmp@DocumentID}%
+ \hyxmp@add@simple{xmpMM:InstanceID}{\hyxmp@InstanceID}%
+ \hyxmp@add@to@xml{%
______</rdf:Description>^^J%
}%
}