From 12b38e31ef9887fb9576122b5d0c3f6dc3deb68d Mon Sep 17 00:00:00 2001 From: Julien Chaumond Date: Sat, 22 Mar 2014 17:17:05 +0100 Subject: [PATCH] Support for meta elements in metadata (EPUB 3) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- epub.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/epub.js b/epub.js index af6d971..c43264a 100644 --- a/epub.js +++ b/epub.js @@ -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); }; /**