PagerMaid-Pyro/pagermaid/web/html/__init__.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
652 B
Python
Raw Normal View History

2023-01-31 16:24:56 +00:00
from pathlib import Path
html_base_path = Path(__file__).parent
def get_html(path: Path) -> str:
"""获取 HTML 模板。"""
2023-03-12 03:56:01 +00:00
with open(path, "r", encoding="utf-8") as f:
2023-01-31 16:24:56 +00:00
return f.read()
def get_logo() -> str:
"""获取 logo。"""
2023-03-12 03:56:01 +00:00
return get_html(html_base_path / "logo.html")
2023-01-31 16:24:56 +00:00
def get_github_logo() -> str:
"""获取 github logo。"""
2023-03-12 03:56:01 +00:00
return get_html(html_base_path / "github_logo.html")
2023-01-31 16:24:56 +00:00
def get_footer() -> str:
"""获取 footer。"""
2023-03-12 03:56:01 +00:00
return get_html(html_base_path / "footer.html")
def get_web_login_html() -> str:
"""获取 web login。"""
return get_html(html_base_path / "web_login.html")