summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-06-14 22:18:02 +0000
committerKarl Berry <karl@freefriends.org>2020-06-14 22:18:02 +0000
commit3cc75a75fe8966b95123fd66dbd8db584ad74151 (patch)
treeae09ac42f93c9cd4741f3de985bd0628fa96138e /Master/texmf-dist/tex
parent3e1ebf9c03aadcdc3750b4ca47b0e30758ead926 (diff)
hyperxmp (15jun20)
git-svn-id: svn://tug.org/texlive/trunk@55549 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty213
1 files changed, 186 insertions, 27 deletions
diff --git a/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty b/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty
index 9aaa6b6e101..2293be810c9 100644
--- a/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty
+++ b/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty
@@ -22,16 +22,15 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{hyperxmp}
- [2020/05/12 v5.2 Store hyperref metadata in XMP format]
+ [2020/06/13 v5.3 Store hyperref metadata in XMP format]
\edef\hyxmp@dq@code{\the\catcode`\"}
\catcode`\"=12
-\def\hyxmp@driver{hpdftex}
-\ifx\hyxmp@driver\Hy@driver
- \let\hyxmp@at@end=\AtEndDocument
-\else
+\@ifundefined{AtEndDocument}{%
\RequirePackage{atenddvi}
\let\hyxmp@at@end=\AtEndDvi
-\fi
+}{%
+ \let\hyxmp@at@end=\AtEndDocument
+}
\RequirePackage{kvoptions}
\RequirePackage{pdfescape}
\RequirePackage{stringenc}
@@ -42,6 +41,11 @@
\RequirePackage{ifthen}
\def\@ifmtargexp#1{\expandafter\@ifmtarg\expandafter{#1}}
\def\@ifnotmtargexp#1{\expandafter\@ifnotmtarg\expandafter{#1}}
+\newcommand*{\@if@def@and@nonempty}[3]{%
+ \@ifundefined{#1}{#3}{%
+ \expandafter\@ifmtargexp\expandafter{\csname#1\endcsname}{#3}{#2}%
+ }%
+}
\newcommand{\hyxmp@pdfstringdef}[2]{%
\let\hyxmp@textunderscore=\textunderscore
\let\textunderscore=\hyxmp@uscore
@@ -361,31 +365,184 @@
{}%
}%
}
-\AtBeginDocument{%
- \@ifpackageloaded{hyperref}{%
- \ifx\@pdflang\relax
- \let\@pdflang=\@empty
+\newcommand*{\hyxmp@set@koma@phones}{%
+ \@if@def@and@nonempty{scr@frommobilephone@var}{%
+ \@if@def@and@nonempty{scr@fromphone@var}{%
+ \edef\hyxmp@koma@phones{\scr@frommobilephone@var,\scr@fromphone@var}%
+ }{%
+ \edef\hyxmp@koma@phones{\scr@frommobilephone@var}%
+ }%
+ }{%
+ \@if@def@and@nonempty{scr@fromphone@var}{%
+ \edef\hyxmp@koma@phones{\scr@fromphone@var}%
+ }{%
+ }%
+ }%
+}
+\newcommand*{\hyxmp@use@first@valid}[3]{%
+ \@ifmtargexp{#2}{%
+ \hyxmp@use@first@valid@i{#1}#3,!,%
+ }%
+ {}%
+}
+\def\hyxmp@use@first@valid@i#1#2,{%
+ \def\next{\hyxmp@use@first@valid@i{#1}}%
+ \ifx#2!%
+ \let\next=\relax
+ \else
+ \ifx#2\undefined
+ \else
+ \@ifnotmtargexp{#2}{%
+ \hypersetup{#1={#2}}%
+ \def\next##1!,{}%
+ }%
\fi
- \ifx\@pdfmetalang\@empty
- \ifx\@pdflang\@empty
- \let\@pdfmetalang=\hyxmp@x@default
- \else
- \edef\@pdfmetalang{\@pdflang}%
- \fi
+ \fi
+ \next
+}
+\newcommand*{\hyxmp@auto@assign@data}{%
+ \ifx\@pdfmetalang\@empty
+ \ifx\@pdflang\@empty
+ \let\@pdfmetalang=\hyxmp@x@default
+ \else
+ \edef\@pdfmetalang{\@pdflang}%
\fi
- \hyxmp@xmlify\@pdfmetalang
- \@ifmtargexp{\@pdftitle}{%
- \@ifnotmtargexp{\@title}{%
- \hypersetup{pdftitle={\@title}}%
+ \fi
+ \hyxmp@xmlify\@pdfmetalang
+ \hyxmp@use@first@valid{pdftitle}{\@pdftitle}{%
+ \scr@subject@var,%
+ \@title
+ }%
+ \hyxmp@use@first@valid{pdfauthor}{\@pdfauthor}{%
+ \scr@fromname@var,%
+ \@author
+ }%
+ \hyxmp@use@first@valid{pdfcontactemail}{\@pdfcontactemail}{%
+ \scr@fromemail@var
+ }%
+ \hyxmp@set@koma@phones
+ \hyxmp@use@first@valid{pdfcontactphone}{\@pdfcontactphone}{%
+ \hyxmp@koma@phones
+ }%
+ \hyxmp@use@first@valid{pdfcontacturl}{\@pdfcontacturl}{%
+ \scr@fromurl@var
+ }%
+ \hyxmp@use@first@valid{pdfsubtitle}{\@pdfsubtitle}{%
+ \@subtitle
+ }%
+ \hyxmp@use@first@valid{pdfpublisher}{\@pdfpublisher}{%
+ \@publishers
+ }%
+ \hyxmp@parse@acmart
+}
+\newcommand*{\hyxmp@parse@acmart}{%
+ \begingroup
+ \let\@author=\@gobble
+ \def\email##1##2{%
+ \def\hyxmp@address@val{##2}%
+ \hyxmp@use@first@valid{pdfcontactemail}{\@pdfcontactemail}{%
+ \hyxmp@address@val
}%
}%
- {}%
- \@ifmtargexp{\@pdfauthor}{%
- \@ifnotmtargexp{\@author}{%
- \hypersetup{pdfauthor={\@author}}%
+ \def\streetaddress##1{%
+ \def\hyxmp@address@val{##1}%
+ \hyxmp@use@first@valid{pdfcontactaddress}{\@pdfcontactaddress}{%
+ \hyxmp@address@val
}%
}%
- {}%
+ \def\city##1{%
+ \def\hyxmp@address@val{##1}%
+ \hyxmp@use@first@valid{pdfcontactcity}{\@pdfcontactcity}{%
+ \hyxmp@address@val
+ }%
+ }%
+ \def\state##1{%
+ \def\hyxmp@address@val{##1}%
+ \hyxmp@use@first@valid{pdfcontactregion}{\@pdfcontactregion}{%
+ \hyxmp@address@val
+ }%
+ }%
+ \def\country##1{%
+ \def\hyxmp@address@val{##1}%
+ \hyxmp@use@first@valid{pdfcontactcountry}{\@pdfcontactcountry}{%
+ \hyxmp@address@val
+ }%
+ }%
+ \def\postcode##1{%
+ \def\hyxmp@address@val{##1}%
+ \hyxmp@use@first@valid{pdfcontactpostcode}{\@pdfcontactpostcode}{%
+ \hyxmp@address@val
+ }%
+ }%
+ \def\affiliation##1##2{%
+ ##2%
+ \let\affiliation=\@gobbletwo
+ }%
+ \setbox0=\hbox{\addresses}%
+ \endgroup
+ \@if@def@and@nonempty{@acmDOI}{%
+ \IfSubStr{\@acmDOI}{10.1145/1122445.1122456}{}{%
+ \IfSubStr{\@acmDOI}{10.1145/nnnnnnn.nnnnnnn}{}{%
+ \hyxmp@use@first@valid{pdfdoi}{\@pdfdoi}{%
+ \@acmDOI
+ }%
+ }%
+ }%
+ }%
+ \@if@def@and@nonempty{@acmISBN}{%
+ \IfSubStr{\@acmISBN}{XXXX}{}{%
+ \IfSubStr{\@acmISBN}{xxxx}{}{%
+ \def\hyxmp@strip@isbn@date##1/##2!{##1}%
+ \edef\hyxmp@acm@isbn{%
+ \expandafter\hyxmp@strip@isbn@date\@acmISBN/!%
+ }%
+ \hyxmp@use@first@valid{pdfisbn}{\@pdfisbn}{%
+ \hyxmp@acm@isbn
+ }%
+ }%
+ }%
+ }%
+ \def\hyxmp@acm@publisher{Association for Computing Machinery}%
+ \hyxmp@use@first@valid{pdfpublisher}{\@pdfpublisher}{%
+ \hyxmp@acm@publisher
+ }%
+ \hyxmp@use@first@valid{pdfpublication}{\@pdfpublication}{%
+ \@journalName,%
+ \@acmBooktitle,%
+ \@acmConference
+ }%
+ \if@ACM@journal
+ \def\hyxmp@acm@pubtype{journal}%
+ \else
+ \def\hyxmp@acm@pubtype{book}%
+ \fi
+ \hyxmp@use@first@valid{pdfpubtype}{\@pdfpubtype}{%
+ \hyxmp@acm@pubtype
+ }%
+ \hyxmp@use@first@valid{pdfvolumenum}{\@pdfvolumenum}{%
+ \@acmVolume
+ }%
+ \hyxmp@use@first@valid{pdfissuenum}{\@pdfissuenum}{%
+ \@acmNumber
+ }%
+}
+\@ifclassloaded{acmart}{}{\let\hyxmp@parse@acmart=\relax}
+\newcommand*{\hyxmp@set@dc@lang}{%
+ \let\hyxmp@dc@lang=\@pdflang
+}
+\AtEndPreamble{%
+ \@ifpackageloaded{hyperref}{%
+ \ifx\@pdflang\relax
+ \@ifundefined{mainbcp47id}{%
+ \let\@pdflang=\@empty
+ }{%
+ \xdef\@pdflang{\csname mainbcp47id\endcsname}%
+ \renewcommand*{\hyxmp@set@dc@lang}{%
+ \edef\hyxmp@dc@lang{\xpg@bcp@loaded}%
+ }%
+ }%
+ \fi
+ \hyxmp@auto@assign@data
\@ifundefined{XeTeXversion}{}{%
\@ifmtargexp{\@pdfcreationdate}{%
\let\@pdfcreationdate=\hyxmp@today@pdf
@@ -407,6 +564,7 @@
disabled}%
}%
}
+\hyxmp@at@end{\hyxmp@auto@assign@data}
\newcommand*{\hyxmp@commas@to@list}[2]{%
\gdef#1{}%
\expandafter\hyxmp@commas@to@list@i\expandafter#1#2,,%
@@ -1125,7 +1283,7 @@ ______</dc:#2>^^J%
\fi
}
\newcommand{\hyxmp@singleton@dc}[3][Bag]{%
- \@ifnotmtarg{#3}{%
+ \@ifnotmtargexp{#3}{%
\hyxmp@xmlify{#3}%
\hyxmp@add@to@xml{%
______<dc:#2>^^J%
@@ -1150,7 +1308,6 @@ ______</dc:#2>^^J%
\hyxmp@rdf@dc{rights}{\@pdfcopyright}%
\hyxmp@singleton@dc{publisher}{\@pdfpublisher}%
\hyxmp@singleton@dc[Seq]{date}{\hyxmp@today@xmp}%
- \hyxmp@singleton@dc{language}{\@pdflang}%
\hyxmp@singleton@dc{type}{\@pdftype}%
\hyxmp@list@to@xml[\ifHy@pdfa]{creator}{Seq}{\hyxmp@pdfauthor}%
\hyxmp@list@to@xml{subject}{Bag}{\hyxmp@pdfkeywords}%
@@ -1158,6 +1315,8 @@ ______</dc:#2>^^J%
\else
\hyxmp@add@simple{dc:source}{\@pdfsource}%
\fi
+ \hyxmp@set@dc@lang
+ \hyxmp@list@to@xml{language}{Bag}{\hyxmp@dc@lang}%
\@ifmtargexp{\@pdfidentifier}{%
\let\hyxmp@xmlified=\@empty
\hyxmp@cond@dc@identifier{info:doi/}{\@pdfdoi}%