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 Changes
======= =======
1.0.4 (*2020-06-03*)
====================
- Add external sub-sites for languages.
1.0.3 (*2020-05-31*) 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": [ "social": [
('iconset', 'icon', 'text', 'link'), ('iconset', 'icon', 'text', 'link'),
], ],
"external_languages": [
('code', 'label to show', 'base url'),
]
"twitter_user": "", "twitter_user": "",
"mastodon_user": "@user@instance", "mastodon_user": "@user@instance",
"fathom": { "fathom": {
@ -85,6 +88,7 @@ If provided, creates external links (e.g. Github) in the top right corner:
"license": { "license": {
'type': 'CC', 'type': 'CC',
'subtype': 'BY-SA', 'subtype': 'BY-SA',
'text': 'Text to show for non-CC licences',
'version': '4.0', 'version': '4.0',
'url': 'https://creativecommons.org/licenses/by-sa/4.0/legalcode' 'url': 'https://creativecommons.org/licenses/by-sa/4.0/legalcode'
} }

View file

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

View file

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

View file

@ -9,3 +9,29 @@
</div> </div>
{% endfor %} {% endfor %}
{% endif %} {% 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 %}