diff options
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx | 97 |
1 files changed, 78 insertions, 19 deletions
diff --git a/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx b/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx index 43a3102b9c6..0a67e81be5c 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> - [2014/01/02 v2.4 Store hyperref metadata in XMP format] + [2014/06/19 v2.5 Store hyperref metadata in XMP format] %</package> % %<*driver> @@ -81,7 +81,7 @@ %</driver> % \fi % -% \CheckSum{1432} +% \CheckSum{1461} % % \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 @@ -112,6 +112,8 @@ % \changes{v2.2}{2010/12/06}{Added support for the \protect\acro{IPTC} Photo Metadata schema} % \changes{v2.4}{2013/12/21}{Added support for the \protect\acro{PDF/A} % Identification schema, as requested by Florian Breitwieser} +% \changes{v2.5}{2014/06/19}{Enabled ``\texttt{\string\string\string\_}'' +% to work within email addresses, as requested by Leonid Sinev} % % \GetFileInfo{hyperxmp.dtx} % @@ -610,6 +612,12 @@ % |scott/|'') in options such as \optname{baseurl}, % \optname{pdfcontacturl} and \optname{pdflicenseurl}. % +% \paragraph{Note~5: Unicode support} +% \term{Unicode} support is provided via the \pkgname{hyperref} package. +% If you specify \optname{unicode}|=true| either as a \pkgname{hyperref} +% option or as an argument to the |\hypersetup| command, the document +% can include \term{Unicode} characters in its \acro{XMP} fields. +% % % \StopEventually{^^A % \section{Future Work} @@ -791,11 +799,33 @@ \RequirePackage{ifxetex} % \end{macrocode} % +% \begin{macro}{\hyxmp@pdfstringdef} +% \begin{macro}{\hyxmp@textunderscore} +% Because \pkgname{hyperxmp} uses underscores to represent hard spaces, +% we need ``|\_|'' to map initially to something other than an +% underscore, in particular the \acro{ASCII} \acro{NAK}~(|^^U|) +% character. To accomplish this, we wrap \pkgname{hyperref}'s +% |\pdfstringdef| macro with our own version that temporarily does the +% proper substitution. Later in the execution, after underscores have +% been replaced with spaces, we replace \acro{NAK} characters with +% underscores. +% \changes{v2.5}{2014/06/19}{Added this macro} +% \begin{macrocode} +\newcommand{\hyxmp@pdfstringdef}[2]{% + \let\hyxmp@textunderscore=\textunderscore + \let\textunderscore=\hyxmp@uscore + \pdfstringdef{#1}{#2}% + \let\textunderscore=\hyxmp@textunderscore +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\@pdfcopyright} % Prepare to store the document's copyright statement. % \begin{macrocode} \def\@pdfcopyright{} -\define@key{Hyp}{pdfcopyright}{\pdfstringdef\@pdfcopyright{#1}} +\define@key{Hyp}{pdfcopyright}{\hyxmp@pdfstringdef\@pdfcopyright{#1}} % \end{macrocode} % \end{macro} % @@ -804,7 +834,7 @@ % agreement. % \begin{macrocode} \def\@pdflicenseurl{} -\define@key{Hyp}{pdflicenseurl}{\pdfstringdef\@pdflicenseurl{#1}} +\define@key{Hyp}{pdflicenseurl}{\hyxmp@pdfstringdef\@pdflicenseurl{#1}} % \end{macrocode} % \end{macro} % @@ -812,7 +842,7 @@ % Prepare to store the author's position/title (e.g.,~Staff Writer). % \begin{macrocode} \def\@pdfauthortitle{} -\define@key{Hyp}{pdfauthortitle}{\pdfstringdef\@pdfauthortitle{#1}} +\define@key{Hyp}{pdfauthortitle}{\hyxmp@pdfstringdef\@pdfauthortitle{#1}} % \end{macrocode} % \end{macro} % @@ -821,7 +851,7 @@ % \pkgname{hyperxmp} metadata. % \begin{macrocode} \def\@pdfcaptionwriter{} -\define@key{Hyp}{pdfcaptionwriter}{\pdfstringdef\@pdfcaptionwriter{#1}} +\define@key{Hyp}{pdfcaptionwriter}{\hyxmp@pdfstringdef\@pdfcaptionwriter{#1}} % \end{macrocode} % \end{macro} % @@ -830,7 +860,7 @@ % typically as an \acro{ISO}~\mbox{639-1} two-letter abbreviation. % \begin{macrocode} \def\@pdfmetalang{} -\define@key{Hyp}{pdfmetalang}{\pdfstringdef\@pdfmetalang{#1}} +\define@key{Hyp}{pdfmetalang}{\hyxmp@pdfstringdef\@pdfmetalang{#1}} % \end{macrocode} % \end{macro} % @@ -860,7 +890,7 @@ \define@key{Hyp}{pdfcontactaddress}{% \let\xmpcomma=\hyxmp@comma \def\xmpquote##1{##1}% - \pdfstringdef\@pdfcontactaddress{#1}% + \hyxmp@pdfstringdef\@pdfcontactaddress{#1}% \def\xmpcomma{,}% \let\xmpquote=\relax } @@ -872,7 +902,7 @@ % institution. % \begin{macrocode} \def\@pdfcontactcity{} -\define@key{Hyp}{pdfcontactcity}{\pdfstringdef\@pdfcontactcity{#1}} +\define@key{Hyp}{pdfcontactcity}{\hyxmp@pdfstringdef\@pdfcontactcity{#1}} % \end{macrocode} % \end{macro} % @@ -881,7 +911,7 @@ % person\slash institution. % \begin{macrocode} \def\@pdfcontactregion{} -\define@key{Hyp}{pdfcontactregion}{\pdfstringdef\@pdfcontactregion{#1}} +\define@key{Hyp}{pdfcontactregion}{\hyxmp@pdfstringdef\@pdfcontactregion{#1}} % \end{macrocode} % \end{macro} % @@ -890,7 +920,7 @@ % person\slash institution. % \begin{macrocode} \def\@pdfcontactpostcode{} -\define@key{Hyp}{pdfcontactpostcode}{\pdfstringdef\@pdfcontactpostcode{#1}} +\define@key{Hyp}{pdfcontactpostcode}{\hyxmp@pdfstringdef\@pdfcontactpostcode{#1}} % \end{macrocode} % \end{macro} % @@ -899,7 +929,7 @@ % institution. % \begin{macrocode} \def\@pdfcontactcountry{} -\define@key{Hyp}{pdfcontactcountry}{\pdfstringdef\@pdfcontactcountry{#1}} +\define@key{Hyp}{pdfcontactcountry}{\hyxmp@pdfstringdef\@pdfcontactcountry{#1}} % \end{macrocode} % \end{macro} % @@ -908,7 +938,7 @@ % person\slash institution. % \begin{macrocode} \def\@pdfcontactphone{} -\define@key{Hyp}{pdfcontactphone}{\pdfstringdef\@pdfcontactphone{#1}} +\define@key{Hyp}{pdfcontactphone}{\hyxmp@pdfstringdef\@pdfcontactphone{#1}} % \end{macrocode} % \end{macro} % @@ -917,7 +947,7 @@ % person\slash institution. % \begin{macrocode} \def\@pdfcontactemail{} -\define@key{Hyp}{pdfcontactemail}{\pdfstringdef\@pdfcontactemail{#1}} +\define@key{Hyp}{pdfcontactemail}{\hyxmp@pdfstringdef\@pdfcontactemail{#1}} % \end{macrocode} % \end{macro} % @@ -926,7 +956,7 @@ % institution. % \begin{macrocode} \def\@pdfcontacturl{} -\define@key{Hyp}{pdfcontacturl}{\pdfstringdef\@pdfcontacturl{#1}} +\define@key{Hyp}{pdfcontacturl}{\hyxmp@pdfstringdef\@pdfcontacturl{#1}} % \end{macrocode} % \end{macro} % @@ -1280,8 +1310,23 @@ disabled}% % \changes{v2.0}{2012/08/25}{Added this macro} % \begin{macrocode} \bgroup -\catcode`\^^C=11 -\gdef\hyxmp@comma{^^C} + \catcode`\^^C=11 + \gdef\hyxmp@comma{^^C} +\egroup +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hyxmp@uscore} +% This is what |\_| temporarily maps to during packet construction. +% Because underscores are replaced by spaces, we need a mechanism to +% preserve user-specified underscores (e.g.,~in email addresses). We +% assume that documents will never otherwise use an \acro{NAK} (|^^U|) +% character in their \acro{XMP} metadata. +% \changes{v2.5}{2014/06/19}{Added this macro} +% \begin{macrocode} +\bgroup + \catcode`\^^U=11 + \gdef\hyxmp@uscore{^^U} \egroup % \end{macrocode} % \end{macro} @@ -1461,6 +1506,16 @@ disabled}% % \end{macrocode} % \end{macro} % +% \begin{macro}{\SE->pdfdoc@15} +% Preserve \acro{NAK} (|^^U|), which is normally an invalid character in +% \term{PDFDocEncoding}. We use it in \pkgname{hyperxmp} (and +% specifically in |\hyxmp@xmlify| below) as a placeholder for an +% underscore character. +% \begin{macrocode} +\expandafter\def\csname SE->pdfdoc@15\endcsname{0015} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\hyxmp@xmlify} % \changes{v2.0}{2012/08/02}{Completely rewritten by Heiko Oberdiek to % better support Unicode-enabled \tex\ programs} @@ -2055,6 +2110,8 @@ disabled}% % (``other'') spaces and all |^C| characters with commas, then append % the result to the |\hyxmp@xml| macro. % \changes{v2.0}{2012/08/24}{Updated also to replace commas} +% \changes{v2.5}{2014/06/19}{Updated also to replace underscores and to +% modify only the text being added, not the already-modified text} % \begin{macrocode} \newcommand*{\hyxmp@add@to@xml}[1]{% \bgroup @@ -2066,7 +2123,9 @@ disabled}% \repeat \lccode`\_=`\ \relax \lccode`\^^C=`\,\relax - \lowercase{\xdef\hyxmp@xml{\hyxmp@xml#1}}% + \lccode`\^^U=`\_\relax + \lowercase{\xdef\hyxmp@new@xml{#1}}% + \xdef\hyxmp@xml{\hyxmp@xml\hyxmp@new@xml}% \egroup } % \end{macrocode} @@ -2709,7 +2768,7 @@ _______<Iptc4xmpCore:CreatorContactInfo rdf:parseType="Resource">^^J% % \end{macrocode} % \begin{macro}{\xmplinesep} % The \acro{IPTC} standard states that sets of telephone numbers, email -% address, and \acro{URL}s for the contact person or institution, +% addresses, and \acro{URL}s for the contact person or institution, % ``[m]ay have to be separated by a comma in the user % interface''~\cite{IPTC2010:photo-meta}. This is rather ambiguous: % Does the comma appear \emph{only} in the user interface or also in the |