瀏覽代碼

Мелкие поправки

Book Pauk 6 年之前
父節點
當前提交
af6d385b31
共有 1 個文件被更改,包括 9 次插入9 次删除
  1. 9 9
      client/components/Reader/share/BookParser.js

+ 9 - 9
client/components/Reader/share/BookParser.js

@@ -138,8 +138,8 @@ export default class BookParser {
         });
 
         parser.on('textNode', (text) => {
-            text = text.replace(/[\t\n\r]/g, ' ');
-            
+            text = text.replace(/ |[\t\n\r]/g, ' ');
+
             if (text != ' ' && text.trim() == '')
                 text = text.trim();
 
@@ -179,22 +179,22 @@ export default class BookParser {
                     fb2.annotation += text;
             }
 
-            let cOpen = (center ? '<center>' : '');
-            cOpen += (bold ? '<strong>' : '');
-            let cClose = (center ? '</center>' : '');
-            cClose += (bold ? '</strong>' : '');
+            let tOpen = (center ? '<center>' : '');
+            tOpen += (bold ? '<strong>' : '');
+            let tClose = (center ? '</center>' : '');
+            tClose += (bold ? '</strong>' : '');
 
             if (path.indexOf('/FictionBook/body/title') == 0) {
-                newParagraph(`${cOpen}${text}${cClose}`, text.length, true);
+                newParagraph(`${tOpen}${text}${tClose}`, text.length, true);
             }
 
             if (path.indexOf('/FictionBook/body/section') == 0) {
                 switch (tag) {
                     case 'p':
-                        growParagraph(`${cOpen}${text}${cClose}`, text.length);
+                        growParagraph(`${tOpen}${text}${tClose}`, text.length);
                         break;
                     default:
-                        growParagraph(`${cOpen}${text}${cClose}`, text.length);
+                        growParagraph(`${tOpen}${text}${tClose}`, text.length);
                 }
             }
         });