classic.py 1.1 KB

1234567891011121314151617181920212223242526272829
  1. # -*- coding: utf-8 -*-
  2. r"""经典页模板(P5,2026-09-28:从 `app_backEnd/.../serve.py` 抽出)。
  3. 抽出前后**逐字节一致**:本模块只读文件,不做任何替换/改写;占位符(`%CSS%` `%JS%` `%T%` `%SYS%`)
  4. 仍由调用方(serve.py 的路由)替换。
  5. * `assets/classic_chart.js` —— 经典页的图表库与页面脚本(CHART_JS)
  6. * `pages/classic_fleet.html` / `classic_problem.html` / `classic_turbine.html` —— 三张经典页外壳
  7. """
  8. from __future__ import annotations
  9. import pathlib
  10. _HERE = pathlib.Path(__file__).resolve().parent
  11. _ASSETS = _HERE.parent / 'assets'
  12. def _read(p: pathlib.Path) -> str:
  13. """`newline=''` ⇒ 不做换行翻译(模板按字节保真,与抽出前一致)。"""
  14. with open(p, encoding='utf-8', newline='') as f:
  15. return f.read()
  16. CHART_JS = _read(_ASSETS / 'classic_chart.js')
  17. PAGE_FLEET = _read(_HERE / 'classic_fleet.html')
  18. PAGE_PROBLEM = _read(_HERE / 'classic_problem.html')
  19. PAGE_TURBINE = _read(_HERE / 'classic_turbine.html')
  20. __all__ = ['CHART_JS', 'PAGE_FLEET', 'PAGE_PROBLEM', 'PAGE_TURBINE']