Подключил декодер html-entities

This commit is contained in:
Book Pauk
2019-02-04 15:47:53 +07:00
parent 8fef53d35e
commit 170c06fa3f
3 changed files with 5 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
import he from 'he';
import sax from '../../../../server/core/BookConverter/sax'; import sax from '../../../../server/core/BookConverter/sax';
import {sleep} from '../../../share/utils'; import {sleep} from '../../../share/utils';
@@ -134,7 +135,8 @@ export default class BookParser {
}; };
const onTextNode = (text) => {// eslint-disable-line no-unused-vars const onTextNode = (text) => {// eslint-disable-line no-unused-vars
text = text.replace(/ |[\t\n\r]/g, ' '); text = he.decode(text);
text = text.replace(/[\t\n\r]/g, ' ');
if (text != ' ' && text.trim() == '') if (text != ' ' && text.trim() == '')
text = text.trim(); text = text.trim();

3
package-lock.json generated
View File

@@ -5230,8 +5230,7 @@
"he": { "he": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="
"dev": true
}, },
"hex-color-regex": { "hex-color-regex": {
"version": "1.1.0", "version": "1.1.0",

View File

@@ -66,6 +66,7 @@
"fg-loadcss": "^2.1.0", "fg-loadcss": "^2.1.0",
"fs-extra": "^7.0.1", "fs-extra": "^7.0.1",
"got": "^9.5.1", "got": "^9.5.1",
"he": "^1.2.0",
"iconv-lite": "^0.4.24", "iconv-lite": "^0.4.24",
"localforage": "^1.7.3", "localforage": "^1.7.3",
"lodash": "^4.17.11", "lodash": "^4.17.11",