diff options
author | Karl Berry <karl@freefriends.org> | 2017-12-15 22:18:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-12-15 22:18:14 +0000 |
commit | 1701b00c0e998ca69849131bdc8da91164c8674b (patch) | |
tree | 8a68576ed748571964a9a7a8d6f1e73ba28b68b4 /Master/texmf-dist/source/latex | |
parent | ab4dc0af69e81551c7284576d3e85c436928d0d9 (diff) |
hyperxmp (15dec17)
git-svn-id: svn://tug.org/texlive/trunk@46073 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx | 70 |
1 files changed, 41 insertions, 29 deletions
diff --git a/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx b/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx index c1fd1b5d2e0..541b37943b3 100644 --- a/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx +++ b/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx @@ -22,7 +22,7 @@ %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{hyperxmp} %<*package> - [2017/07/25 v3.3 Store hyperref metadata in XMP format] + [2017/11/26 v3.4 Store hyperref metadata in XMP format] %</package> % %<*driver> @@ -82,7 +82,7 @@ %</driver> % \fi % -% \CheckSum{1833} +% \CheckSum{1825} % % \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 @@ -128,6 +128,8 @@ % Thanks to Robert Schlicht, Leonid Sinev, and David Carlisle for bug % reports and to Leonid Sinev for helping test the new % \protect\pkgname{hyperxmp} code} +% \changes{v3.4}{2017/11/04}{Use \protect\pkgname{ifmtarg} to test for +% empty arguments, including non-empty but all spaces} % % \GetFileInfo{hyperxmp.dtx} % @@ -995,17 +997,30 @@ % We load a bunch of helper packages: \pkgname{kvoptions} for % package-option processing, \pkgname{pdfescape} and \pkgname{stringenc} % for re-encoding \term{Unicode} strings, \pkgname{intcalc} for -% performing integer calculations (division and modulo), and -% \pkgname{ifxetex} for detecting \XeTeX. -% +% performing integer calculations (division and modulo), +% \pkgname{ifxetex} for detecting \XeTeX, and \pkgname{ifmtarg} for +% testing if a macro argument is empty or all spaces. % \begin{macrocode} \RequirePackage{kvoptions} \RequirePackage{pdfescape} \RequirePackage{stringenc} \RequirePackage{intcalc} \RequirePackage{ifxetex} +\RequirePackage{ifmtarg} % \end{macrocode} % +% \begin{macro}{\@ifmtargexp} +% \begin{macro}{\@ifnotmtargexp} +% |\@ifmtarg| and |\@ifnotmtarg| do not expand their first argument. +% Define |\@ifmtargexp| and |\@ifnotmtargexp| as expanding versions of +% those macros. +% \begin{macrocode} +\def\@ifmtargexp#1{\expandafter\@ifmtarg\expandafter{#1}} +\def\@ifnotmtargexp#1{\expandafter\@ifnotmtarg\expandafter{#1}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\hyxmp@pdfstringdef} % \begin{macro}{\hyxmp@textunderscore} % Because \pkgname{hyperxmp} uses underscores to represent hard spaces, @@ -1544,18 +1559,18 @@ provide metadata values to hyperxmp}% % if \protect\optname{pdftitle} and \protect\optname{pdfauthor} are left % unspecified. Thanks to Maciej Radziejewski for the suggestion} % \begin{macrocode} - \ifx\@pdftitle\@empty - \ifx\@title\@empty - \else + \@ifmtargexp{\@pdftitle}{% + \@ifnotmtargexp{\@title}{% \hypersetup{pdftitle={\@title}}% - \fi - \fi - \ifx\@pdfauthor\@empty - \ifx\@author\@empty - \else + }% + }% + {}% + \@ifmtargexp{\@pdfauthor}{% + \@ifnotmtargexp{\@author}{% \hypersetup{pdfauthor={\@author}}% - \fi - \fi + }% + }% + {}% % \end{macrocode} % We wait until the end of the document to construct the \acro{XMP} % packet and write it to the \acro{PDF} document catalog. This gives @@ -2822,12 +2837,15 @@ disabled}% % % \begin{macro}{\hyxmp@def@DocumentID} % \begin{macro}{\hyxmp@DocumentID} +% \begin{macro}{\hyxmp@seed@string} % Seed the random-number generator with a function of the current % filename, \acro{PDF} document title, and \acro{PDF} author, then invoke % |\hyxmp@create@uuid| to define |\hyxmp@DocumentID| as a random \acro{UUID}. +% \changes{v3.4}{2017/11/04}{Correctly handle an author field of all spaces. +% Bug reported by Ga\"etan Leurent} % \begin{macrocode} \newcommand*{\hyxmp@def@DocumentID}{% - \edef\hyxmp@seed@string{\jobname:\@pdftitle:\@pdfauthor}% + \edef\hyxmp@seed@string{\jobname:\@pdftitle:\@pdfauthor:}% \expandafter\hyxmp@seed@rng\expandafter{\hyxmp@seed@string}% \edef\hyxmp@rand@num{\the\@tempcnta}% \hyxmp@create@uuid\hyxmp@DocumentID @@ -2835,9 +2853,11 @@ disabled}% % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\hyxmp@def@InstanceID} % \begin{macro}{\hyxmp@InstanceID} +% \begin{macro}{\hyxmp@seed@string} % 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 @@ -2852,6 +2872,7 @@ disabled}% % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % % \subsection{Constructing the XMP packet} @@ -3079,11 +3100,7 @@ _________<#1>\hyxmp@xmlified</#1>^^J% % Set |\@tempswatrue| only if the given text is nonempty or the provided % conditional evaluates to \textsc{true}. % \begin{macrocode} - \@tempswafalse - \ifx#3\@empty - \else - \@tempswatrue - \fi + \@ifmtargexp{#3}{\@tempswafalse}{\@tempswatrue}% #1 \@tempswatrue \fi @@ -3149,11 +3166,7 @@ _________</dc:#2>^^J% % Set |\@tempswatrue| only if the given list is nonempty or the provided % conditional evaluates to \textsc{true}. % \begin{macrocode} - \@tempswafalse - \ifx#4\@empty - \else - \@tempswatrue - \fi + \@ifmtargexp{#4}{\@tempswafalse}{\@tempswatrue}% #1 \@tempswatrue \fi @@ -3508,8 +3521,7 @@ ______</rdf:Description>^^J% % \changes{v2.2}{2012/12/07}{Added this macro} % \begin{macrocode} \newcommand*{\hyxmp@list@to@lines}[2]{% - \ifx#2\@empty - \else + \@ifnotmtargexp{#2}{% \bgroup \hyxmp@add@to@xml{% _________<#1>% @@ -3541,7 +3553,7 @@ _________<#1>% \hyxmp@list \hyxmp@add@to@xml{</#1>^^J}% \egroup - \fi + }% } % \end{macrocode} % \end{macro} |