Skip to content

Commit 5ef80d4

Browse files
authored
Merge pull request #7 from Spill-Tea/multiversion_docs
Multiversion docs
2 parents 04583c3 + d599ab3 commit 5ef80d4

10 files changed

Lines changed: 478 additions & 13 deletions

File tree

.github/workflows/build-docs.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Build Docs
2+
3+
on:
4+
push:
5+
branches: [ main, dev ]
6+
tags: [ v* ]
7+
8+
jobs:
9+
deploy-docs:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
strategy:
14+
fail-fast: false
15+
16+
steps:
17+
- name: Checkout PyTemplate Project
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version-file: .python-version-default
26+
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install -U pip
30+
pip install wheel setuptools
31+
pip install ".[docs]"
32+
33+
- name: Build documentation
34+
run: |
35+
sphinx-multiversion docs/source _build
36+
37+
- name: Add Redirect Page
38+
# NOTE: when only one version is built, it is not within a separate directory
39+
if: ${{ hashFiles('_build/index.html') == '' }}
40+
run: |
41+
cp docs/source/_templates/redirect.html _build/index.html
42+
43+
- name: Deploy to Github Pages
44+
uses: peaceiris/actions-gh-pages@v4
45+
with:
46+
github_token: ${{ secrets.GITHUB_TOKEN }}
47+
publish_dir: _build/
48+
publish_branch: gh-pages
49+
force_orphan: true

docs/source/_static/custom.css

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,48 @@
33
);
44

55
body {
6-
font-family: 'Space Grotesk', sans-serif;
6+
font-family: 'Space Grotesk', sans-serif;
7+
}
8+
9+
.alert {
10+
padding: 1rem;
11+
margin: 1rem 0;
12+
border-left: 4px solid transparent;
13+
border-radius: 4px;
14+
background-color: #f9f9f9;
15+
color: #333;
16+
font-size: 0.95rem;
17+
}
18+
19+
.alert-soft {
20+
opacity: 0.75;
21+
transition: opacity 0.2s ease-in-out;
22+
}
23+
24+
/* Info */
25+
.alert-info {
26+
color: #e7f3fe;
27+
border-left-color: #2196f3;
28+
background-color: #0c5460;
29+
}
30+
31+
/* Warning */
32+
.alert-warning {
33+
color: #fff3cd;
34+
border-left-color: #ff9800;
35+
background-color: #856404;
36+
}
37+
38+
/* Success */
39+
.alert-success {
40+
color: #d4edda;
41+
border-left-color: #28a745;
42+
background-color: #155724;
43+
}
44+
45+
/* Danger */
46+
.alert-danger {
47+
color: #f8d7da;
48+
border-left-color: #dc3545;
49+
background-color: #721c24;
750
}

docs/source/_static/logo-dark.svg

Lines changed: 17 additions & 0 deletions
Loading

docs/source/_static/logo.svg

Lines changed: 17 additions & 0 deletions
Loading

