Skip to content
Snippets Groups Projects
Verified Commit 756e833a authored by Romain Deville's avatar Romain Deville
Browse files

:art: Improve plugins.py in documentation and tpl.yaml

parent 8e22d41d
No related branches found
No related tags found
No related merge requests found
...@@ -153,6 +153,10 @@ def add_external_to_nav( ...@@ -153,6 +153,10 @@ def add_external_to_nav(
repo_parent, repo_parent,
nav_parent[1:], nav_parent[1:],
) )
elif repo_dict["online_url"].startswith('/'):
nav.append({
repo_dict["nav_entry"]: repo_dict["online_url"].replace('/','../',1)
})
else: else:
nav.append({repo_dict["nav_entry"]: repo_dict["online_url"]}) nav.append({repo_dict["nav_entry"]: repo_dict["online_url"]})
...@@ -833,10 +837,8 @@ def update_version(env: dict) -> None: ...@@ -833,10 +837,8 @@ def update_version(env: dict) -> None:
if last_major >= 0: if last_major >= 0:
mike_version.append( mike_version.append(
{ {
"version": "{}.{}".format(last_major, last_minor), "version": f"{last_major}.{last_minor}",
"title": "{}.{}.{}".format( "title": f"{last_major}.{last_minor}.{last_patch}",
last_major, last_minor, last_patch
),
"aliases": [], "aliases": [],
} }
) )
...@@ -846,10 +848,8 @@ def update_version(env: dict) -> None: ...@@ -846,10 +848,8 @@ def update_version(env: dict) -> None:
if last_minor >= 0: if last_minor >= 0:
mike_version.append( mike_version.append(
{ {
"version": "{}.{}".format(last_major, last_minor), "version": f"{last_major}.{last_minor}",
"title": "{}.{}.{}".format( "title": f"{last_major}.{last_minor}.{last_patch}",
last_major, last_minor, last_patch
),
"aliases": [], "aliases": [],
} }
) )
...@@ -859,8 +859,8 @@ def update_version(env: dict) -> None: ...@@ -859,8 +859,8 @@ def update_version(env: dict) -> None:
last_patch = patch last_patch = patch
mike_version.append( mike_version.append(
{ {
"version": "{}.{}".format(last_major, last_minor), "version": f"{last_major}.{last_minor}",
"title": "{}.{}.{}".format(last_major, last_minor, last_patch), "title": f"{last_major}.{last_minor}.{last_patch}",
"aliases": ["latest"], "aliases": ["latest"],
} }
) )
...@@ -914,9 +914,11 @@ def define_env(env: dict) -> None: ...@@ -914,9 +914,11 @@ def define_env(env: dict) -> None:
var: Key in env.variables to return. var: Key in env.variables to return.
Returns: Returns:
The value of `env.variables[var]`. The value of `env.variables[var]` if it exists, else return None.
""" """
return env.variables[var] if var in env.variables:
return env.variables[var]
return None
@env.macro @env.macro
# pylint: disable=W0612 # pylint: disable=W0612
......
### BEGIN MKDOCS TEMPLATE ### ### BEGIN MKDOCS TEMPLATE ###
### WARNING, DO NOT UPDATE CONTENT BETWEEN MKDOCS TEMPLATE TAG !### ### WARNING, DO NOT UPDATE CONTENT BETWEEN MKDOCS TEMPLATE TAG !###
### Modified content will be overwritten when updating.### ### Modified content will be overwritten when updating.###
...@@ -29,11 +30,13 @@ repo_name: ...@@ -29,11 +30,13 @@ repo_name:
# (OPTIONAL) Path, relative to `docs_dir` mkdocs config, to the logo of the # (OPTIONAL) Path, relative to `docs_dir` mkdocs config, to the logo of the
# repo. If not specified, path will automatically be set to # repo. If not specified, path will automatically be set to
# `assets/img/meta/reop_name_logo.png` # `assets/img/meta/repo_name_logo.png`
#logo: "assets/img/meta/repo_template_logo.png" #logo: "assets/img/meta/repo_name_logo.png"
# Description of the repo, will be used to setup the mkdocs description. # Description of the repo, will be used to setup the mkdocs description.
desc: >- desc: >-
Repo description with markdown support An explicit description to explain what my repo do. Can be a multiline
description with **markdown** support such as
[link](https://url.domain.tld) and more.
# (OPTIONAL) If you plan to use `mkdocstring` plugins to render python # (OPTIONAL) If you plan to use `mkdocstring` plugins to render python
# source code, you will need to provide the path where your source files # source code, you will need to provide the path where your source files
...@@ -47,3 +50,4 @@ repo_name: ...@@ -47,3 +50,4 @@ repo_name:
- name: "Firstname Lastname" - name: "Firstname Lastname"
mail: "mail@domain.tld" mail: "mail@domain.tld"
### END MKDOCS TEMPLATE ### ### END MKDOCS TEMPLATE ###
### BEGIN MKDOCS TEMPLATE ### ### BEGIN MKDOCS TEMPLATE ###
### WARNING, DO NOT UPDATE CONTENT BETWEEN MKDOCS TEMPLATE TAG !### ### WARNING, DO NOT UPDATE CONTENT BETWEEN MKDOCS TEMPLATE TAG !###
### Modified content will be overwritten when updating.### ### Modified content will be overwritten when updating.###
...@@ -25,6 +26,10 @@ subrepo: ...@@ -25,6 +26,10 @@ subrepo:
# - name: subrepo_1 # - name: subrepo_1
# # SSH or HTTP link to the online subrepo_1 # # SSH or HTTP link to the online subrepo_1
# git_url: git@domain.tld:namesapce/subrepo_1 # git_url: git@domain.tld:namesapce/subrepo_1
# # Key `subpath` is a str pointing to the path in the subrepo where
# # there is a file `mkdocs.yaml` and folder `docs` if not the root
# # of the subrepo
# subpath: sub/dir/
# # List of subdirectory from `dir_name` which are repos with # # List of subdirectory from `dir_name` which are repos with
# # mkdocs documentation which will be included in the documentation. # # mkdocs documentation which will be included in the documentation.
# external: # external:
...@@ -34,6 +39,10 @@ subrepo: ...@@ -34,6 +39,10 @@ subrepo:
# - name: subrepo_2 # - name: subrepo_2
# # SSH or HTTP link to the online subrepo_2 # # SSH or HTTP link to the online subrepo_2
# git_url: git@domain.tld:namesapce/subrepo_2 # git_url: git@domain.tld:namesapce/subrepo_2
# # Key `subpath` is a str pointing to the path in the subrepo where
# # there is a file `mkdocs.yaml` and folder `docs` if not the root
# # of the subrepo
# subpath: sub/dir/
# # Another sub dir_name which also old subrepos # # Another sub dir_name which also old subrepos
# subdir_name: # subdir_name:
# nav_entry: "Sub Nav Entry" # nav_entry: "Sub Nav Entry"
...@@ -75,3 +84,4 @@ subrepo: ...@@ -75,3 +84,4 @@ subrepo:
# - Mkdocs Template: /my_program/mkdocs_template/ # - Mkdocs Template: /my_program/mkdocs_template/
# ``` # ```
### END MKDOCS TEMPLATE ### ### END MKDOCS TEMPLATE ###
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment