diff --git a/CliClient/tests/services_InteropService.js b/CliClient/tests/services_InteropService.js index 2a6bb9bd6..eeec0d446 100644 --- a/CliClient/tests/services_InteropService.js +++ b/CliClient/tests/services_InteropService.js @@ -427,4 +427,21 @@ describe('services_InteropService', function() { expect(await shim.fsDriver().exists(`${outDir}/ジョプリン/ジョプリン.md`)).toBe(true); })); + it('should export a notebook as MD', asyncTest(async () => { + const folder1 = await Folder.save({ title: 'testexportfolder' }); + await Note.save({ title: 'textexportnote1', parent_id: folder1.id }); + await Note.save({ title: 'textexportnote2', parent_id: folder1.id }); + + const service = new InteropService(); + + await service.export({ + path: exportDir(), + format: 'md', + sourceFolderIds: [folder1.id], + }); + + expect(await shim.fsDriver().exists(`${exportDir()}/testexportfolder/textexportnote1.md`)).toBe(true); + expect(await shim.fsDriver().exists(`${exportDir()}/testexportfolder/textexportnote2.md`)).toBe(true); + })); + }); diff --git a/ReactNativeClient/lib/services/InteropService_Exporter_Md.js b/ReactNativeClient/lib/services/InteropService_Exporter_Md.js index 370d696b3..dacd97df0 100644 --- a/ReactNativeClient/lib/services/InteropService_Exporter_Md.js +++ b/ReactNativeClient/lib/services/InteropService_Exporter_Md.js @@ -15,7 +15,7 @@ class InteropService_Exporter_Md extends InteropService_Exporter_Base { await shim.fsDriver().mkdir(this.resourceDir_); } - async makeDirPath_(item, pathPart = null) { + async makeDirPath_(item, pathPart = null, findUniqueFilename = true) { let output = ''; while (true) { if (item.type_ === BaseModel.TYPE_FOLDER) { @@ -23,7 +23,7 @@ class InteropService_Exporter_Md extends InteropService_Exporter_Base { output = `${pathPart}/${output}`; } else { output = `${friendlySafeFilename(item.title, null, true)}/${output}`; - output = await shim.fsDriver().findUniqueFilename(output); + if (findUniqueFilename) output = await shim.fsDriver().findUniqueFilename(output); } } if (!item.parent_id) return output; @@ -86,7 +86,7 @@ class InteropService_Exporter_Md extends InteropService_Exporter_Base { if (!note) continue; - let notePath = `${await this.makeDirPath_(note)}${friendlySafeFilename(note.title, null, true)}.md`; + let notePath = `${await this.makeDirPath_(note, null, false)}${friendlySafeFilename(note.title, null, true)}.md`; notePath = await shim.fsDriver().findUniqueFilename(`${this.destDir_}/${notePath}`, Object.values(context.notePaths)); context.notePaths[note.id] = notePath; } diff --git a/Tools/release-electron.js b/Tools/release-electron.js index c2a11cca4..941edc25a 100644 --- a/Tools/release-electron.js +++ b/Tools/release-electron.js @@ -29,6 +29,7 @@ async function main() { console.info(`Created GitHub release: ${release.html_url}`); console.info('GitHub release page: https://github.com/laurent22/joplin/releases'); + console.info(`To create changelog: node Tools/git-changelog.js ${version}`); } main().catch((error) => {