Small cleaning

This commit is contained in:
jgrogan 2024-12-29 17:03:46 +00:00
parent e0a2d2b83c
commit ee69a8ddfa
2 changed files with 8 additions and 2 deletions

View file

@ -10,7 +10,8 @@ logger = logging.getLogger(__name__)
def cli_generate(source_dir: Path, build_dir: Path):
config = Config(source_dir.resolve(), build_dir.resolve())
config = Config(source_dir.resolve(),
build_dir.resolve())
generate(config)
@ -23,7 +24,10 @@ def main_cli():
help="Path to the build output",
)
parser.add_argument(
"--source_dir", type=Path, default=Path(), help="Site source directory"
"--source_dir",
type=Path,
default=Path(),
help="Site source directory"
)
args = parser.parse_args()

View file

@ -28,6 +28,7 @@ def _replace_content(src: Path, dst: Path):
def _write_file(path: Path, content: str):
os.makedirs(path.parent, exist_ok=True)
print("writing to:", path)
with open(path, "w", encoding="utf-8") as f:
f.write(content)
@ -54,6 +55,7 @@ def generate(config: Config):
parser = MarkdownIt()
sources = config.source_dir.glob("**/*.md")
for source in sources:
print("processing source: ", source)
content = _read_file(source)
output = parser.render(content)
output_path = _get_transformed_path(config, source, "html")