diff options
author | Karl Berry <karl@freefriends.org> | 2017-02-23 22:00:11 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-02-23 22:00:11 +0000 |
commit | 69138b92d7784154c2db4471d176e3027815336a (patch) | |
tree | 9ad23847a22149f26ab7f4c21d9024a75274decb /Master/texmf-dist/tex/latex/hyperxmp | |
parent | f752049ef00ed1330aa292e8d2c031c147aeae53 (diff) |
hyperxmp (22feb17)
git-svn-id: svn://tug.org/texlive/trunk@43316 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/hyperxmp')
-rw-r--r-- | Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty | 266 |
1 files changed, 194 insertions, 72 deletions
diff --git a/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty b/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty index 6db69921c0c..d5ed768c567 100644 --- a/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty +++ b/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% Copyright (C) 2016 by Scott Pakin <scott+hyxmp@pakin.org> +%% Copyright (C) 2017 by Scott Pakin <scott+hyxmp@pakin.org> %% %% This file may be distributed and/or modified under the conditions of %% the LaTeX Project Public License, either version 1.3c of this license @@ -22,8 +22,7 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{hyperxmp} - [2016/07/04 v3.0 Store hyperref metadata in XMP format] - + [2017/02/23 v3.2 Store hyperref metadata in XMP format] \edef\hyxmp@dq@code{\the\catcode`\"} \catcode`\"=12 \def\hyxmp@driver{hpdftex} @@ -45,7 +44,27 @@ \let\textunderscore=\hyxmp@textunderscore } \def\@pdfdatetime{} -\define@key{Hyp}{pdfdate}{\hyxmp@pdfstringdef\@pdfdatetime{#1}} +\define@key{Hyp}{pdfdate}{% + \begingroup + \Hy@unicodefalse + \edef\next{% + \noexpand\hyxmp@pdfstringdef\noexpand\@pdfdatetime{% + \noexpand\hyxmp@as@xmp@date{#1}}% + }% + \next + \endgroup +} +\def\@pdfmetadatetime{} +\define@key{Hyp}{pdfmetadate}{% + \begingroup + \Hy@unicodefalse + \edef\next{% + \noexpand\hyxmp@pdfstringdef\noexpand\@pdfmetadatetime{% + \noexpand\hyxmp@as@xmp@date{#1}}% + }% + \next + \endgroup +} \def\@pdfcopyright{} \define@key{Hyp}{pdfcopyright}{\hyxmp@pdfstringdef\@pdfcopyright{#1}} \def\@pdftype{Text} @@ -151,13 +170,16 @@ \@pdfcontactregion \@pdfcontacturl \@pdfcopyright - \@pdftype + \@pdfcreationdate \@pdfdatetime \@pdfkeywords \@pdflang \@pdflicenseurl + \@pdfmetadatetime + \@pdfmoddate \@pdfsubject \@pdftitle + \@pdftype }% \ifx\hyxmp@concated@metadata\@empty \PackageWarningNoLine{hyperxmp}{% @@ -245,6 +267,138 @@ disabled}% } \hyxmp@temp@list }} +\def\hyxmp@first@char#1{\hyxmp@first@char@i#1\relax} +\def\hyxmp@first@char@i#1#2\relax{#1} +\def\hyxmp@as@xmp@date#1{% + \expandafter\ifx\hyxmp@first@char@i#1\relax D% + \hyxmp@pdf@to@xmp@date{#1}% + \else + #1% + \fi +} +\def\hyxmp@pdf@to@xmp@date#1:#2#3#4#5#6#7#8#9{% + #2#3#4#5-#6#7-#8#9% + \hyxmp@parse@time +} +\def\hyxmp@parse@time#1#2#3#4#5#6{% + T#1#2:#3#4:#5#6% + \hyxmp@parse@tz@char +} +\def\hyxmp@parse@tz@char#1{% + #1% + \ifx#1-% + \expandafter\hyxmp@parse@tz + \else + \ifx#1+% + \expandafter\hyxmp@parse@tz + \fi + \fi +} +\def\hyxmp@parse@tz#1'#2'{% + #1:#2% +} +\def\hyxmp@as@pdf@date#1{% + \expandafter\ifx\hyxmp@first@char@i#1\relax D% + #1% + \else + \hyxmp@xmp@to@pdf@date{#1}% + \fi +} +\def\hyxmp@xmp@to@pdf@date#1{% + D:\hyxmp@xmp@to@pdf@date@i#1\relax\relax +} +\def\hyxmp@xmp@to@pdf@date@i#1#2#3#4#5#6{% + #1#2#3#4% + \ifx#5-% + \expandafter\hyxmp@xmp@to@pdf@date@ii\expandafter#6% + \fi +} +\def\hyxmp@xmp@to@pdf@date@ii#1#2#3#4{% + #1#2% + \ifx#3-% + \expandafter\hyxmp@xmp@to@pdf@date@iii\expandafter#4% + \fi +} +\def\hyxmp@xmp@to@pdf@date@iii#1#2#3#4{% + #1#2% + \ifx#3T% + \expandafter\hyxmp@xmp@to@pdf@date@iv\expandafter#4% + \fi +} +\def\hyxmp@xmp@to@pdf@date@iv#1#2#3#4{% + #1#2% + \ifx#3:% + \expandafter\hyxmp@xmp@to@pdf@date@v\expandafter#4% + \fi +} +\def\hyxmp@xmp@to@pdf@date@v#1#2#3#4{% + #1#2% + \ifx#3:% + \expandafter\hyxmp@xmp@to@pdf@date@vi\expandafter#4% + \fi +} +\let\@hyxmp@gobbletwo=\@gobbletwo +\def\hyxmp@xmp@to@pdf@date@vi#1#2#3#4{% + #1#2% + \ifx#3+% + +\expandafter\hyxmp@xmp@to@pdf@date@vii + \fi + \ifx#3-% + -\expandafter\hyxmp@xmp@to@pdf@date@vii + \fi + \ifx#3Z% + Z% + \fi + \ifx#3\relax + \expandafter\@hyxmp@gobbletwo + \fi + \@gobbletwo #4% +} +\def\hyxmp@xmp@to@pdf@date@vii#1\@gobbletwo#2#3#4#5{% + #2#3% + \ifx#4:% + \expandafter\hyxmp@xmp@to@pdf@date@viii\expandafter#5% + \fi +} +\def\hyxmp@xmp@to@pdf@date@viii#1#2#3#4{% + '#1#2'% +} +\def\hyxmp@today@define#1{% + \xdef#1{\the\year}% + \ifnum\month<10 + \xdef#1{#1-0\the\month}% + \else + \xdef#1{#1-\the\month}% + \fi + \ifnum\day<10 + \xdef#1{#1-0\the\day}% + \else + \xdef#1{#1-\the\day}% + \fi + \@tempcnta=\time + \divide\@tempcnta by 60% + \ifnum\@tempcnta<10% + \xdef#1{#1T0\the\@tempcnta}% + \else + \xdef#1{#1T\the\@tempcnta}% + \fi + \multiply\@tempcnta by -60% + \advance\@tempcnta by \time + \ifnum\@tempcnta<10% + \xdef#1{#1:0\the\@tempcnta}% + \else + \xdef#1{#1:\the\@tempcnta}% + \fi +} +\@ifundefined{pdffeedback}{% + \@ifundefined{pdfcreationdate}{% + \hyxmp@today@define\hyxmp@today + }{% + \edef\hyxmp@today{\expandafter\hyxmp@pdf@to@xmp@date\pdfcreationdate}% + }% +}{% + \edef\hyxmp@today{\expandafter\hyxmp@pdf@to@xmp@date\pdffeedback creationdate}% +} \catcode`\Q=3 \newcommand{\hyxmp@trimspaces}[1]{% \begingroup @@ -585,49 +739,6 @@ _______________________________________________________________^^J% \xdef\hyxmp@padding{\hyxmp@padding\hyxmp@padding} \xdef\hyxmp@padding{\hyxmp@padding\hyxmp@padding} \xdef\hyxmp@padding{\hyxmp@padding\hyxmp@padding} -\def\hyxmp@pdf@to@xmp@date#1:#2#3#4#5#6#7#8#9{% - #2#3#4#5-#6#7-#8#9% - \hyxmp@parse@time -} -\def\hyxmp@parse@time#1#2#3#4#5#6{% - T#1#2:#3#4:#5#6% - \hyxmp@parse@tz@char -} -\def\hyxmp@parse@tz@char#1{% - #1% - \ifx#1-% - \expandafter\hyxmp@parse@tz - \else - \ifx#1+% - \expandafter\hyxmp@parse@tz - \fi - \fi -} -\def\hyxmp@parse@tz#1'#2'{% - #1:#2% -} -\def\hyxmp@today@define#1{% - \xdef#1{\the\year}% - \ifnum\month<10 - \xdef#1{#1-0\the\month}% - \else - \xdef#1{#1-\the\month}% - \fi - \ifnum\day<10 - \xdef#1{#1-0\the\day}% - \else - \xdef#1{#1-\the\day}% - \fi -} -\@ifundefined{pdffeedback}{% - \@ifundefined{pdfcreationdate}{% - \hyxmp@today@define\hyxmp@today - }{% - \edef\hyxmp@today{\expandafter\hyxmp@pdf@to@xmp@date\pdfcreationdate}% - }% -}{% - \edef\hyxmp@today{\expandafter\hyxmp@pdf@to@xmp@date\pdffeedback creationdate}% -} \newcommand*{\hyxmp@x@default}{x-default} \newcommand*{\hyxmp@pdf@schema}{% \hyxmp@add@to@xml{% @@ -800,9 +911,31 @@ ______<rdf:Description rdf:about=""^^J% ____________xmlns:xmp="http://ns.adobe.com/xap/1.0/">^^J% }% \hyxmp@define@createdate - \hyxmp@add@simple{xmp:CreateDate}{\hyxmp@createdate}% - \hyxmp@add@simple{xmp:ModifyDate}{\hyxmp@createdate}% - \hyxmp@add@simple{xmp:MetadataDate}{\hyxmp@createdate}% + \@ifundefined{@pdfcreationdate}{% + \hyxmp@add@simple{xmp:CreateDate}{\hyxmp@createdate}% + }{% + \ifx\@pdfcreationdate\@empty + \hyxmp@add@simple{xmp:CreateDate}{\hyxmp@createdate}% + \else + \hyxmp@add@simple{xmp:CreateDate}{% + \expandafter\hyxmp@as@xmp@date\expandafter{\@pdfcreationdate}}% + \fi + }% + \@ifundefined{@pdfmoddate}{% + \hyxmp@add@simple{xmp:ModifyDate}{\hyxmp@createdate}% + }{% + \ifx\@pdfmoddate\@empty + \hyxmp@add@simple{xmp:ModifyDate}{\hyxmp@createdate}% + \else + \hyxmp@add@simple{xmp:ModifyDate}{% + \expandafter\hyxmp@as@xmp@date\expandafter{\@pdfmoddate}}% + \fi + }% + \ifx\@pdfmetadatetime\@empty + \hyxmp@add@simple{xmp:MetadataDate}{\hyxmp@createdate}% + \else + \hyxmp@add@simple{xmp:MetadataDate}{\@pdfmetadatetime}% + \fi \hyxmp@add@simple{xmp:CreatorTool}{\@pdfcreator}% \hyxmp@add@simple{xmp:BaseURL}{\@baseurl}% \hyxmp@add@to@xml{% @@ -1036,36 +1169,25 @@ ___</rdf:RDF>^^J% \fi \fi } +\RequirePackage{ifluatex} \newcommand*{\hyxmp@embed@packet@pdftex}{% \bgroup - \pdfcompresslevel=0 - \immediate\pdfobj stream attr {% + \ifluatex + \else + \pdfcompresslevel=0 + \fi + \immediate\pdfobj \ifluatex uncompressed\fi stream attr {% /Type /Metadata /Subtype /XML }{\hyxmp@xml}% \pdfcatalog {/Metadata \the\pdflastobj\space 0 R}% \egroup } -\expandafter\ifx\csname pdffeedback\endcsname\relax -\else - \RequirePackage{luacode}% - \begin{luacode*} - function hyxmp_embed_packet (contents) - local n = pdf.obj { - type = "stream", - attr = [[ -/Type /Metadata -/Subtype /XML - ]], - compresslevel = 0, - string = contents - } - pdf.refobj(n) - end - \end{luacode*} -\fi \newcommand*{\hyxmp@embed@packet@luatex}{% - \luadirect{hyxmp_embed_packet(\luastring{\hyxmp@xml})}% + \immediate\pdfextension obj uncompressed stream attr {% + /Type /Metadata + /Subtype /XML + }{\hyxmp@xml}% \pdfextension catalog {/Metadata \the\numexpr\pdffeedback lastobj\relax\space 0 R}% } \newcommand*{\hyxmp@embed@packet@pdfmark}{% |