fix toc parser
This commit is contained in:
parent
d76834112b
commit
4e63148bb0
17
epub.js
17
epub.js
@ -509,20 +509,25 @@ EPub.prototype.walkNavMap = function (branch, path, id_list, level) {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
var i, len, output = [], element, title, order, href;
|
var output = [];
|
||||||
|
|
||||||
if (!Array.isArray(branch)) {
|
if (!Array.isArray(branch)) {
|
||||||
branch = [branch];
|
branch = [branch];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0, len = branch.length; i < len; i++) {
|
for (var i = 0; i < branch.length; i++) {
|
||||||
if (branch[i].navLabel) {
|
if (branch[i].navLabel) {
|
||||||
|
|
||||||
title = (branch[i].navLabel && branch[i].navLabel.text || branch[i].navLabel || "").trim();
|
var title = '';
|
||||||
order = Number(branch[i]["@"] && branch[i]["@"].playOrder || 0);
|
if (branch[i].navLabel && typeof branch[i].navLabel.text == 'string')
|
||||||
href = (branch[i].content && branch[i].content["@"] && branch[i].content["@"].src || "").trim();
|
title = branch[i].navLabel.text.trim();
|
||||||
|
var order = Number(branch[i]["@"] && branch[i]["@"].playOrder || 0);
|
||||||
|
if (isNaN(order)) order = 0;
|
||||||
|
var href = '';
|
||||||
|
if (branch[i].content && branch[i].content["@"] && typeof branch[i].content["@"].src == 'string')
|
||||||
|
href = branch[i].content["@"].src.trim();
|
||||||
|
|
||||||
element = {
|
var element = {
|
||||||
level: level,
|
level: level,
|
||||||
order: order,
|
order: order,
|
||||||
title: title
|
title: title
|
||||||
|
Reference in New Issue
Block a user