From 1701b00c0e998ca69849131bdc8da91164c8674b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 15 Dec 2017 22:18:14 +0000 Subject: hyperxmp (15dec17) git-svn-id: svn://tug.org/texlive/trunk@46073 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/hyperxmp/hyperxmp.pdf | Bin 597772 -> 599157 bytes .../texmf-dist/source/latex/hyperxmp/hyperxmp.dtx | 70 ++++++++++++--------- Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty | 44 ++++++------- 3 files changed, 60 insertions(+), 54 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/hyperxmp/hyperxmp.pdf b/Master/texmf-dist/doc/latex/hyperxmp/hyperxmp.pdf index 55e19e78513..cb06f71b72e 100644 Binary files a/Master/texmf-dist/doc/latex/hyperxmp/hyperxmp.pdf and b/Master/texmf-dist/doc/latex/hyperxmp/hyperxmp.pdf differ 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 @@ %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\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] % % %<*driver> @@ -82,7 +82,7 @@ % % \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^^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 @@ _________^^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 @@ ______^^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{^^J}% \egroup - \fi + }% } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty b/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty index 282bebe5177..1afc3a185e7 100644 --- a/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty +++ b/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty @@ -22,7 +22,7 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{hyperxmp} - [2017/07/25 v3.3 Store hyperref metadata in XMP format] + [2017/11/26 v3.4 Store hyperref metadata in XMP format] \edef\hyxmp@dq@code{\the\catcode`\"} \catcode`\"=12 \def\hyxmp@driver{hpdftex} @@ -37,6 +37,9 @@ \RequirePackage{stringenc} \RequirePackage{intcalc} \RequirePackage{ifxetex} +\RequirePackage{ifmtarg} +\def\@ifmtargexp#1{\expandafter\@ifmtarg\expandafter{#1}} +\def\@ifnotmtargexp#1{\expandafter\@ifnotmtarg\expandafter{#1}} \newcommand{\hyxmp@pdfstringdef}[2]{% \let\hyxmp@textunderscore=\textunderscore \let\textunderscore=\hyxmp@uscore @@ -208,18 +211,18 @@ provide metadata values to hyperxmp}% \else \edef\hyxmp@today{\@pdfdatetime}% \fi - \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 + }% + }% + {}% \hyxmp@at@end{% \hyxmp@find@metadata \hyxmp@embed@packet @@ -713,7 +716,7 @@ disabled}% \hyxmp@append@hex@iv#1% } \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 @@ -800,11 +803,7 @@ _________<#1>\hyxmp@xmlified^^J% \fi } \newcommand*{\hyxmp@rdf@dc}[3][\iffalse]{% - \@tempswafalse - \ifx#3\@empty - \else - \@tempswatrue - \fi + \@ifmtargexp{#3}{\@tempswafalse}{\@tempswatrue}% #1 \@tempswatrue \fi @@ -839,11 +838,7 @@ _________^^J% \fi }% \newcommand*{\hyxmp@list@to@xml}[4][\iffalse]{% - \@tempswafalse - \ifx#4\@empty - \else - \@tempswatrue - \fi + \@ifmtargexp{#4}{\@tempswafalse}{\@tempswatrue}% #1 \@tempswatrue \fi @@ -1001,8 +996,7 @@ ______^^J% \gdef\xmplinesep{ } \endgroup \newcommand*{\hyxmp@list@to@lines}[2]{% - \ifx#2\@empty - \else + \@ifnotmtargexp{#2}{% \bgroup \hyxmp@add@to@xml{% _________<#1>% @@ -1020,7 +1014,7 @@ _________<#1>% \hyxmp@list \hyxmp@add@to@xml{^^J}% \egroup - \fi + }% } \gdef\hyxmp@photometa@schema{% \edef\hyxmp@photometa@data{% -- cgit v1.2.3