Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
🔄 synced local 'find_unused_media.py' with remote 'find_unused_media.py'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mara-Li committed Nov 6, 2023
1 parent 5ad0be4 commit 43d765c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions find_unused_media.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
from pathlib import Path
import os
import argparse
from typing import Optional
import yaml


def find_unused_media(img_path: Path = None, dry_run: bool = False):
def find_unused_media(img_path: Optional[Path] = None, dry_run: bool = False):
# load mkdocs.yml
with open("mkdocs.yml", "r", encoding="utf-8") as f:
config = yaml.load(f, Loader=yaml.UnsafeLoader)
# remove all !! pairs from the yaml file
data = f.read()
data = data.replace("!!", "")
config = yaml.safe_load(data)

docs_dir = Path.cwd() / Path(config.get("docs_dir", "docs"))
assets_dir = Path(docs_dir, config["extra"]["attachments"])
Expand Down

0 comments on commit 43d765c

Please sign in to comment.