From 3c65448c74a8783d4cbd11942391dfefcff47cc4 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 20 Jun 2023 09:29:18 +0300 Subject: [PATCH] fix pandoc conversion --- src/main/kotlin/converters.kt | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/converters.kt b/src/main/kotlin/converters.kt index 7fc2037..6f44554 100644 --- a/src/main/kotlin/converters.kt +++ b/src/main/kotlin/converters.kt @@ -36,7 +36,7 @@ fun convert(inputPath: Path, outputPath: Path) { ).also { logger.info("Running pandoc: ${it.command().joinToString(separator = " ")}") - }.inheritIO().start().waitFor() + }.directory(source.parent.toFile()).inheritIO().start().waitFor() val htmlPath = target.parent.resolve(source.fileName.nameWithoutExtension + ".html") @@ -61,6 +61,24 @@ fun convert(inputPath: Path, outputPath: Path) { source.copyToIgnoringExistingDirectory(target, false) } } + +// inputPath.walk().filter { it.extension == "md" }.forEach { source -> +// +// val docxPath = +// (outputPath / source.relativize(inputPath)).resolveSibling(source.fileName.nameWithoutExtension + ".docx") +// +// ProcessBuilder( +// "pandoc", +// "--from=markdown", +// "--to=docx", +// "--lua-filter=${scriptPath.absolute()}", +// "--output=${docxPath.absolute()}", +// "${source.absolute()}", +// +// ).also { +// logger.info("Running pandoc: ${it.command().joinToString(separator = " ")}") +// }.inheritIO().start().waitFor() +// } }