Atualizar src-py/renatoxsr/utils/pandoc.py
This commit is contained in:
@@ -15,6 +15,7 @@ def pandoc(
|
|||||||
bin: str | Path = "pandoc",
|
bin: str | Path = "pandoc",
|
||||||
output: str | Path = "-",
|
output: str | Path = "-",
|
||||||
overwrite = False,
|
overwrite = False,
|
||||||
|
to="markdown",
|
||||||
) -> str:
|
) -> str:
|
||||||
logger.info("%s: from '%s' to '%s'", bin, input_file, output)
|
logger.info("%s: from '%s' to '%s'", bin, input_file, output)
|
||||||
if not Path(bin).is_file():
|
if not Path(bin).is_file():
|
||||||
@@ -29,7 +30,9 @@ def pandoc(
|
|||||||
outf = Path(output)
|
outf = Path(output)
|
||||||
if output != "-" and outf.is_file() and not overwrite:
|
if output != "-" and outf.is_file() and not overwrite:
|
||||||
raise FileExistsError(errno.EEXIST, os.strerror(errno.EEXIST), outf)
|
raise FileExistsError(errno.EEXIST, os.strerror(errno.EEXIST), outf)
|
||||||
cmd = [bin, "--output", "-" if output=="-" else outf.resolve(), fpath]
|
cmd = [bin,
|
||||||
|
"--output", "-" if output=="-" else outf.resolve(),
|
||||||
|
"--writer", to, fpath]
|
||||||
logger.debug("CMD %s", str(cmd))
|
logger.debug("CMD %s", str(cmd))
|
||||||
proc = subprocess.run(cmd, text=True)
|
proc = subprocess.run(cmd, text=True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user