Skip to content

Commit

Permalink
🐛 fix bugs about textbundle export type
Browse files Browse the repository at this point in the history
  • Loading branch information
mokeyish committed Jul 4, 2022
1 parent 343c741 commit adae2bb
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-enhancing-export",
"name": "Obsidian Enhancing Export",
"version": "1.0.11",
"version": "1.1.0",
"minAppVersion": "0.12.0",
"description": "This is a enhancing export plugin for Obsidian. It allows to export to formats like Html, DOCX, ePub and PDF or Markdown(Hugo) etc.",
"author": "YISH",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-enhancing-export",
"version": "1.0.11",
"version": "1.1.0",
"description": "This is a enhancing export plugin for Obsidian. It allows to export to formats like Html, DOCX, ePub and PDF or Markdown(Hugo) etc.",
"main": "dist/main.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/export_command_templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default {
name: 'TextBundle',
type: 'pandoc',
arguments:
'-f markdown --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/markdown.lua" -V media_dir="${outputDir}/${outputFileName}/assets" -s -o "${outputDir}/${outputFileName}/text.md" -t commonmark_x-attributes',
'-f markdown --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/markdown.lua" -V media_dir="${outputDir}/${outputFileName}.textbundle/assets" -s -o "${outputDir}/${outputFileName}.textbundle/text.md" -t commonmark_x-attributes',
extension: '.md',
},
'PDF': {
Expand Down
21 changes: 15 additions & 6 deletions src/exporto0o.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,23 +152,32 @@ export async function exportToOo(

const cmd = cmdTpl.replace(/\${(.*?)}/g, (_, p1: string) => variables[p1 as keyof typeof variables]);

const args = await yargs(cmd.split(' ')).options({
output: { type: 'string', alias: 'o' },
}).argv;
const actualOutputPath = args.output.startsWith('"') && args.output.endsWith('"')
|| args.output.startsWith('\'') && args.output.endsWith('\'')
? args.output.substring(1, args.output.length - 1)
: args.output;

const actualOutputDir = actualOutputPath.substring(0, actualOutputPath.lastIndexOf('/'));
if (!fs.existsSync(actualOutputDir)) {
fs.mkdirSync(actualOutputDir);
}

executeCommand(
cmd,
() => {
progress.hide();

const next = async () => {
const args = yargs(cmd.split(' ')).options({
output: { type: 'string', alias: 'o' },
});
const argv = await args.argv;
if (openExportedFileLocation) {
setTimeout(() => {
ct.remote.shell.showItemInFolder(argv.output);
ct.remote.shell.showItemInFolder(actualOutputPath);
}, 1000);
}
if (openExportedFile) {
await ct.remote.shell.openPath(argv.output);
await ct.remote.shell.openPath(actualOutputPath);
}
if (setting.type === 'pandoc' && setting.runCommand === true && setting.command) {
executeCommand(setting.command);
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"1.0.8": "0.12.0",
"1.0.9": "0.12.0",
"1.0.10": "0.12.0",
"1.0.11": "0.12.0"
"1.0.11": "0.12.0",
"1.1.0": "0.12.0"
}

0 comments on commit adae2bb

Please sign in to comment.