diff --git a/docs/commit_info.md b/docs/commit_info.md deleted file mode 100644 index c159130a006e2c06966fd6efe582c4a3598af705..0000000000000000000000000000000000000000 --- a/docs/commit_info.md +++ /dev/null @@ -1,11 +0,0 @@ -## Latest Commit - -**Branch name:** main - -**Message:** Merge remote-tracking branch 'origin/main' - - -**Author:** alexandre.caldato - -**Date:** 2023-06-01 19:13:51 - diff --git a/docs/css/extra.css b/docs/css/extra.css new file mode 100644 index 0000000000000000000000000000000000000000..92d95096f281b6cc9fd72471eabf69d6f93ebad0 --- /dev/null +++ b/docs/css/extra.css @@ -0,0 +1,19 @@ +/* This is for the footer to stick at the bottom */ +html, body { + display: flex; + flex-direction: column; + min-height: 100vh; + margin: 0; +} + +footer { + margin-top: auto; + width: 100%; + position: absolute; + bottom: 0; + font-weight: 500; +} + +li { + list-style: none; +} diff --git a/dsfr_theme/main.html b/dsfr_theme/main.html new file mode 100644 index 0000000000000000000000000000000000000000..0fe0ed09d8d0a87d853f06fccc7bc3f9b6b9729b --- /dev/null +++ b/dsfr_theme/main.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} + +{% block footer %} +<div class="commit-info"> + <ul> + <li>Branch: {{ config.extra.commit_info.branch }}</li> + <li>Message: {{ config.extra.commit_info.message }}</li> + <li>Author: {{ config.extra.commit_info.author }}</li> + <li>Date: {{ config.extra.commit_info.date }}</li> + </ul> +</div> +{% endblock %} diff --git a/generate_commit_info.py b/generate_commit_info.py index 6ecb233e2e12077c5f4cb4b7a45d38cc8c0dd0d4..140d8d1a4db2b89373b00a6b8072d8932ccb74e7 100644 --- a/generate_commit_info.py +++ b/generate_commit_info.py @@ -1,3 +1,4 @@ +import yaml from git import Repo @@ -13,17 +14,16 @@ def get_git_commit_info(repo_path): } -def generate_md_file(commit_info, output_file): - with open(output_file, 'w') as file: - file.write(f"## Latest Commit\n\n") - file.write(f"**Branch name:** {commit_info['branch']}\n\n") - file.write(f"**Message:** {commit_info['message']}\n\n") - file.write(f"**Author:** {commit_info['author']}\n\n") - file.write(f"**Date:** {commit_info['date']}\n\n") +def write_commit_info_to_config(commit_info, config_file): + with open(config_file, 'r+') as file: + config = yaml.safe_load(file) + config['extra']['commit_info'] = commit_info + file.seek(0) + yaml.dump(config, file) if __name__ == "__main__": repo_path = '.' - output_file = 'docs/commit_info.md' + config_file = 'mkdocs.yml' commit_info = get_git_commit_info(repo_path) - generate_md_file(commit_info, output_file) + write_commit_info_to_config(commit_info, config_file) diff --git a/mkdocs.yml b/mkdocs.yml index 7606ae7adf1d7a7871db22b41e15f4e2eefcd71b..86bdda102bb722c324b6fa4d1f8dc36a33563525 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,4 +1,15 @@ -site_name: My Docs +extra: + commit_info: + author: alexandre.caldato + branch: main + date: '2023-06-01 19:50:17' + message: 'add script to generate commit md file' +extra_css: +- css/extra.css nav: - - Home: index.md - - Latest Commit: commit_info.md +- Home: index.md +- Latest Commit: commit_info.md +site_name: My Docs +theme: + custom_dir: dsfr_theme + name: mkdocs