Skip to content
Snippets Groups Projects
Commit 3f52bad3 authored by Yannis Barlas's avatar Yannis Barlas
Browse files

fix that passes tests

parent c3db234a
No related branches found
No related tags found
1 merge request!103Vivliostyle converter
Pipeline #3122 passed with stage
in 11 minutes and 11 seconds
const HTMLEPUB = require('html-epub') const HTMLEPUB = require('html-epub')
const fs = require('fs') const fs = require('fs')
const _ = require('lodash') const indexOf = require('lodash/indexOf')
const sorter = require('./sorter') const sorter = require('./sorter')
const converters = require('./converters') const converters = require('./converters')
...@@ -37,11 +37,11 @@ const EpubBackend = function (app) { ...@@ -37,11 +37,11 @@ const EpubBackend = function (app) {
stylesRoot = `${__dirname}/themes` stylesRoot = `${__dirname}/themes`
} }
let fontsRoot = process.cwd() + config.epub.fontsPath let fontsRoot = config.epub && config.epub.fontsPath
? process.cwd() + config.epub.fontsPath
: null
if (!fs.existsSync(fontsRoot)) { if (!fs.existsSync(fontsRoot)) fontsRoot = ''
fontsRoot = ''
}
// converters // converters
const activeConverters = [req.query.converter] const activeConverters = [req.query.converter]
...@@ -54,7 +54,7 @@ const EpubBackend = function (app) { ...@@ -54,7 +54,7 @@ const EpubBackend = function (app) {
.map(fragment => fragment.id) .map(fragment => fragment.id)
sortedFragments.forEach(fragment => { sortedFragments.forEach(fragment => {
let found = _.indexOf(partsIds, fragment.id) let found = indexOf(partsIds, fragment.id)
if (found !== -1) { if (found !== -1) {
fragment.number = found + 1 fragment.number = found + 1
} }
......
...@@ -14,7 +14,7 @@ test('converts source to html', () => { ...@@ -14,7 +14,7 @@ test('converts source to html', () => {
<p>Test</p> <p>Test</p>
</div> </div>
`, `,
id: 1, id: '1'
} }
const book = { const book = {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment