misc fixes for Google Play Books upload issue

This commit is contained in:
alexadam 2017-07-14 22:00:25 +03:00
parent e4f6940ecc
commit 5f01a960f1
3 changed files with 7 additions and 4 deletions

View file

@ -216,7 +216,7 @@ function sanitize(rawContentString) {
tmpAttrsTxt += ' class="' + attrs[i].value + '"';
}
}
lastFragment = tmpAttrsTxt.length === 0 ? '<img></img>' : '<img ' + tmpAttrsTxt + '" alt=""></img>';
lastFragment = tmpAttrsTxt.length === 0 ? '<img></img>' : '<img ' + tmpAttrsTxt + ' alt=""></img>';
} else if (tag === 'a') {
var tmpAttrsTxt = '';
for (var i = 0; i < attrs.length; i++) {

View file

@ -124,7 +124,7 @@ function _buildEbook(allPages) {
'<metadata>' +
'<dc:title id="t1">'+ ebookName + '</dc:title>' +
'<dc:identifier id="db-id">isbn</dc:identifier>' +
'<meta property="dcterms:modified">' + new Date().toISOString() + '</meta>' +
'<meta property="dcterms:modified">' + new Date().toISOString().replace(/\.[0-9]+Z/i, 'Z') + '</meta>' +
'<dc:language>en</dc:language>' +
'</metadata>' +
'<manifest>' +
@ -134,10 +134,12 @@ function _buildEbook(allPages) {
allPages.reduce(function(prev, page, index) {
return prev + '\n' + '<item id="ebook' + index + '" href="pages/' + page.url + '" media-type="application/xhtml+xml" />';
}, '') +
allPages.reduce(function(prev, page, index) {
return prev + '\n' + '<item id="style' + index + '" href="style/' + page.styleFileName + '" media-type="text/css" />';
}, '') +
allPages.reduce(function(prev, page, index) {
return prev + '\n' + getImagesIndex(page.images);
}, '') +
// getExternalLinksIndex() +
'</manifest>' +
'<spine toc="ncx">' +
allPages.reduce(function(prev, page, index) {

View file

@ -167,7 +167,8 @@ function getAbsoluteUrl(urlStr) {
} else if (urlStr.indexOf('http') !== 0) {
absoluteUrl = currentUrl + '/' + urlStr;
}
absoluteUrl = absoluteUrl.replace(/&amp;/ig, '&'); //TODO ?
absoluteUrl = absoluteUrl.replace(/&amp;/ig, '&');
absoluteUrl = absoluteUrl.replace(/&/ig, '&amp;');
return absoluteUrl;
} catch (e) {
console.log('Error:', e);