[AI]
MVP готов
This commit is contained in:
@@ -12,23 +12,14 @@ logger = logging.getLogger(__name__)
|
||||
def process_document(
|
||||
input_dir: Path, output_dir: Path, style_config_path: Path,
|
||||
template_path: Optional[Path] = None, theme_name: Optional[str] = None,
|
||||
plugins_dir: Optional[Path] = None
|
||||
plugins_dir: Optional[Path] = None, dry_run: bool = False
|
||||
):
|
||||
if plugins_dir and plugins_dir.exists():
|
||||
load_plugins_from_path(plugins_dir)
|
||||
if theme_name:
|
||||
theme_path = Path("resources/themes") / f"{theme_name}.yaml"
|
||||
if theme_path.exists():
|
||||
style_config_path = theme_path
|
||||
else:
|
||||
logger.warning(f"Тема {theme_name} не найдена, используем стандартный стиль")
|
||||
for doc_dir in input_dir.iterdir():
|
||||
if not doc_dir.is_dir():
|
||||
continue
|
||||
# Пропускаем папку images
|
||||
if doc_dir.name == "images":
|
||||
continue
|
||||
|
||||
for doc_dir in input_dir.iterdir():
|
||||
if not doc_dir.is_dir() or doc_dir.name == "images":
|
||||
continue
|
||||
doc_name = doc_dir.name
|
||||
md_path = doc_dir / "document.md"
|
||||
images_dir = doc_dir / "images"
|
||||
@@ -37,6 +28,10 @@ def process_document(
|
||||
logger.warning(f"Пропущено: {doc_name} — нет document.md")
|
||||
continue
|
||||
|
||||
if dry_run:
|
||||
logger.info(f"[DRY-RUN] Будет создан: {output_dir}/{doc_name}.docx")
|
||||
continue
|
||||
|
||||
with open(md_path, encoding="utf-8") as f:
|
||||
md_content = f.read()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user