From de9eb518943f569932f344c0c2f9d1cd47d98bc0 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Wed, 23 Jan 2019 18:36:13 +0000 Subject: [PATCH] Fixing &ndsp; problem in opf file. --- src/epub.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/epub.js b/src/epub.js index 25c29e3..5290060 100644 --- a/src/epub.js +++ b/src/epub.js @@ -7,6 +7,10 @@ var xmlSerializer = new XMLSerializer(); // var DOMParser = require('xmldom').DOMParser var domParser = new DOMParser(); var generatedBufferType = 'blob' +var opf_file_base = 'epub_cA3Wt6s6' +var opf_file_name = opf_file_base+'.opf' +var ncx_file_name = opf_file_base+'.ncx' +var nav_file_name = opf_file_base+'.xhtml' /** * I hope JS is single threaded and not preemptive. @@ -14,7 +18,9 @@ var generatedBufferType = 'blob' * @param {*} text */ var escape = function (text){ - return $('
').text(text).html() + let html = $('
').text(text).html() + html = html.replace(/ /gi, " ") + return html } var html2txt = function (html) { @@ -339,15 +345,15 @@ class EpubMeta{ } opf(){ - return new EpubOpf("content.opf", this) + return new EpubOpf(opf_file_name, this) } ncx(){ - return new EpubNcx("content.ncx", this) + return new EpubNcx(ncx_file_name, this) } nav(){ - return new EpubNav("content.xhtml", this) + return new EpubNav(nav_file_name, this) } } @@ -365,7 +371,7 @@ class EpubWriter{ ` - + ` );