fix pandoc conversion

This commit is contained in:
Alexander Nozik 2023-06-20 09:29:18 +03:00
parent 09da54f4f0
commit 3c65448c74

View File

@ -36,7 +36,7 @@ fun convert(inputPath: Path, outputPath: Path) {
).also { ).also {
logger.info("Running pandoc: ${it.command().joinToString(separator = " ")}") 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") val htmlPath = target.parent.resolve(source.fileName.nameWithoutExtension + ".html")
@ -61,6 +61,24 @@ fun convert(inputPath: Path, outputPath: Path) {
source.copyToIgnoringExistingDirectory(target, false) 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()
// }
} }