Skip to content

Commit

Permalink
hyperref,hyperxmp: support all documented \hypersetup options
Browse files Browse the repository at this point in the history
  • Loading branch information
xworld21 committed May 18, 2024
1 parent cc12061 commit 553ab81
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 15 deletions.
1 change: 1 addition & 0 deletions lib/LaTeXML/Engine/Base_Schema.pool.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ RequireResource('LaTeXML.css');
"ma" => "http://www.w3.org/ns/ma-ont#",
"og" => "http://ogp.me/ns#",
"owl" => "http://www.w3.org/2002/07/owl#",
"prism" => "http://prismstandard.org/namespaces/basic/3.0/",
"rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfa" => "http://www.w3.org/ns/rdfa#",
"rdfs" => "http://www.w3.org/2000/01/rdf-schema#",
Expand Down
26 changes: 12 additions & 14 deletions lib/LaTeXML/Package/hyperref.sty.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,18 @@ foreach my $option ( # 3.1 General Options

# \hypersetup{keyvals} configures various parameters,
# for each pdf keyword, provide [property,(content|resource),datatype,langsupport]
our %pdfkey_property = (
baseurl => '', # xmp:BaseURL ??
pdfauthor => ['dcterms:creator', 'content', undef, 1],
pdfkeywords => ['dcterms:subject', 'content'], # & pdf:Keywords
pdflang => ['dcterms:language', 'content'],
pdfproducer => '', # pdf:Producer & xmp:CreatorTool
pdfsubject => ['dcterms:subject', 'content'],
pdftitle => ['dcterms:title', 'content', undef, 1],
# Include hyperxmp's keywords, as well.
pdfauthortitle => '', # photoshop:AuthorsPosition
pdfcaptionwriter => '', # photoshop:CaptionWriter !?!?!?
pdfcopyright => ['dcterms:rights', 'content', undef, 1], # & xmpRights:Marked
pdflicenseurl => ['cc:licence', 'resource'], # xmpRights:WebStatement
pdfmetalang => '', # dcterms:language ??
# %pdfkey_property may have already been populated by hyperxmp
our %pdfkey_property = (%pdfkey_property,
baseurl => '', # xmp:BaseURL ??
pdfauthor => ['dcterms:creator', 'content', undef, 1],
pdfcreationdate => '', # xmp:CreateDate
pdfkeywords => ['dcterms:subject', 'content'], # & pdf:Keywords
pdflang => ['dcterms:language', 'content'],
pdfmoddate => '', # xmp:ModifyDate
pdfproducer => '', # pdf:Producer & xmp:CreatorTool
pdfsubject => ['dcterms:description', 'content', undef, 1],
pdftitle => ['dcterms:title', 'content', undef, 1],
pdftrapped => '', # pdf:Trapped
);
# date=>dcterms:date xmp:CreateDate xmp:ModifyDate xmp:MetadataDate ?
# document identifier => xmlMM:DocumentID
Expand Down
49 changes: 49 additions & 0 deletions lib/LaTeXML/Package/hyperxmp.sty.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,53 @@ RequirePackage('ifthen');
# Basically, the effects of hyperxmp are already built
# into the LaTeXML binding for hyperref.

# TODO: implement \XMPLangAlt for metadata in different languages

# %pdfkey_property may have already been populated by hyperref
our %pdfkey_property = (%pdfkey_property,
# Include hyperxmp's keywords, as well.
pdfaconformance => '', # pdfaid:conformance
pdfapart => '', # pdfaid:part
pdfauthortitle => '', # photoshop:AuthorsPosition
pdfbookedition => ['prism:bookEdition', 'content', undef, 1],
pdfbytes => ['prism:byteCount', 'content'],
pdfcaptionwriter => '', # photoshop:CaptionWriter
pdfcontactaddress => '', # Iptc4xmpCore:CiAdrExtadr
pdfcontactcity => '', # Iptc4xmpCore:CiAdrCity
pdfcontactcountry => '', # Iptc4xmpCore:CiAdrCtry
pdfcontactemail => '', # Iptc4xmpCore:CiEmailWork
pdfcontactphone => '', # Iptc4xmpCore:CiTelWork
pdfcontactpostcode => '', # Iptc4xmpCore:CiAdrPcode
pdfcontactregion => '', # Iptc4xmpCore:CiAdrRegion
pdfcontacturl => '', # Iptc4xmpCore:CiUrlWork
pdfcopyright => ['dcterms:rights', 'content', undef, 1], # & xmpRights:Marked, xmpRights:WebStatement
pdfdate => ['dcterms:date', 'content'], # (if missing, hyperxmp uses \date -- we delegate the default choice to postprocessing)
pdfdocumentid => '', # xmpMM:DocumentID
pdfdoi => ['prism:doi', 'content'],
pdfeissn => ['prism:eIssn', 'content'],
pdfidentifier => ['dcterms:identifier', 'content'], # (if missing, hyperxmp uses the first non-empty doi, eissn, issn, isbn with prefix info:doi/ or urn:ISS(B|N): -- we delegate the default choice to postprocessing)
pdfinstanceid => '', # xmpMM:InstanceID
pdfisbn => ['prism:isbn', 'content'],
pdfissn => ['prism:issn', 'content'],
pdfissuenum => ['prism:number', 'content'],
pdflicenseurl => ['cc:licence', 'resource'], # xmpRights:WebStatement
pdfmetadate => '', # xmp:MetadataDate
pdfmetalang => '', # the default language of the metadata entries themselves
pdfnumpages => ['prism:pageCount', 'content'], # xmpTPg:NPages
pdfpagerange => ['prism:pageRange', 'content'],
pdfpublication => ['prism:publicationName', 'content', undef, 1],
pdfpublisher => ['dcterms:publisher', 'content'],
pdfpubstatus => '', # jav:journal_article_version
pdfpubtype => ['prism:aggregationType', 'content'],
pdfrendition => '', # xmpMM:RenditionClass
pdfsource => ['dcterms:source', 'content'],
pdfsubtitle => ['prism:subtitle', 'content', undef, 1],
pdftype => ['dcterms:type', 'content'],
pdfuapart => '', # pdfuaid:part
pdfurl => ['prism:url', 'content'],
pdfversionid => '', # xmpMM:VersionID
pdfvolumenum => ['prism:volume', 'content'],
pdfxstandard => '', # {pdfx,pdfxid}:GTS_PDFXVersion
);

1;
2 changes: 1 addition & 1 deletion t/complex/hypertest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
<rdf about="" content="Not subject to copyright" property="dcterms:rights"/>
<rdf about="" content="test,hyperref" property="dcterms:subject"/>
<rdf about="" property="cc:licence" resource="http://creativecommons.org/licenses/by/3.0/"/>
<rdf about="" content="Testing LaTeXML’s processing of hyperref metadata" property="dcterms:subject"/>
<rdf about="" content="Testing LaTeXML’s processing of hyperref metadata" property="dcterms:description"/>
<rdf about="" content="Test Hyperref Metadata" property="dcterms:title"/>
</document>

0 comments on commit 553ab81

Please sign in to comment.