feat(reports): generate card, jump to end, labelled export, TOC levels, table bands, export size; drop 字段 jargon (BUG-1092..1094)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
64aa0ec20c
commit
d85ab9a2d2
@@ -83,6 +83,17 @@ def _pl9_english_report_title(packet: dict) -> str:
|
||||
return f"{name}'s Vedic Astrology Chart Report" if name else "Vedic Astrology Chart Report"
|
||||
|
||||
|
||||
def _dignity_label(value) -> str:
|
||||
"""Engine dignity labels are bilingual (``入旺(Exalted)``); the reader shows one name.
|
||||
|
||||
The glossary pass would otherwise translate the English half too and print
|
||||
``入旺(入旺)``. Anything not in that shape passes through unchanged.
|
||||
"""
|
||||
text = str(value or '').strip()
|
||||
match = re.fullmatch(r'([^()()]+?)\s*[((][A-Za-z][A-Za-z \-]*[))]', text)
|
||||
return match.group(1).strip() if match else text
|
||||
|
||||
|
||||
def _pl9_report_language(packet: dict) -> str:
|
||||
language = str((packet or {}).get('report_language') or '').strip().lower()
|
||||
return language if language in {'zh', 'en'} else 'zh'
|
||||
@@ -327,7 +338,7 @@ def _strip_pl9_user_engineering_markers(markdown: str) -> str:
|
||||
text = text.replace("Results of Muntha in the Sign of a Graha", "Muntha 落入行星星座的结果")
|
||||
text = text.replace("Results of Munthesh", "Munthesh 结果")
|
||||
text = text.replace("Results of Muntha", "Muntha 结果")
|
||||
text = text.replace("field_状态", "字段状态")
|
||||
text = text.replace("field_状态", "状态")
|
||||
text = text.replace("Dasha", "大运")
|
||||
text = re.sub(r"(?<=[\u4e00-\u9fff])\s+大运", "大运", text)
|
||||
text = re.sub(r"大运\s+(?=[\u4e00-\u9fff])", "大运", text)
|
||||
@@ -735,7 +746,7 @@ def render_pl9_parity_markdown(packet: dict) -> str:
|
||||
birth_extra = _list(source_visible.get('birth_particulars_extra'))
|
||||
if birth_extra:
|
||||
lines.extend([
|
||||
'#### p3 Birth Particulars 原版补充字段',
|
||||
'#### p3 出生资料补充',
|
||||
'',
|
||||
'| Field | Value |',
|
||||
'|-------|-------|',
|
||||
@@ -781,10 +792,10 @@ def render_pl9_parity_markdown(packet: dict) -> str:
|
||||
)
|
||||
lines.append('')
|
||||
lines.extend([
|
||||
'#### p6 Birth Chart 星主与状态字段',
|
||||
'#### p6 行星主星与状态',
|
||||
'',
|
||||
'| Planet | RL | NL | SL | SS | Status | SB |',
|
||||
'|--------|----|----|----|----|--------|----|',
|
||||
'| 行星 | 星座主 | 星宿主 | 分主 | 分分主 | 尊贵状态 | 力量比 |',
|
||||
'|------|--------|--------|------|--------|----------|--------|',
|
||||
])
|
||||
for planet in ('Sun', 'Moon', 'Mars', 'Mercury', 'Jupiter', 'Venus', 'Saturn', 'Rahu', 'Ketu'):
|
||||
row = _dict(planets.get(planet))
|
||||
@@ -793,9 +804,13 @@ def render_pl9_parity_markdown(packet: dict) -> str:
|
||||
lines.append(
|
||||
f"| {_cell(_token(planet))} | {_cell(_token(row.get('rasi_lord')))} | "
|
||||
f"{_cell(_token(row.get('nakshatra_lord')))} | {_cell(_token(row.get('sub_lord')))} | "
|
||||
f"{_cell(_token(row.get('sub_sub_lord')))} | {_cell(row.get('status'))} | {_cell(_num(row.get('sb'), 2))} |"
|
||||
f"{_cell(_token(row.get('sub_sub_lord')))} | {_cell(_dignity_label(row.get('status')))} | {_cell(_num(row.get('sb'), 2))} |"
|
||||
)
|
||||
lines.append('')
|
||||
lines.extend([
|
||||
'',
|
||||
'星座主、星宿主、分主、分分主:这颗行星所在星座、星宿与 KP 细分各自的主星。力量比:六维力量与所需力量之比,1 以上为达标。',
|
||||
'',
|
||||
])
|
||||
moon_chart = d1_sheet.get('moon_chart') if isinstance(d1_sheet.get('moon_chart'), dict) else {}
|
||||
bhava = d1_sheet.get('bhava_chalit') if isinstance(d1_sheet.get('bhava_chalit'), dict) else {}
|
||||
sudarshana = divisional.get('sudarshana') if isinstance(divisional.get('sudarshana'), dict) else {}
|
||||
@@ -919,7 +934,7 @@ def render_pl9_parity_markdown(packet: dict) -> str:
|
||||
source_special_points = _list(source_visible.get('source_special_points'))
|
||||
if source_special_points:
|
||||
lines.extend([
|
||||
'#### p17 Special Lagnas and Points 原版补充字段',
|
||||
'#### p17 特殊上升与派生点补充',
|
||||
'',
|
||||
'| Point | Value |',
|
||||
'|-------|-------|',
|
||||
@@ -2352,7 +2367,7 @@ def render_pl9_parity_markdown(packet: dict) -> str:
|
||||
placement = f"{_token(lord_row.get('sign'))} H{lord_row.get('house') or '-'} {_degree(lord_row.get('degree_in_sign'))}"
|
||||
lines.append(
|
||||
f"| {index} | {_cell(_token(house.get('cusp_sign') or house.get('sign')))} | {_cell(_token(lord))} | "
|
||||
f"{_cell(placement)} | {_cell(lord_row.get('status') or lord_row.get('dignity'))} | {_cell('active' if str(lord) in active_lords else 'background')} |"
|
||||
f"{_cell(placement)} | {_cell(_dignity_label(lord_row.get('status') or lord_row.get('dignity')))} | {_cell('active' if str(lord) in active_lords else 'background')} |"
|
||||
)
|
||||
lines.append('')
|
||||
bhavesh_pages = _list(bhavesh_pack.get('pages'))
|
||||
|
||||
Reference in New Issue
Block a user