Current version and release date in doc sidebar
This commit is contained in:
parent
75d9dda4ba
commit
5695bca9f3
@ -10,6 +10,6 @@ https://instaloader.readthedocs.io/
|
|||||||
The documentation is created with [Sphinx](http://www.sphinx-doc.org/). To build it, use
|
The documentation is created with [Sphinx](http://www.sphinx-doc.org/). To build it, use
|
||||||
|
|
||||||
```
|
```
|
||||||
pip3 install sphinx sphinx-autodoc-typehints
|
pip3 install -r requirements.txt
|
||||||
make html
|
make html
|
||||||
```
|
```
|
||||||
|
5
docs/_templates/links.html
vendored
5
docs/_templates/links.html
vendored
@ -4,6 +4,11 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="{{ next.link|e }}">{{ next.title }}</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="{{ next.link|e }}">{{ next.title }}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<h3>Current Release</h3>
|
||||||
|
<ul>
|
||||||
|
<li class="toctree-l1"><a href="https://github.com/Thammus/instaloader/releases/tag/v{{current_release}}">Version <b>{{current_release}}</b></a></li>
|
||||||
|
<li>Released on <b>{{current_release_date}}</b>.</li>
|
||||||
|
</ul>
|
||||||
<h3>Links</h3>
|
<h3>Links</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://github.com/Thammus/instaloader/issues">Issue Tracker</a></li>
|
<li><a href="https://github.com/Thammus/instaloader/issues">Issue Tracker</a></li>
|
||||||
|
15
docs/conf.py
15
docs/conf.py
@ -19,6 +19,9 @@
|
|||||||
#
|
#
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import re
|
||||||
|
import requests
|
||||||
|
from datetime import datetime
|
||||||
sys.path.insert(0, os.path.abspath('..'))
|
sys.path.insert(0, os.path.abspath('..'))
|
||||||
|
|
||||||
# -- General configuration ------------------------------------------------
|
# -- General configuration ------------------------------------------------
|
||||||
@ -352,3 +355,15 @@ texinfo_documents = [
|
|||||||
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||||
#
|
#
|
||||||
# texinfo_no_detailmenu = False
|
# texinfo_no_detailmenu = False
|
||||||
|
|
||||||
|
|
||||||
|
def get_latest_tag(repo):
|
||||||
|
tags = requests.get("https://api.github.com/repos/{}/git/refs/tags".format(repo)).json()
|
||||||
|
latest_tag = requests.get(tags[-1]['object']['url']).json()
|
||||||
|
version_string = latest_tag['tag']
|
||||||
|
version_date = datetime.strptime(latest_tag['tagger']['date'], "%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
return version_string[1:], re.sub(r'\b0+(\d)', r'\1', "{:%d %b %Y}".format(version_date))
|
||||||
|
|
||||||
|
current_release, current_release_date = get_latest_tag('Thammus/instaloader')
|
||||||
|
|
||||||
|
html_context = {'current_release': current_release, 'current_release_date': current_release_date}
|
||||||
|
@ -1 +1,3 @@
|
|||||||
|
requests
|
||||||
|
sphinx
|
||||||
sphinx-autodoc-typehints
|
sphinx-autodoc-typehints
|
||||||
|
Loading…
x
Reference in New Issue
Block a user