Улучшение формирования fb2
This commit is contained in:
@@ -479,21 +479,29 @@ class BookConverter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let tOpen = '';
|
||||||
|
let tBody = '';
|
||||||
|
let tClose = '';
|
||||||
if (name)
|
if (name)
|
||||||
out += `<${name}${attrs}>`;
|
tOpen += `<${name}${attrs}>`;
|
||||||
if (node.hasOwnProperty('_t'))
|
if (node.hasOwnProperty('_t'))
|
||||||
out += repSpaces(node._t);
|
tBody += repSpaces(node._t);
|
||||||
|
|
||||||
for (let nodeName in node) {
|
for (let nodeName in node) {
|
||||||
if (nodeName && nodeName[0] == '_' && nodeName != '_a')
|
if (nodeName && nodeName[0] == '_' && nodeName != '_a')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const n = node[nodeName];
|
const n = node[nodeName];
|
||||||
out += this.formatFb2Node(n, nodeName);
|
tBody += this.formatFb2Node(n, nodeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
out += `</${name}>`;
|
tClose += `</${name}>`;
|
||||||
|
|
||||||
|
if (attrs == '' && name == 'p' && tBody.trim() == '')
|
||||||
|
out += '<empty-line/>'
|
||||||
|
else
|
||||||
|
out += `${tOpen}${tBody}${tClose}`;
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user