@ridi/epub-parser
Advanced tools
Comparing version 0.6.0-alpha.2 to 0.6.0-alpha.3
@@ -632,3 +632,3 @@ 'use strict'; | ||
var rawBook, basePath, options, entries, tocId, items, itemRefs, coverMeta, inlineStyles; | ||
var rawBook, basePath, options, entries, tocId, items, itemRefs, coverMeta, inlineStyles, userStyle, namespace, id; | ||
return _regenerator2.default.wrap(function _callee5$(_context6) { | ||
@@ -770,3 +770,19 @@ while (1) { | ||
case 9: | ||
userStyle = options.additionalInlineStyle; | ||
if ((0, _parserCore.isExists)(userStyle)) { | ||
namespace = '' + options.styleNamespacePrefix + inlineStyles.length; | ||
id = 'additional_inline_style_' + namespace; | ||
inlineStyles.push({ | ||
id: id, | ||
href: basePath + '/' + id, | ||
mediaType: 'text/css', | ||
size: userStyle.length, | ||
itemType: _InlineCssItem2.default, | ||
namespace: namespace, | ||
style: userStyle | ||
}); | ||
} | ||
rawBook.items = [].concat((0, _toConsumableArray3.default)(rawBook.items), (0, _toConsumableArray3.default)(inlineStyles)); | ||
@@ -776,3 +792,3 @@ | ||
case 11: | ||
case 13: | ||
case 'end': | ||
@@ -809,3 +825,3 @@ return _context6.stop(); | ||
var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(rawItem, entry, options) { | ||
var styles, inlineStyles, find, filter, document, html, head, lastIdx, userStyle, namespace, href; | ||
var styles, inlineStyles, find, filter, document, html, head; | ||
return _regenerator2.default.wrap(function _callee6$(_context7) { | ||
@@ -883,4 +899,2 @@ while (1) { | ||
// ^~~ | ||
lastIdx = void 0; | ||
filter(head.children, 'tagName', 'style').forEach(function (style, idx) { | ||
@@ -905,26 +919,8 @@ var firstNode = style.children[0]; | ||
inlineStyles.push(inlineStyleItem); | ||
lastIdx = idx; | ||
} | ||
}); | ||
userStyle = options.additionalInlineStyle; | ||
if (userStyle) { | ||
namespace = '' + options.styleNamespacePrefix + ((0, _parserCore.isExists)(lastIdx) ? lastIdx + 1 : 0); | ||
href = rawItem.href + '_' + namespace; | ||
inlineStyles.push({ | ||
id: rawItem.id + '_' + namespace, | ||
href: href, | ||
mediaType: 'text/css', | ||
size: userStyle.length, | ||
itemType: _InlineCssItem2.default, | ||
namespace: namespace, | ||
style: userStyle | ||
}); | ||
} | ||
return _context7.abrupt('return', { styles: styles, inlineStyles: inlineStyles }); | ||
case 23: | ||
case 20: | ||
case 'end': | ||
@@ -931,0 +927,0 @@ return _context7.stop(); |
{ | ||
"name": "@ridi/epub-parser", | ||
"version": "0.6.0-alpha.2", | ||
"version": "0.6.0-alpha.3", | ||
"description": "Common EPUB2 data parser for Ridibooks services", | ||
@@ -31,3 +31,3 @@ "author": { | ||
"dependencies": { | ||
"@ridi/parser-core": "^0.6.0-alpha.2", | ||
"@ridi/parser-core": "^0.6.0-alpha.3", | ||
"css-tree": "^1.0.0-alpha.29", | ||
@@ -34,0 +34,0 @@ "fast-xml-parser": "^3.12.17", |
117178
2408