Support for meta elements in metadata (EPUB 3)

http://www.idpf.org/epub/30/spec/epub30-publications.html#sec-meta-elem

A bit more liberal than what’s in the spec to account for non-compliant
EPUBs found in the wild.
This commit is contained in:
Julien Chaumond 2014-03-22 17:17:05 +01:00
parent 39d335679c
commit 12b38e31ef

12
epub.js
View File

@ -361,6 +361,18 @@ EPub.prototype.parseMetadata = function (metadata) {
break;
}
}
var metas = metadata['meta'] || {};
Object.keys(metas).forEach(function(key) {
var meta = metas[key];
if (meta['@'] && meta['@'].name) {
var name = meta['@'].name;
this.metadata[name] = meta['@'].content;
}
if (meta['#'] && meta['@'].property) {
this.metadata[meta['@'].property] = meta['#'];
}
}, this);
};
/**