Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPUB parse dc:identifier as URI, infer from opf:scheme or the refine pattern #19

Open
danielweck opened this issue Jun 5, 2019 · 0 comments

Comments

@danielweck
Copy link
Member

danielweck commented Jun 5, 2019

See:
https://github.com/readium/architecture/blob/master/streamer/parser/metadata.md#identifier

const addIdentifier = (publication: Publication, _rootfile: Rootfile, opf: OPF) => {
if (opf.Metadata && opf.Metadata.Identifier) {
if (opf.UniqueIdentifier && opf.Metadata.Identifier.length > 1) {
opf.Metadata.Identifier.forEach((iden) => {
if (iden.ID === opf.UniqueIdentifier) {
publication.Metadata.Identifier = iden.Data;
}
});
} else if (opf.Metadata.Identifier.length > 0) {
publication.Metadata.Identifier = opf.Metadata.Identifier[0].Data;
}
}
};

@XmlXPathSelector("@scheme")
public Scheme!: string;

@XmlXPathSelector("dc:identifier")
@XmlItemType(Identifier)
public Identifier!: Identifier[];

@XmlXPathSelector("@refines")
public Refine!: string;
@XmlXPathSelector("@scheme")
public Scheme!: string;
@XmlXPathSelector("@property")
public Property!: string;

Related issue:
https://github.com/readium/r2-streamer-swift/issues/113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant