From 8dc4b62cf43e7bfb701e065559562eb121a4ed62 Mon Sep 17 00:00:00 2001 From: gabe Date: Thu, 2 Sep 2021 19:43:00 -0500 Subject: [PATCH] added function to find files needing conversion. --- adocStaticSiteGen.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/adocStaticSiteGen.py b/adocStaticSiteGen.py index 3715273..863400b 100755 --- a/adocStaticSiteGen.py +++ b/adocStaticSiteGen.py @@ -1,7 +1,7 @@ #! /usr/bin/env python3 #takes directory, converts all .adoc files to html files, copying the resulting html files to an identical directory strucuture, and copies over all non .adoc files unchanged. Optionally outputs as a tar.gz file. -import subprocess, sys, argparse, logging, tempfile, shutil, os +import subprocess, sys, argparse, logging, tempfile, shutil, os, re from pathlib import Path #logging.basicConfig(format='%(asctime)s:%(message)s', level=logging.INFO) @@ -75,9 +75,14 @@ def find_paths_to_convert(inputDir, pathList): if path.is_dir(): logging.debug(f'{path.path} is directory, recursing') find_paths_to_convert(path, pathList) + elif path.is_file() and re.match('^.*\.adoc$', path.name): + logging.debug(f'adding {path.name} to pathList') + pathList.append(Path(path.path)) + return pathList -inputDir, outFile, compress = parse_arguments() -tmpDir=TmpDir(inputDir) +inFile, outFile, compress = parse_arguments() +os.chdir(inFile) +tmpDir=TmpDir('./') breakpoint() tmpDir.cleanup() -find_paths_to_convert(inputDir, []) +print(find_paths_to_convert('./', []))