added conversion function.
Need to do speedtest to see whether this method is faster or slower than calling unix find.
This commit is contained in:
parent
8dc4b62cf4
commit
ceeb38a667
|
@ -80,9 +80,21 @@ def find_paths_to_convert(inputDir, pathList):
|
||||||
pathList.append(Path(path.path))
|
pathList.append(Path(path.path))
|
||||||
return pathList
|
return pathList
|
||||||
|
|
||||||
|
#simple wrapper around the asciidoctor cli.
|
||||||
|
def convert_file(inDir, outDir, inFile):
|
||||||
|
logging.debug(f'converting {inFile} from directory {inDir} to directory {outDir}')
|
||||||
|
try:
|
||||||
|
subprocess.run(['asciidoctor', f'--base-dir={inDir}', f'--source-dir={inDir}', f'--destination-dir={outDir}', inFile], check=True)
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f'could not convert {inFile}!')
|
||||||
|
logging.error(f'stdErr was {e.stderr}')
|
||||||
|
logging.error(f'stdOut was {e.stdout}')
|
||||||
|
|
||||||
inFile, outFile, compress = parse_arguments()
|
inFile, outFile, compress = parse_arguments()
|
||||||
os.chdir(inFile)
|
os.chdir(inFile)
|
||||||
tmpDir=TmpDir('./')
|
tmpDir=TmpDir('./')
|
||||||
|
pathsToConvert=find_paths_to_convert('./', [])
|
||||||
|
for i in pathsToConvert:
|
||||||
|
convert_file('./', tmpDir.path, i)
|
||||||
breakpoint()
|
breakpoint()
|
||||||
tmpDir.cleanup()
|
tmpDir.cleanup()
|
||||||
print(find_paths_to_convert('./', []))
|
|
||||||
|
|
Loading…
Reference in a new issue