2018-02-26 21:25:54 +02:00
|
|
|
const InteropService_Importer_Base = require('lib/services/InteropService_Importer_Base');
|
|
|
|
const Folder = require('lib/models/Folder.js');
|
2019-07-29 15:58:33 +02:00
|
|
|
const { filename } = require('lib/path-utils.js');
|
2018-02-26 21:25:54 +02:00
|
|
|
|
2019-09-23 23:18:30 +02:00
|
|
|
class InteropService_Importer_EnexToHtml extends InteropService_Importer_Base {
|
2018-02-26 21:25:54 +02:00
|
|
|
async exec(result) {
|
2018-02-27 22:04:38 +02:00
|
|
|
const { importEnex } = require('lib/import-enex');
|
|
|
|
|
2018-02-26 21:25:54 +02:00
|
|
|
let folder = this.options_.destinationFolder;
|
|
|
|
|
|
|
|
if (!folder) {
|
2018-06-27 22:45:31 +02:00
|
|
|
const folderTitle = await Folder.findUniqueItemTitle(filename(this.sourcePath_));
|
2018-02-26 21:25:54 +02:00
|
|
|
folder = await Folder.save({ title: folderTitle });
|
|
|
|
}
|
|
|
|
|
2020-02-05 00:09:34 +02:00
|
|
|
await importEnex(folder.id, this.sourcePath_, { ...this.options_, outputFormat: 'html' });
|
2018-02-26 21:25:54 +02:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-23 23:18:30 +02:00
|
|
|
module.exports = InteropService_Importer_EnexToHtml;
|