Coverage for app/routes/docs.py: 74%
23 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-05-02 02:49 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-05-02 02:49 +0000
1from flask import Blueprint, send_from_directory
2import os
4docs_bp = Blueprint('docs', __name__)
6docs_path = os.path.join(os.getcwd(), 'docs/build/html')
7tsdocs_path = os.path.join(os.getcwd(), 'docs/tsdoc')
9@docs_bp.route('/docs/<path:filename>')
10def serve_docs(filename):
11 """
12 Serves the Sphinx-generated HTML documentation.
13 """
14 return send_from_directory(docs_path, filename)
16@docs_bp.route('/docs/')
17def docs_index():
18 """
19 Redirects to the main documentation page.
20 """
21 return send_from_directory(docs_path, "index.html")
23@docs_bp.route('/docs/_static/<path:filename>')
24def serve_static(filename):
25 """
26 Serves static assets for Sphinx documentation
27 """
28 return send_from_directory(os.path.join(docs_path, '_static'), filename)
30@docs_bp.route('/tsdocs/<path:filename>')
31def serve_tsdocs(filename):
32 """
33 Serves the TypeDoc-generated HTML documentation.
34 """
35 return send_from_directory(tsdocs_path, filename)
37@docs_bp.route('/tsdocs/')
38def docs_tsindex():
39 """
40 Redirects to the main TypeDoc documentation page.
41 """
42 return send_from_directory(tsdocs_path, "index.html")
44@docs_bp.route('/tsdocs/assets/<path:filename>')
45def serve_tsstatic(filename):
46 """
47 Serves static assets for TypeDoc documentation
48 """
49 return send_from_directory(os.path.join(tsdocs_path, 'assets'), filename)