fix: update hardcoded paths in utility scripts after book/ restructure

Updated Python utility scripts to use correct paths with book/ prefix:
- rename_downloaded_images.py: quarto/contents/labs → book/quarto/contents/labs
- rename_auto_images.py: quarto/contents/labs → book/quarto/contents/labs
- convert_svg_to_png.py: quarto/contents → book/quarto/contents
- check_self_referential_sections.py: quarto/contents → book/quarto/contents

These scripts are run from the repository root, so they need the full
path including the book/ directory.
This commit is contained in:
Vijay Janapa Reddi
2025-12-05 15:51:03 -08:00
parent a23ac7b83f
commit ba20e892e7
4 changed files with 12 additions and 12 deletions

View File

@@ -269,22 +269,22 @@ def main():
epilog="""
Examples:
# Check a specific file
python check_self_referential_sections.py quarto/contents/core/frameworks/frameworks.qmd
python check_self_referential_sections.py book/quarto/contents/core/frameworks/frameworks.qmd
# Check all files in a directory
python check_self_referential_sections.py quarto/contents/
python check_self_referential_sections.py book/quarto/contents/
# Check with verbose output
python check_self_referential_sections.py quarto/contents/ --verbose
python check_self_referential_sections.py book/quarto/contents/ --verbose
"""
)
parser.add_argument(
'path',
type=Path,
nargs='?',
default=Path('quarto/contents'),
help='Path to file or directory to check (default: quarto/contents)'
default=Path('book/quarto/contents'),
help='Path to file or directory to check (default: book/quarto/contents)'
)
parser.add_argument(

View File

@@ -26,7 +26,7 @@ import re
from pathlib import Path
from typing import List, Tuple, Optional
def find_qmd_references(svg_path: str, search_root: str = "quarto/contents") -> List[Tuple[str, int, str]]:
def find_qmd_references(svg_path: str, search_root: str = "book/quarto/contents") -> List[Tuple[str, int, str]]:
"""
Find all QMD files that reference the given SVG file.
@@ -150,7 +150,7 @@ def main():
parser = argparse.ArgumentParser(description="Helper tool for SVG to PNG conversion")
parser.add_argument('svg_file', help="Path to SVG file to analyze/convert")
parser.add_argument('--png-file', help="Output PNG file path (default: replace .svg with .png)")
parser.add_argument('--search-root', default="quarto/contents", help="Root directory to search for QMD files")
parser.add_argument('--search-root', default="book/quarto/contents", help="Root directory to search for QMD files")
parser.add_argument('--dry-run', action='store_true', help="Show what would be done without making changes")
parser.add_argument('--find-references', action='store_true', help="Only find and show QMD references, don't convert")
parser.add_argument('--convert-only', action='store_true', help="Only convert SVG to PNG, don't update references or remove SVG")

View File

@@ -82,7 +82,7 @@ def rename_images(mappings: dict, dry_run: bool = False):
for local_path, url in mappings.items():
# Find the actual file
files = list(Path('quarto/contents/labs').rglob(local_path))
files = list(Path('book/quarto/contents/labs').rglob(local_path))
if not files:
print(f" ⚠️ File not found: {local_path}")

View File

@@ -155,7 +155,7 @@ def main():
print("=" * 60)
# Find all qmd files with auto-* images
labs_dir = Path('quarto/contents/labs')
labs_dir = Path('book/quarto/contents/labs')
if not labs_dir.exists():
print(f"❌ Directory not found: {labs_dir}")