mohtat-sphinx-theme 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,190 @@
1
+ """Custom Sphinx theme package: mohtat-sphinx-theme."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from pathlib import Path
7
+ from typing import Any
8
+
9
+ from docutils import nodes
10
+ from docutils.parsers.rst import directives
11
+ from sphinx.application import Sphinx
12
+ from sphinx.util.docutils import SphinxDirective
13
+
14
+ __version__ = "0.1.0"
15
+
16
+ THEME_DIR = Path(__file__).resolve().parent
17
+
18
+
19
+ def get_html_theme_path() -> str:
20
+ """Return the filesystem path containing the Sphinx theme."""
21
+ return str(THEME_DIR)
22
+
23
+
24
+ class TabBarNode(nodes.General, nodes.Element):
25
+ """Docutils node representing an interactive tab bar group."""
26
+
27
+
28
+ class TabItemNode(nodes.General, nodes.Element):
29
+ """Docutils node representing a single tab item with an icon and panel."""
30
+
31
+
32
+ class TabBarDirective(SphinxDirective):
33
+ """Render a responsive tab bar container with sherullah.png tab icons."""
34
+
35
+ has_content = True
36
+ optional_arguments = 1
37
+ option_spec = {
38
+ "class": directives.class_option,
39
+ }
40
+
41
+ def run(self) -> list[nodes.Node]:
42
+ self.assert_has_content()
43
+ extra_classes = self.options.get("class", [])
44
+ container = TabBarNode(classes=["mht-tabs", *extra_classes])
45
+ self.state.nested_parse(self.content, self.content_offset, container)
46
+ return [container]
47
+
48
+
49
+ class TabItemDirective(SphinxDirective):
50
+ """Render a single tab item inside a ``.. tab-bar::`` container."""
51
+
52
+ required_arguments = 1
53
+ final_argument_whitespace = True
54
+ has_content = True
55
+ option_spec = {
56
+ "icon": directives.unchanged,
57
+ "selected": directives.flag,
58
+ }
59
+
60
+ def run(self) -> list[nodes.Node]:
61
+ self.assert_has_content()
62
+ title = self.arguments[0]
63
+ icon = self.options.get("icon", "sherullah.png").strip() or "sherullah.png"
64
+ selected = "selected" in self.options
65
+
66
+ item = TabItemNode(
67
+ tab_title=title,
68
+ tab_icon=icon,
69
+ tab_selected=selected,
70
+ )
71
+ self.state.nested_parse(self.content, self.content_offset, item)
72
+ return [item]
73
+
74
+
75
+ def _resolve_static_icon_src(translator: Any, icon_name: str) -> str:
76
+ """Resolve an icon asset path relative to the current HTML document."""
77
+ if icon_name.startswith(("http://", "https://", "/")):
78
+ return icon_name
79
+ builder = getattr(translator, "builder", None)
80
+ docname = getattr(translator, "docname", None) or getattr(builder, "current_docname", None)
81
+ if builder is not None and docname is not None:
82
+ rel_root = builder.get_relative_uri(docname, "index")
83
+ prefix = rel_root[: -len("index.html")] if rel_root.endswith("index.html") else ""
84
+ return f"{prefix}_static/{icon_name.lstrip('/')}"
85
+ return f"_static/{icon_name.lstrip('/')}"
86
+
87
+
88
+ def _visit_tab_bar_html(translator: Any, node: TabBarNode) -> None:
89
+ classes = " ".join(node.get("classes", ["mht-tabs"]))
90
+ translator.body.append(f'<div class="{classes}" data-mht-tabs>\n')
91
+ translator.body.append('<div class="mht-tabs-nav" role="tablist">\n')
92
+
93
+ tab_items = [child for child in node.children if isinstance(child, TabItemNode)]
94
+ has_explicit_selected = any(child.get("tab_selected") for child in tab_items)
95
+
96
+ for idx, child in enumerate(tab_items):
97
+ is_active = bool(child.get("tab_selected")) or (not has_explicit_selected and idx == 0)
98
+ child["tab_is_active"] = is_active
99
+ child["tab_index"] = idx
100
+ title = translator.encode(child.get("tab_title", f"Tab {idx + 1}"))
101
+ icon_src = translator.encode(_resolve_static_icon_src(translator, child.get("tab_icon", "sherullah.png")))
102
+ active_cls = " is-active" if is_active else ""
103
+ aria_sel = "true" if is_active else "false"
104
+ translator.body.append(
105
+ f'<button type="button" class="mht-tab-btn{active_cls}" role="tab" '
106
+ f'aria-selected="{aria_sel}" data-tab-index="{idx}">'
107
+ f'<img class="mht-tab-icon" src="{icon_src}" alt="" width="16" height="16" loading="lazy">'
108
+ f'<span class="mht-tab-label">{title}</span>'
109
+ f"</button>\n"
110
+ )
111
+
112
+ translator.body.append("</div>\n")
113
+ translator.body.append('<div class="mht-tabs-panels">\n')
114
+
115
+
116
+ def _depart_tab_bar_html(translator: Any, node: TabBarNode) -> None:
117
+ translator.body.append("</div>\n</div>\n")
118
+
119
+
120
+ def _visit_tab_item_html(translator: Any, node: TabItemNode) -> None:
121
+ idx = node.get("tab_index", 0)
122
+ is_active = bool(node.get("tab_is_active", idx == 0))
123
+ active_cls = " is-active" if is_active else ""
124
+ hidden_attr = "" if is_active else " hidden"
125
+ translator.body.append(
126
+ f'<div class="mht-tab-panel{active_cls}" role="tabpanel" '
127
+ f'data-tab-panel="{idx}"{hidden_attr}>\n'
128
+ )
129
+
130
+
131
+ def _depart_tab_item_html(translator: Any, node: TabItemNode) -> None:
132
+ translator.body.append("</div>\n")
133
+
134
+
135
+ def _parse_tab_bar_items(raw_items: Any) -> list[dict[str, str]]:
136
+ """Normalize ``theme_tab_bar_items`` from a list or JSON string."""
137
+ if not raw_items:
138
+ return []
139
+ if isinstance(raw_items, str):
140
+ try:
141
+ parsed = json.loads(raw_items)
142
+ except json.JSONDecodeError:
143
+ return []
144
+ elif isinstance(raw_items, (list, tuple)):
145
+ parsed = list(raw_items)
146
+ else:
147
+ return []
148
+
149
+ normalized: list[dict[str, str]] = []
150
+ for entry in parsed:
151
+ if isinstance(entry, dict) and "title" in entry and "url" in entry:
152
+ normalized.append(
153
+ {
154
+ "title": str(entry["title"]),
155
+ "url": str(entry["url"]),
156
+ "icon": str(entry.get("icon") or ""),
157
+ }
158
+ )
159
+ return normalized
160
+
161
+
162
+ def _inject_html_context(
163
+ app: Sphinx,
164
+ pagename: str,
165
+ templatename: str,
166
+ context: dict[str, Any],
167
+ doctree: Any,
168
+ ) -> None:
169
+ """Populate helper context variables used by Jinja2 templates."""
170
+ theme_options = getattr(app.config, "html_theme_options", {}) or {}
171
+ raw_items = theme_options.get("tab_bar_items") or context.get("theme_tab_bar_items")
172
+ context["mht_tab_bar_items"] = _parse_tab_bar_items(raw_items)
173
+ context["mht_theme_version"] = __version__
174
+
175
+
176
+ def setup(app: Sphinx) -> dict[str, Any]:
177
+ """Register ``mohtat-sphinx-theme``, custom tab directives, and template context."""
178
+ app.add_html_theme("mohtat-sphinx-theme", str(THEME_DIR))
179
+ app.add_html_theme("mohtat_sphinx_theme", str(THEME_DIR))
180
+ app.add_node(TabBarNode, html=(_visit_tab_bar_html, _depart_tab_bar_html))
181
+ app.add_node(TabItemNode, html=(_visit_tab_item_html, _depart_tab_item_html))
182
+ app.add_directive("tab-bar", TabBarDirective)
183
+ app.add_directive("tab-item", TabItemDirective)
184
+ app.connect("html-page-context", _inject_html_context)
185
+
186
+ return {
187
+ "version": __version__,
188
+ "parallel_read_safe": True,
189
+ "parallel_write_safe": True,
190
+ }
@@ -0,0 +1,37 @@
1
+ {% extends "layout.html" %}
2
+
3
+ {% block body %}
4
+ <h1>{{ indextitle }}</h1>
5
+
6
+ <div class="domainindex-jumpbox">
7
+ {% for (letter, entries) in content %}
8
+ <a href="#cap-{{ letter }}"><strong>{{ letter }}</strong></a>
9
+ {%- if not loop.last %} | {% endif -%}
10
+ {% endfor %}
11
+ </div>
12
+
13
+ <table class="indextable modindextable">
14
+ {% for letter, entries in content %}
15
+ <tr class="pcap"><td></td><td>&#160;</td><td></td></tr>
16
+ <tr class="cap" id="cap-{{ letter }}">
17
+ <td></td>
18
+ <td><strong>{{ letter }}</strong></td>
19
+ <td></td>
20
+ </tr>
21
+ {% for (name, grouptype, page, anchor, extra, qualifier, description) in entries %}
22
+ <tr{% if grouptype == 2 %} class="cg-{{ loop.index }}"{% endif %}>
23
+ <td></td>
24
+ <td>
25
+ {% if page %}
26
+ <a href="{{ pathto(page) }}#{{ anchor }}"><code class="xref">{{ name|e }}</code></a>
27
+ {% else %}
28
+ <strong>{{ name|e }}</strong>
29
+ {% endif %}
30
+ {% if extra %}<em>({{ extra|e }})</em>{% endif %}
31
+ </td>
32
+ <td>{% if qualifier %}<strong>{{ qualifier|e }}:</strong> {% endif %}{{ description|e }}</td>
33
+ </tr>
34
+ {% endfor %}
35
+ {% endfor %}
36
+ </table>
37
+ {% endblock %}
@@ -0,0 +1,51 @@
1
+ {% extends "layout.html" %}
2
+
3
+ {% set title = _('Index') %}
4
+
5
+ {% block body %}
6
+ <h1 id="index">{{ _('Index') }}</h1>
7
+
8
+ <div class="genindex-jumpbox">
9
+ {% for key, dummy in genindexentries %}
10
+ <a href="#{{ key }}"><strong>{{ key }}</strong></a>
11
+ {%- if not loop.last %} | {% endif -%}
12
+ {% endfor %}
13
+ </div>
14
+
15
+ {% for key, entries in genindexentries %}
16
+ <h2 id="{{ key }}">{{ key }}</h2>
17
+ <table class="indextable genindextable">
18
+ <tr>
19
+ {% for column in entries|slice(2) %}
20
+ <td>
21
+ <ul>
22
+ {% for entryname, (links, subitems, _) in column %}
23
+ <li>
24
+ {% if links %}
25
+ <a href="{{ links[0][1] }}">{{ entryname|e }}</a>
26
+ {% for ismain, link in links[1:] %}, <a href="{{ link }}">[{{ loop.index }}]</a>{% endfor %}
27
+ {% else %}
28
+ {{ entryname|e }}
29
+ {% endif %}
30
+ {% if subitems %}
31
+ <ul>
32
+ {% for subentryname, sublinks in subitems %}
33
+ <li>
34
+ {% if sublinks %}
35
+ <a href="{{ sublinks[0][1] }}">{{ subentryname|e }}</a>
36
+ {% else %}
37
+ {{ subentryname|e }}
38
+ {% endif %}
39
+ </li>
40
+ {% endfor %}
41
+ </ul>
42
+ {% endif %}
43
+ </li>
44
+ {% endfor %}
45
+ </ul>
46
+ </td>
47
+ {% endfor %}
48
+ </tr>
49
+ </table>
50
+ {% endfor %}
51
+ {% endblock %}
@@ -0,0 +1,134 @@
1
+ {%- set _theme_mode_default = theme_default_theme_mode|default('auto', true) -%}
2
+ {%- set _tab_icon = theme_tab_bar_icon|default('sherullah.png', true) -%}
3
+ {%- set _icon_href = pathto('_static/' ~ _tab_icon, 1) -%}
4
+ {%- set _show_topbar = theme_show_topbar|default('true', true)|string|lower not in ['false', '0', 'no'] -%}
5
+ {%- set _show_tab_bar = theme_show_tab_bar|default('true', true)|string|lower not in ['false', '0', 'no'] -%}
6
+ {%- set _show_prev_next = theme_show_prev_next|default('true', true)|string|lower not in ['false', '0', 'no'] -%}
7
+ {%- set _show_toc = theme_show_toc|default('true', true)|string|lower not in ['false', '0', 'no'] -%}
8
+ {%- set _show_search = theme_show_search|default('true', true)|string|lower not in ['false', '0', 'no'] -%}
9
+ {%- set _show_fullscreen = theme_show_fullscreen_button|default('true', true)|string|lower not in ['false', '0', 'no'] -%}
10
+ {%- set _show_theme_toggle = theme_show_theme_toggle|default('true', true)|string|lower not in ['false', '0', 'no'] -%}
11
+ {%- set _has_right_toc = _show_toc and display_toc and toc and ('<a ' in toc) -%}
12
+ <!doctype html>
13
+ <html lang="{{ language or 'en' }}" data-theme="light" data-theme-mode="{{ _theme_mode_default }}">
14
+ <head>
15
+ <meta charset="utf-8">
16
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
17
+ <meta name="color-scheme" content="light dark">
18
+ <meta name="mht-search-index" content="{{ pathto('searchindex.js', 1) }}">
19
+ <meta name="mht-search-page" content="{{ pathto('search') }}">
20
+ <meta name="mht-root" content="{{ pathto('index') }}">
21
+ <meta name="mht-default-mode" content="{{ _theme_mode_default }}">
22
+ {{ metatags }}
23
+ <title>{% block htmltitle %}{{ title|striptags|e }}{% if docstitle %} — {{ docstitle|striptags|e }}{% endif %}{% endblock %}</title>
24
+
25
+ {%- if favicon_url %}
26
+ <link rel="icon" href="{{ favicon_url }}">
27
+ {%- else %}
28
+ <link rel="icon" type="image/png" href="{{ _icon_href }}">
29
+ <link rel="shortcut icon" type="image/png" href="{{ _icon_href }}">
30
+ <link rel="apple-touch-icon" href="{{ _icon_href }}">
31
+ {%- endif %}
32
+
33
+ <script>
34
+ (function () {
35
+ try {
36
+ var stored = localStorage.getItem('mohtat-theme-mode');
37
+ var mode = stored || {{ _theme_mode_default|tojson }};
38
+ if (mode !== 'light' && mode !== 'dark' && mode !== 'auto') mode = 'auto';
39
+ var resolved = mode;
40
+ if (mode === 'auto') {
41
+ resolved = (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) ? 'dark' : 'light';
42
+ }
43
+ document.documentElement.setAttribute('data-theme', resolved);
44
+ document.documentElement.setAttribute('data-theme-mode', mode);
45
+ if (localStorage.getItem('mohtat-sidebar-collapsed') === 'true') {
46
+ document.documentElement.classList.add('mht-sidebar-is-collapsed');
47
+ }
48
+ } catch (e) {}
49
+ })();
50
+ </script>
51
+
52
+ <link rel="stylesheet" href="{{ pathto('_static/css/tokens.css', 1) }}">
53
+ <link rel="stylesheet" href="{{ pathto('_static/css/layout.css', 1) }}">
54
+ <link rel="stylesheet" href="{{ pathto('_static/css/components.css', 1) }}">
55
+ <link rel="stylesheet" href="{{ pathto('_static/css/content.css', 1) }}">
56
+ <link rel="stylesheet" href="{{ pathto('_static/css/pygments.css', 1) }}">
57
+ {%- for css in css_files %}
58
+ {%- if css.filename and css.filename != 'css/theme.css' %}
59
+ {%- if css_tag is defined %}
60
+ {{ css_tag(css) }}
61
+ {%- else %}
62
+ <link rel="stylesheet" href="{{ pathto(css.filename, 1) }}">
63
+ {%- endif %}
64
+ {%- endif %}
65
+ {%- endfor %}
66
+
67
+ {%- if theme_accent_color or theme_content_max_width %}
68
+ <style>
69
+ :root {
70
+ {%- if theme_accent_color %}
71
+ --mht-accent: {{ theme_accent_color }};
72
+ {%- endif %}
73
+ {%- if theme_content_max_width %}
74
+ --mht-content-max-width: {{ theme_content_max_width }};
75
+ {%- endif %}
76
+ }
77
+ </style>
78
+ {%- endif %}
79
+
80
+ {%- block extrahead %}{% endblock %}
81
+ </head>
82
+ <body class="mht-body{% if not _show_topbar %} mht-no-topbar{% endif %}{% if not _has_right_toc %} mht-no-right-toc{% endif %}">
83
+ <a class="mht-skip-link" href="#mht-main-content">Skip to main content</a>
84
+
85
+ {%- if _show_topbar %}
86
+ {% include "partials/topbar.html" %}
87
+ {%- endif %}
88
+
89
+ <div class="mht-shell" id="mht-shell">
90
+ {% include "partials/left_sidebar.html" %}
91
+
92
+ <div class="mht-main-column">
93
+ {% include "partials/toolbar.html" %}
94
+
95
+ <main id="mht-main-content" class="mht-main" tabindex="-1">
96
+ <div class="mht-article-container">
97
+ <article class="mht-article" role="main">
98
+ {% block body %}{% endblock %}
99
+ </article>
100
+
101
+ {%- if _show_prev_next and (prev or next) %}
102
+ {% include "partials/prev_next.html" %}
103
+ {%- endif %}
104
+ </div>
105
+
106
+ {% include "partials/footer.html" %}
107
+ </main>
108
+ </div>
109
+
110
+ {%- if _has_right_toc %}
111
+ {% include "partials/right_sidebar.html" %}
112
+ {%- endif %}
113
+ </div>
114
+
115
+ <div class="mht-backdrop" id="mht-backdrop" aria-hidden="true"></div>
116
+
117
+ {%- if _show_search %}
118
+ {% include "partials/search_modal.html" %}
119
+ {%- endif %}
120
+
121
+ {%- set _skip_basic_js = ['_static/documentation_options.js', '_static/doctools.js', '_static/sphinx_highlight.js', '_static/searchtools.js', '_static/language_data.js'] -%}
122
+ {%- for js in script_files %}
123
+ {%- if js.filename and (js.filename not in _skip_basic_js) %}
124
+ {%- if js_tag is defined %}
125
+ {{ js_tag(js) }}
126
+ {%- else %}
127
+ <script src="{{ pathto(js.filename, 1) }}"></script>
128
+ {%- endif %}
129
+ {%- endif %}
130
+ {%- endfor %}
131
+ <script src="{{ pathto('_static/js/theme.js', 1) }}" defer></script>
132
+ {%- block scripts %}{% endblock %}
133
+ </body>
134
+ </html>
@@ -0,0 +1,5 @@
1
+ {% extends "layout.html" %}
2
+
3
+ {% block body %}
4
+ {{ body }}
5
+ {% endblock %}
@@ -0,0 +1,14 @@
1
+ {%- set _footer_author = theme_footer_author|default('', true) or author -%}
2
+ <footer class="mht-footer" role="contentinfo">
3
+ <div class="mht-footer-inner">
4
+ {%- if _footer_author %}
5
+ <span class="mht-footer-author">By {{ _footer_author|e }}</span>
6
+ {%- endif %}
7
+ {%- if show_copyright and copyright %}
8
+ <span class="mht-footer-copyright">© Copyright {{ copyright|e }}.</span>
9
+ {%- endif %}
10
+ {%- if last_updated %}
11
+ <span class="mht-footer-updated">{{ _('Last updated on %(last_updated)s.', last_updated=last_updated|e) }}</span>
12
+ {%- endif %}
13
+ </div>
14
+ </footer>
@@ -0,0 +1,53 @@
1
+ {%- set _toctree_html = toctree(maxdepth=4, collapse=False, includehidden=True, titles_only=True) -%}
2
+ <aside class="mht-left-sidebar" id="mht-left-sidebar" aria-label="{{ _('Documentation navigation') }}">
3
+ <div class="mht-left-sidebar-inner">
4
+ <div class="mht-drawer-header">
5
+ <span class="mht-drawer-title">{{ project }}</span>
6
+ <button type="button" class="mht-icon-btn mht-drawer-close" data-mht-close-drawers aria-label="{{ _('Close navigation') }}">
7
+ <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true">
8
+ <line x1="18" y1="6" x2="6" y2="18"></line>
9
+ <line x1="6" y1="6" x2="18" y2="18"></line>
10
+ </svg>
11
+ </button>
12
+ </div>
13
+
14
+ {%- if _show_search %}
15
+ <div class="mht-sidebar-search">
16
+ <button type="button" class="mht-search-pill" data-mht-open-search aria-label="{{ _('Search documentation (Command+K)') }}">
17
+ <span class="mht-search-pill-left">
18
+ <svg class="mht-search-pill-icon" viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
19
+ <circle cx="11" cy="11" r="7"></circle>
20
+ <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
21
+ </svg>
22
+ <span class="mht-search-pill-text">{{ theme_search_placeholder|default('Search', true) }}</span>
23
+ </span>
24
+ <span class="mht-kbd-combo" aria-hidden="true">
25
+ <kbd class="mht-kbd" data-mht-mod-key>⌘</kbd>
26
+ <span class="mht-kbd-plus">+</span>
27
+ <kbd class="mht-kbd">K</kbd>
28
+ </span>
29
+ </button>
30
+ </div>
31
+ {%- endif %}
32
+
33
+ <nav class="mht-nav-tree" id="mht-nav-tree" aria-label="{{ _('Main navigation') }}">
34
+ {%- if _toctree_html and ('class="caption"' not in _toctree_html) %}
35
+ {%- if theme_sidebar_caption %}
36
+ <p class="caption" role="heading" aria-level="2"><span class="caption-text">{{ theme_sidebar_caption }}</span></p>
37
+ {%- else %}
38
+ <p class="caption" role="heading" aria-level="2"><span class="caption-text">{{ project }}</span></p>
39
+ {%- endif %}
40
+ {%- endif %}
41
+
42
+ {%- if _toctree_html %}
43
+ {{ _toctree_html }}
44
+ {%- else %}
45
+ <ul>
46
+ <li class="toctree-l1 current">
47
+ <a class="reference internal current" href="{{ pathto('index') }}">{{ project }}</a>
48
+ </li>
49
+ </ul>
50
+ {%- endif %}
51
+ </nav>
52
+ </div>
53
+ </aside>
@@ -0,0 +1,29 @@
1
+ <nav class="mht-prev-next{% if not prev %} mht-only-next{% elif not next %} mht-only-prev{% endif %}" aria-label="{{ _('Page navigation') }}">
2
+ {%- if prev %}
3
+ <a class="mht-pn-card mht-pn-prev" href="{{ prev.link|e }}" rel="prev">
4
+ <span class="mht-pn-chevron" aria-hidden="true">
5
+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
6
+ <polyline points="15 18 9 12 15 6"></polyline>
7
+ </svg>
8
+ </span>
9
+ <span class="mht-pn-meta">
10
+ <span class="mht-pn-label">{{ _('Previous') }}</span>
11
+ <span class="mht-pn-title">{{ prev.title }}</span>
12
+ </span>
13
+ </a>
14
+ {%- endif %}
15
+
16
+ {%- if next %}
17
+ <a class="mht-pn-card mht-pn-next" href="{{ next.link|e }}" rel="next">
18
+ <span class="mht-pn-meta">
19
+ <span class="mht-pn-label">{{ _('Next') }}</span>
20
+ <span class="mht-pn-title">{{ next.title }}</span>
21
+ </span>
22
+ <span class="mht-pn-chevron" aria-hidden="true">
23
+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
24
+ <polyline points="9 18 15 12 9 6"></polyline>
25
+ </svg>
26
+ </span>
27
+ </a>
28
+ {%- endif %}
29
+ </nav>
@@ -0,0 +1,27 @@
1
+ <aside class="mht-right-sidebar" id="mht-right-sidebar" aria-label="{{ _('On this page') }}">
2
+ <div class="mht-right-sidebar-inner">
3
+ <div class="mht-toc-header">
4
+ <div class="mht-toc-title-row">
5
+ <svg class="mht-toc-title-icon" viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true">
6
+ <line x1="8" y1="6" x2="21" y2="6"></line>
7
+ <line x1="8" y1="12" x2="21" y2="12"></line>
8
+ <line x1="8" y1="18" x2="21" y2="18"></line>
9
+ <circle cx="3.5" cy="6" r="1" fill="currentColor" stroke="none"></circle>
10
+ <circle cx="3.5" cy="12" r="1" fill="currentColor" stroke="none"></circle>
11
+ <circle cx="3.5" cy="18" r="1" fill="currentColor" stroke="none"></circle>
12
+ </svg>
13
+ <span class="mht-toc-title-text">{{ theme_toc_title|default('Contents', true) }}</span>
14
+ </div>
15
+ <button type="button" class="mht-icon-btn mht-drawer-close" data-mht-close-drawers aria-label="{{ _('Close contents') }}">
16
+ <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true">
17
+ <line x1="18" y1="6" x2="6" y2="18"></line>
18
+ <line x1="6" y1="6" x2="18" y2="18"></line>
19
+ </svg>
20
+ </button>
21
+ </div>
22
+
23
+ <nav class="mht-toc-nav" id="mht-toc-nav" aria-label="{{ _('Table of contents') }}">
24
+ {{ toc }}
25
+ </nav>
26
+ </div>
27
+ </aside>
@@ -0,0 +1,28 @@
1
+ <div class="mht-search-modal" id="mht-search-modal" role="dialog" aria-modal="true" aria-labelledby="mht-search-modal-label" hidden>
2
+ <div class="mht-search-modal-backdrop" data-mht-close-search></div>
3
+ <div class="mht-search-modal-dialog">
4
+ <span id="mht-search-modal-label" class="mht-sr-only">{{ _('Search documentation') }}</span>
5
+ <form class="mht-search-modal-form" id="mht-search-modal-form" action="{{ pathto('search') }}" method="get" role="search">
6
+ <div class="mht-search-modal-input-row">
7
+ <svg class="mht-search-modal-icon" viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
8
+ <circle cx="11" cy="11" r="7"></circle>
9
+ <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
10
+ </svg>
11
+ <input type="search"
12
+ name="q"
13
+ id="mht-search-modal-input"
14
+ class="mht-search-modal-input"
15
+ placeholder="{{ theme_search_placeholder|default('Search', true) }}..."
16
+ autocomplete="off"
17
+ aria-label="{{ _('Search documentation') }}">
18
+ <span class="mht-kbd-combo mht-search-modal-kbd" aria-hidden="true">
19
+ <kbd class="mht-kbd" data-mht-mod-key>⌘</kbd>
20
+ <span class="mht-kbd-plus">+</span>
21
+ <kbd class="mht-kbd">K</kbd>
22
+ </span>
23
+ </div>
24
+ </form>
25
+
26
+ <div class="mht-search-modal-results" id="mht-search-modal-results" hidden></div>
27
+ </div>
28
+ </div>
@@ -0,0 +1,28 @@
1
+ {%- set _default_tabs = [
2
+ {'title': 'Home', 'url': 'index', 'icon': _tab_icon},
3
+ {'title': 'Search', 'url': 'search', 'icon': _tab_icon}
4
+ ] -%}
5
+ {%- set _tabs = mht_tab_bar_items if mht_tab_bar_items else _default_tabs -%}
6
+ <nav class="mht-tabbar" aria-label="{{ _('Primary tab bar') }}">
7
+ <ul class="mht-tabbar-list">
8
+ {%- for item in _tabs %}
9
+ {%- set _raw_url = item.url -%}
10
+ {%- set _is_external = _raw_url.startswith('http://') or _raw_url.startswith('https://') or _raw_url.startswith('#') -%}
11
+ {%- set _href = _raw_url if _is_external else pathto(_raw_url) -%}
12
+ {%- set _clean_target = _raw_url.rstrip('/') -%}
13
+ {%- set _folder_prefix = _clean_target[:-6] if _clean_target.endswith('/index') else '' -%}
14
+ {%- set _is_active = (not _is_external) and (pagename == _clean_target or (_folder_prefix and pagename.startswith(_folder_prefix ~ '/'))) -%}
15
+ {%- set _item_icon = item.icon or _tab_icon -%}
16
+ {%- set _item_icon_src = _item_icon if _item_icon.startswith(('http://', 'https://', '/')) else pathto('_static/' ~ _item_icon, 1) -%}
17
+ <li class="mht-tabbar-item">
18
+ <a class="mht-tabbar-link{% if _is_active %} is-active{% endif %}"
19
+ href="{{ _href }}"
20
+ {% if _is_active %}aria-current="page"{% endif %}
21
+ {% if _is_external and _raw_url.startswith('http') %}target="_blank" rel="noopener noreferrer"{% endif %}>
22
+ <img class="mht-tabbar-icon" src="{{ _item_icon_src }}" alt="" width="18" height="18">
23
+ <span class="mht-tabbar-label">{{ item.title }}</span>
24
+ </a>
25
+ </li>
26
+ {%- endfor %}
27
+ </ul>
28
+ </nav>