Files
md2word/transit/__main__.py
zzy ae70d05672 refactor: 重构项目结构并更新依赖配置
- 移除原有的 docx_thesis 模块及其相关文件 (cli.py, config.py, converter.py)
- 新增 .claudeignore 文件以忽略 Python 生成文件和缓存
- 更新 .gitignore 文件添加更多忽略规则包括 .mypy_cache/, .ruff_cache/,
  .claude/, *.md 等
- 添加 README.md 使用说明文档
- 修改 pyproject.toml 依赖配置,新增 docxtpl、pyyaml,
  移除原 thesis 命令入口点并更新为 transit.__main__
- 新增 transit 模块及相应初始化文件
- 重命名 main.py 为快速入口脚本
2026-05-08 21:06:01 +08:00

35 lines
955 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""CLI 入口python -m transit"""
import argparse
from pathlib import Path
from .renderer import generate_thesis
def main():
parser = argparse.ArgumentParser(
description="毕业论文 Markdown → Word 格式转换工具"
)
parser.add_argument("data", type=str, help="Markdown 正文文件路径(.md")
parser.add_argument(
"-t", "--template", default="sample.docx", help="docx 模板文件路径(默认: sample.docx"
)
parser.add_argument(
"-o", "--output", default="output.docx", help="输出 Word 文件路径(默认: output.docx"
)
parser.add_argument(
"-c", "--config", default=None, help="TOML 配置文件路径(可选)"
)
args = parser.parse_args()
generate_thesis(
template_path=args.template,
data_path=args.data,
config_path=args.config,
output_path=args.output,
)
if __name__ == "__main__":
main()