docs/source/_templates/page.html

Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
{% extends "base.html" %}
2+
{% block body -%}
3+
{% if current_version and latest_version and current_version != latest_version %}
4+
<p>
5+
<!-- <div class="alert alert-warning" role="alert"> -->
6+
{% if current_version.is_released %}
7+
<div class="alert alert-warning alert-soft" role="alert">
8+
You're reading an old version of this documentation.
9+
If you want up-to-date information, please have a look at
10+
<a href="{{ vpathto(latest_version.name) }}">{{latest_version.name}}</a>.
11+
</div>
12+
{% else %}
13+
<div class="alert alert-info alert-soft" role="alert">
14+
You're reading the documentation for a development version.
15+
For the latest released version, please have a look at
16+
<a href="{{ vpathto(latest_version.name) }}">{{latest_version.name}}</a>.
17+
</div>
18+
{% endif %}
19+
<!-- </div> -->
20+
</p>
21+
{% endif %}
22+
{{ super() }}
23+
{% include "partials/icons.html" %}
24+
25+
<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation">
26+
<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc">
27+
<label class="overlay sidebar-overlay" for="__navigation">
28+
<div class="visually-hidden">Hide navigation sidebar</div>
29+
</label>
30+
<label class="overlay toc-overlay" for="__toc">
31+
<div class="visually-hidden">Hide table of contents sidebar</div>
32+
</label>
33+
34+
<a class="skip-to-content muted-link" href="#furo-main-content">
35+
{%- trans -%}
36+
Skip to content
37+
{%- endtrans -%}
38+
</a>
39+
40+
{% if theme_announcement -%}
41+
<div class="announcement">
42+
<aside class="announcement-content">
43+
{% block announcement %} {{ theme_announcement }} {% endblock announcement %}
44+
</aside>
45+
</div>
46+
{%- endif %}
47+
48+
<div class="page">
49+
<header class="mobile-header">
50+
<div class="header-left">
51+
<label class="nav-overlay-icon" for="__navigation">
52+
<div class="visually-hidden">Toggle site navigation sidebar</div>
53+
<i class="icon"><svg><use href="#svg-menu"></use></svg></i>
54+
</label>
55+
</div>
56+
<div class="header-center">
57+
<a href="{{ pathto(master_doc) }}"><div class="brand">{{ docstitle if docstitle else project }}</div></a>
58+
</div>
59+
<div class="header-right">
60+
<div class="theme-toggle-container theme-toggle-header">
61+
<button class="theme-toggle">
62+
<div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
63+
<svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg>
64+
<svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg>
65+
<svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
66+
<svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
67+
</button>
68+
</div>
69+
<label class="toc-overlay-icon toc-header-icon{% if furo_hide_toc %} no-toc{% endif %}" for="__toc">
70+
<div class="visually-hidden">Toggle table of contents sidebar</div>
71+
<i class="icon"><svg><use href="#svg-toc"></use></svg></i>
72+
</label>
73+
</div>
74+
</header>
75+
<aside class="sidebar-drawer">
76+
<div class="sidebar-container">
77+
{% block left_sidebar %}
78+
<div class="sidebar-sticky">
79+
{%- for sidebar_section in sidebars %}
80+
{%- include sidebar_section %}
81+
{%- endfor %}
82+
</div>
83+
{% endblock left_sidebar %}
84+
</div>
85+
</aside>
86+
<div class="main">
87+
<div class="content">
88+
<div class="article-container">
89+
<a href="#" class="back-to-top muted-link">
90+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
91+
<path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path>
92+
</svg>
93+
<span>{% trans %}Back to top{% endtrans %}</span>
94+
</a>
95+
<div class="content-icon-container">
96+
{% if theme_top_of_page_button != "edit" -%}
97+
{{ warning("Got configuration for 'top_of_page_button': this is deprecated.") }}
98+
{%- endif -%}
99+
100+
{%- if theme_top_of_page_buttons == "" -%}
101+
{% if theme_top_of_page_button == None -%}
102+
{#- We respect the old configuration of disabling all the buttons -#}
103+
{%- set theme_top_of_page_buttons = [] -%}
104+
{% else %}
105+
{%- set theme_top_of_page_buttons = ["view", "edit"] -%}
106+
{%- endif -%}
107+
{% else -%}
108+
{% if theme_top_of_page_button != "edit" -%}
109+
{%- set theme_top_of_page_buttons = [] -%}
110+
{{ warning("Got configuration for both 'top_of_page_button' and 'top_of_page_buttons', ignoring both and removing all top of page buttons.") }}
111+
{%- endif -%}
112+
{%- endif -%}
113+
{% for button in theme_top_of_page_buttons -%}
114+
{% if button == "view" %}
115+
{%- include "components/view-this-page.html" with context -%}
116+
{% elif button == "edit" %}
117+
{%- include "components/edit-this-page.html" with context -%}
118+
{% else %}
119+
{{ warning("Got an unsupported value in 'top_of_page_buttons' for theme configuration") }}
120+
{% endif %}
121+
{%- endfor -%}
122+
{#- Theme toggle -#}
123+
<div class="theme-toggle-container theme-toggle-content">
124+
<button class="theme-toggle">
125+
<div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
126+
<svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg>
127+
<svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg>
128+
<svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
129+
<svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
130+
</button>
131+
</div>
132+
<label class="toc-overlay-icon toc-content-icon{% if furo_hide_toc %} no-toc{% endif %}" for="__toc">
133+
<div class="visually-hidden">Toggle table of contents sidebar</div>
134+
<i class="icon"><svg><use href="#svg-toc"></use></svg></i>
135+
</label>
136+
</div>
137+
<article role="main" id="furo-main-content">
138+
{% block content %}{{ body }}{% endblock %}
139+
</article>
140+
</div>
141+
<footer>
142+
{% block footer %}
143+
<div class="related-pages">
144+
{% if next -%}
145+
<a class="next-page" href="{{ next.link }}">
146+
<div class="page-info">
147+
<div class="context">
148+
<span>{{ _("Next") }}</span>
149+
</div>
150+
<div class="title">{{ next.title }}</div>
151+
</div>
152+
<svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
153+
</a>
154+
{%- endif %}
155+
{% if prev -%}
156+
<a class="prev-page" href="{{ prev.link }}">
157+
<svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
158+
<div class="page-info">
159+
<div class="context">
160+
<span>{{ _("Previous") }}</span>
161+
</div>
162+
{% if prev.link == pathto(master_doc) %}
163+
<div class="title">{{ _("Home") }}</div>
164+
{% else %}
165+
<div class="title">{{ prev.title }}</div>
166+
{% endif %}
167+
</div>
168+
</a>
169+
{%- endif %}
170+
</div>
171+
<div class="bottom-of-page">
172+
<div class="left-details">
173+
{%- if show_copyright %}
174+
<div class="copyright">
175+
{%- if hasdoc('copyright') %}
176+
{% trans path=pathto('copyright'), copyright=copyright|e -%}
177+
<a href="{{ path }}">Copyright</a> &#169; {{ copyright }}
178+
{%- endtrans %}
179+
{%- else %}
180+
{% trans copyright=copyright|e -%}
181+
Copyright &#169; {{ copyright }}
182+
{%- endtrans %}
183+
{%- endif %}
184+
</div>
185+
{%- endif %}
186+
{% trans %}Made with {% endtrans -%}
187+
{%- if show_sphinx -%}
188+
{% trans %}<a href="https://www.sphinx-doc.org/">Sphinx</a> and {% endtrans -%}
189+
<a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s
190+
{% endif -%}
191+
{% trans %}
192+
<a href="https://github.com/pradyunsg/furo">Furo</a>
193+
{% endtrans %}
194+
{%- if last_updated -%}
195+
<div class="last-updated">
196+
{% trans last_updated=last_updated|e -%}
197+
Last updated on {{ last_updated }}
198+
{%- endtrans -%}
199+
</div>
200+
{%- endif %}
201+
</div>
202+
<div class="right-details">
203+
{% if theme_footer_icons or READTHEDOCS -%}
204+
<div class="icons">
205+
{% if theme_footer_icons -%}
206+
{% for icon_dict in theme_footer_icons -%}
207+
<a class="muted-link {{ icon_dict.class }}" href="{{ icon_dict.url }}" aria-label="{{ icon_dict.name }}" target="{{ icon_dict.target | default('_blank') }}">
208+
{{- icon_dict.html -}}
209+
</a>
210+
{% endfor %}
211+
{%- else -%}
212+
{#- Show Read the Docs project -#}
213+
{%- if READTHEDOCS and slug -%}
214+
<a class="muted-link" href="https://readthedocs.org/projects/{{ slug }}" aria-label="On Read the Docs">
215+
<svg x="0px" y="0px" viewBox="-125 217 360 360" xml:space="preserve">
216+
<path fill="currentColor" d="M39.2,391.3c-4.2,0.6-7.1,4.4-6.5,8.5c0.4,3,2.6,5.5,5.5,6.3 c0,0,18.5,6.1,50,8.7c25.3,2.1,54-1.8,54-1.8c4.2-0.1,7.5-3.6,7.4-7.8c-0.1-4.2-3.6-7.5-7.8-7.4c-0.5,0-1,0.1-1.5,0.2 c0,0-28.1,3.5-50.9,1.6c-30.1-2.4-46.5-7.9-46.5-7.9C41.7,391.3,40.4,391.1,39.2,391.3z M39.2,353.6c-4.2,0.6-7.1,4.4-6.5,8.5 c0.4,3,2.6,5.5,5.5,6.3c0,0,18.5,6.1,50,8.7c25.3,2.1,54-1.8,54-1.8c4.2-0.1,7.5-3.6,7.4-7.8c-0.1-4.2-3.6-7.5-7.8-7.4 c-0.5,0-1,0.1-1.5,0.2c0,0-28.1,3.5-50.9,1.6c-30.1-2.4-46.5-7.9-46.5-7.9C41.7,353.6,40.4,353.4,39.2,353.6z M39.2,315.9 c-4.2,0.6-7.1,4.4-6.5,8.5c0.4,3,2.6,5.5,5.5,6.3c0,0,18.5,6.1,50,8.7c25.3,2.1,54-1.8,54-1.8c4.2-0.1,7.5-3.6,7.4-7.8 c-0.1-4.2-3.6-7.5-7.8-7.4c-0.5,0-1,0.1-1.5,0.2c0,0-28.1,3.5-50.9,1.6c-30.1-2.4-46.5-7.9-46.5-7.9 C41.7,315.9,40.4,315.8,39.2,315.9z M39.2,278.3c-4.2,0.6-7.1,4.4-6.5,8.5c0.4,3,2.6,5.5,5.5,6.3c0,0,18.5,6.1,50,8.7 c25.3,2.1,54-1.8,54-1.8c4.2-0.1,7.5-3.6,7.4-7.8c-0.1-4.2-3.6-7.5-7.8-7.4c-0.5,0-1,0.1-1.5,0.2c0,0-28.1,3.5-50.9,1.6 c-30.1-2.4-46.5-7.9-46.5-7.9C41.7,278.2,40.4,278.1,39.2,278.3z M-13.6,238.5c-39.6,0.3-54.3,12.5-54.3,12.5v295.7 c0,0,14.4-12.4,60.8-10.5s55.9,18.2,112.9,19.3s71.3-8.8,71.3-8.8l0.8-301.4c0,0-25.6,7.3-75.6,7.7c-49.9,0.4-61.9-12.7-107.7-14.2 C-8.2,238.6-10.9,238.5-13.6,238.5z M19.5,257.8c0,0,24,7.9,68.3,10.1c37.5,1.9,75-3.7,75-3.7v267.9c0,0-19,10-66.5,6.6 C59.5,536.1,19,522.1,19,522.1L19.5,257.8z M-3.6,264.8c4.2,0,7.7,3.4,7.7,7.7c0,4.2-3.4,7.7-7.7,7.7c0,0-12.4,0.1-20,0.8 c-12.7,1.3-21.4,5.9-21.4,5.9c-3.7,2-8.4,0.5-10.3-3.2c-2-3.7-0.5-8.4,3.2-10.3c0,0,0,0,0,0c0,0,11.3-6,27-7.5 C-16,264.9-3.6,264.8-3.6,264.8z M-11,302.6c4.2-0.1,7.4,0,7.4,0c4.2,0.5,7.2,4.3,6.7,8.5c-0.4,3.5-3.2,6.3-6.7,6.7 c0,0-12.4,0.1-20,0.8c-12.7,1.3-21.4,5.9-21.4,5.9c-3.7,2-8.4,0.5-10.3-3.2c-2-3.7-0.5-8.4,3.2-10.3c0,0,11.3-6,27-7.5 C-20.5,302.9-15.2,302.7-11,302.6z M-3.6,340.2c4.2,0,7.7,3.4,7.7,7.7s-3.4,7.7-7.7,7.7c0,0-12.4-0.1-20,0.7 c-12.7,1.3-21.4,5.9-21.4,5.9c-3.7,2-8.4,0.5-10.3-3.2c-2-3.7-0.5-8.4,3.2-10.3c0,0,11.3-6,27-7.5C-16,340.1-3.6,340.2-3.6,340.2z" />
217+
</svg>
218+
</a>
219+
{%- endif -%}
220+
{#- Show GitHub repository home -#}
221+
{%- if READTHEDOCS and display_github and github_user != "None" and github_repo != "None" -%}
222+
<a class="muted-link" href="https://github.com/{{ github_user }}/{{ github_repo }}" aria-label="On GitHub">
223+
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16">
224+
<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>
225+
</svg>
226+
</a>
227+
{%- endif -%}
228+
{%- endif %}
229+
</div>
230+
{%- endif %}
231+
</div>
232+
</div>
233+
{% endblock footer %}
234+
</footer>
235+
</div>
236+
<aside class="toc-drawer{% if furo_hide_toc %} no-toc{% endif %}">
237+
{% block right_sidebar %}
238+
{% if not furo_hide_toc %}
239+
<div class="toc-sticky toc-scroll">
240+
<div class="toc-title-container">
241+
<span class="toc-title">
242+
{{ _("On this page") }}
243+
</span>
244+
</div>
245+
<div class="toc-tree-container">
246+
<div class="toc-tree">
247+
{{ toc }}
248+
</div>
249+
</div>
250+
</div>
251+
{% endif %}
252+
{% endblock right_sidebar %}
253+
</aside>
254+
</div>
255+
</div>
256+
{%- endblock %}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Redirecting to main development branch</title>
5+
<meta charset="utf-8">
6+
<meta http-equiv="refresh" content="0; URL=./main/index.html">
7+
<link rel="canonical" href="https://Spill-Tea.github.io/PyTemplate/main/index.html">
8+
</head>
9+
</html>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<a class="sidebar-brand{% if logo %} centered{% endif %}" href="{{ pathto(master_doc) }}">
2+
{% block brand_content %}
3+
{%- if logo_url %}
4+
<div class="sidebar-logo-container">
5+
<img class="sidebar-logo" src="{{ logo_url }}" alt="Logo"/>
6+
</div>
7+
{%- endif %}
8+
{%- if theme_light_logo and theme_dark_logo %}
9+
<div class="sidebar-logo-container">
10+
<img class="sidebar-logo only-light" src="{{ pathto(theme_light_logo, 1) }}" alt="Light Logo"/>
11+
<img class="sidebar-logo only-dark" src="{{ pathto(theme_dark_logo, 1) }}" alt="Dark Logo"/>
12+
</div>
13+
{%- endif %}
14+
{% if not theme_sidebar_hide_name %}
15+
<span class="sidebar-brand-text">{{ docstitle if docstitle else project }}</span>
16+
{%- endif %}
17+
{% endblock brand_content %}
18+
</a>

0 commit comments

Comments
 (0)