Улучшение формирования fb2

This commit is contained in:
Book Pauk
2019-02-23 20:15:40 +07:00
parent 2acb65f6b3
commit a75590c493

View File

@@ -479,21 +479,29 @@ class BookConverter {
}
}
let tOpen = '';
let tBody = '';
let tClose = '';
if (name)
out += `<${name}${attrs}>`;
tOpen += `<${name}${attrs}>`;
if (node.hasOwnProperty('_t'))
out += repSpaces(node._t);
tBody += repSpaces(node._t);
for (let nodeName in node) {
if (nodeName && nodeName[0] == '_' && nodeName != '_a')
continue;
const n = node[nodeName];
out += this.formatFb2Node(n, nodeName);
tBody += this.formatFb2Node(n, nodeName);
}
if (name)
out += `</${name}>`;
tClose += `</${name}>`;
if (attrs == '' && name == 'p' && tBody.trim() == '')
out += '<empty-line/>'
else
out += `${tOpen}${tBody}${tClose}`;
}
return out;
}