Skip to main content

Omni-Re-Formatter: 将本地化后的 MD/XLIFF 还原为目标复杂格式

Project description

Omni-Re-Formatter (ORF)

ORF 是 Omni 文档本地化生态的最后一环,负责将标准化中间件还原为目标复杂格式。

核心功能

  • 读取 OL 翻译后的 MD/XLIFF 及 manifest.json/skeleton.zip
  • 调用 Pandoc/md2pptx/translate-toolkit 等成熟轮子
  • 配合自研胶水代码(manifest 解析、skeleton 回填、资源路径还原)
  • 重组生成本地化的复杂格式文档

支持格式

MD 回写

  • DOCX, ODT, EPUB, HTML, RTF, PDF, PPTX
  • ICML (InDesign), SRT (字幕)

XLIFF 回写

  • DOCX, PPTX, EPUB, HTML, ODF

云存储

  • AWS S3, Azure Blob Storage

AI 辅助

  • 布局溢出检测与修正

数据格式

  • XLSX, CSV, JSON

结构化标记

  • XML

Jupyter 笔记本

  • IPYNB

邮件格式

  • EML, MSG

安装

# 核心功能
pip install omni-re-formatter

# 开发依赖
pip install -e ".[dev]"

# 可选依赖
pip install -e ".[weasyprint]"   # PDF 生成
pip install -e ".[cloud]"       # S3/Azure 支持
pip install -e ".[ai]"          # AI 布局修正
pip install -e ".[office]"      # XLSX 支持
pip install -e ".[notebook]"     # IPYNB 支持
pip install -e ".[email-output]" # MSG 支持

快速开始

# MD 转 DOCX
orf apply-md translated.md --target-format docx --output result.docx

# MD 转 EPUB
orf apply-md translated.md --target-format epub --output result.epub

# XLIFF 回填(需要 skeleton.zip)
orf apply-xliff original.docx --xliff translated.xlf --output result.docx

# 批量转换
orf convert-batch ./translated --target-format docx --pattern "*.md"

# 云存储下载资源
# 配置 S3 或 Azure Blob 后,ORF 可直接从云端读取

CLI 命令

命令 说明
apply-md 将 MD 文件转换为目标格式
apply-xliff 应用 XLIFF 翻译到原始文档
convert-batch 批量转换 MD 文件
info 显示文档信息

项目状态

  • 294+ 个测试用例通过
  • MD 回写: 9 种格式 (DOCX, ODT, EPUB, HTML, RTF, PDF, PPTX, ICML, SRT)
  • XLIFF 回写: 5 种格式 (DOCX, PPTX, EPUB, HTML, ODF)
  • 云存储: S3 + Azure Blob 集成
  • AI: 布局溢出检测与修正
  • 数据格式: XLSX, CSV, JSON
  • 结构化标记: XML
  • Jupyter 笔记本: IPYNB
  • 邮件格式: EML, MSG
  • 完整的错误处理和日志系统

开发

# 安装开发依赖
pip install -e ".[dev]"

# 运行测试
pytest tests/

# 代码检查
ruff check src/orf
mypy src/orf --ignore-missing-imports

# 构建包
python -m build

架构

src/orf/
├── channels/          # 格式转换通道 (MD→X, XLIFF→X)
├── converters/        # 转换器基类与流式处理
├── parsers/          # manifest.json, frontmatter 解析
├── detection/         # 格式自动探测
├── resources/        # 图片资源管理
├── skeleton/          # skeleton.zip 加载与回填
├── cloud/            # S3, Azure Blob 客户端
├── ai/               # 布局分析与溢出修正
└── logging/          # 日志系统

相关项目

许可证

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

omni_re_formatter-0.1.0.tar.gz (244.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

omni_re_formatter-0.1.0-py3-none-any.whl (80.7 kB view details)

Uploaded Python 3

File details

Details for the file omni_re_formatter-0.1.0.tar.gz.

File metadata

  • Download URL: omni_re_formatter-0.1.0.tar.gz
  • Upload date:
  • Size: 244.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for omni_re_formatter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2731a98af285f2b81c6d48519f4290bc01a06250ac46494599753f6c2bcd422d
MD5 319c1f1490bfd1af417633d7cecc794f
BLAKE2b-256 ab5422e3471f3e211ae0d66241881538b9f3a456513dbdef8a278200c939fbae

See more details on using hashes here.

Provenance

The following attestation bundles were made for omni_re_formatter-0.1.0.tar.gz:

Publisher: release.yml on 1StepMore/Omni_Re_Formatter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file omni_re_formatter-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for omni_re_formatter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 754277036931bd95aba634e23a23db0984f967dbab8df34e7586b6cca308983f
MD5 e90a9399333514b7e63fbe1943e892cf
BLAKE2b-256 6e52d1e18d11bda6cb9e389d5c58b7900d88f5ab2a1fad21eec98b5006bcac59

See more details on using hashes here.

Provenance

The following attestation bundles were made for omni_re_formatter-0.1.0-py3-none-any.whl:

Publisher: release.yml on 1StepMore/Omni_Re_Formatter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page