Улучшение парсинга СИ
This commit is contained in:
@@ -10,6 +10,7 @@ const FileDetector = require('../FileDetector');
|
|||||||
|
|
||||||
const repSpaces = (text) => text.replace(/ |[\t\n\r]/g, ' ');
|
const repSpaces = (text) => text.replace(/ |[\t\n\r]/g, ' ');
|
||||||
const repSpaces2 = (text) => text.replace(/[\n\r]/g, '');
|
const repSpaces2 = (text) => text.replace(/[\n\r]/g, '');
|
||||||
|
const repSpaces3 = (text) => text.replace(/ /g, ' ');
|
||||||
|
|
||||||
class BookConverter {
|
class BookConverter {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -384,6 +385,7 @@ class BookConverter {
|
|||||||
if (inSubtitle) {
|
if (inSubtitle) {
|
||||||
closeTag('subtitle');
|
closeTag('subtitle');
|
||||||
inSubtitle = false;
|
inSubtitle = false;
|
||||||
|
isFirstPara = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inJustify) {
|
if (inJustify) {
|
||||||
@@ -442,7 +444,7 @@ class BookConverter {
|
|||||||
growParagraph(`${tOpen}${text}${tClose}`);
|
growParagraph(`${tOpen}${text}${tClose}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
sax.parseSync(repSpaces(this.decode(data).toString()), {
|
sax.parseSync(repSpaces3(this.decode(data).toString()), {
|
||||||
onStartNode, onEndNode, onTextNode, onComment,
|
onStartNode, onEndNode, onTextNode, onComment,
|
||||||
innerCut: new Set(['head', 'script', 'style'])
|
innerCut: new Set(['head', 'script', 'style'])
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user