Files
2026Technology-Competition/src/genesis/parsers/_word_common.py
T

12 lines
355 B
Python

"""Word 解析共享小工具(WordTemplateParser / RuleDocParser 复用)。"""
from __future__ import annotations
def heading_level(style_name: str) -> int:
"""从 Heading N 样式名解析大纲级别;非数字/无后缀兜底 1。"""
try:
return int(style_name.split()[-1])
except (ValueError, IndexError):
return 1