Add: Support of subsites for languages

This commit is contained in:
Kujiu 2020-06-03 12:59:01 +02:00
parent 350f7d492c
commit eb6df19281
Signed by: kujiu
GPG Key ID: ABBB2CAC6855599F
5 changed files with 37 additions and 2 deletions

View File

@ -2,6 +2,11 @@
Changes
=======
1.0.4 (*2020-06-03*)
====================
- Add external sub-sites for languages.
1.0.3 (*2020-05-31*)
====================

View File

@ -59,6 +59,9 @@ If provided, creates external links (e.g. Github) in the top right corner:
"social": [
('iconset', 'icon', 'text', 'link'),
],
"external_languages": [
('code', 'label to show', 'base url'),
]
"twitter_user": "",
"mastodon_user": "@user@instance",
"fathom": {
@ -85,6 +88,7 @@ If provided, creates external links (e.g. Github) in the top right corner:
"license": {
'type': 'CC',
'subtype': 'BY-SA',
'text': 'Text to show for non-CC licences',
'version': '4.0',
'url': 'https://creativecommons.org/licenses/by-sa/4.0/legalcode'
}

View File

@ -27,7 +27,7 @@ with open("README.rst", "r") as fh:
setup(
name="sphinx_nervproject_theme",
version="1.0.3",
version="1.0.4",
url="https://procrastinator.nerv-project.eu/nerv-project/communication/sphinx_nervproject_theme",
license="EUPL 1.2",
author="Kujiu",

View File

@ -5,7 +5,7 @@ from sphinx.environment.collectors import EnvironmentCollector
from sphinx import addnodes
from sphinx.util.osutil import relative_uri
__version__ = (1, 0, 2)
__version__ = (1, 0, 4)
class SimpleTocTreeCollector(EnvironmentCollector):

View File

@ -9,3 +9,29 @@
</div>
{% endfor %}
{% endif %}
{% if theme_external_languages %}
<div class="nav-item nav-dropdown-menu">
<details>
<summary>
{% for (code, name, langurl) in theme_external_languages %}
{% if code == language %}
<span class="nav-link">
{{ name }}
</span>
{% endif %}
{% endfor %}
</summary>
<ul>
{% for (code, name, langurl) in theme_external_languages %}
{% if code != language %}
<li class="nav-link">
<a href="{{ langurl }}/{{ pagename }}{{ file_suffix }}">
{{ name }}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
</details>
</div>
{% endif %}