Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • pagoda/tools/mkdocs_template
1 result
Show changes
.image-center {
display : block;
margin : auto;
}
\ No newline at end of file
@charset "UTF-8";
/* Codehilight */
:root [data-md-color-scheme="rdeville-dark"] .highlight [data-linenos]::before
{
/* Default line numbers */
color: var(--md-default-fg-color--lightest);
}
:root [data-md-color-scheme="rdeville-dark"] .highlight [data-linenos].special::before
{
/* Special line numbers, i.e. when alternating line colors*/
background-color:var(--md-code-special-bg-color);
}
:root [data-md-color-scheme="rdeville-light"] .highlight [data-linenos]::before
{
/* Default line numbers */
color: var(--md-default-fg-color--darkest);
}
:root [data-md-color-scheme="rdeville-light"] .highlight [data-linenos].special::before
{
/* Special line numbers, i.e. when alternating line colors*/
background-color:var(--md-code-special-bg-color);
}
/* Superfences tabs */
:root [data-md-color-scheme="rdeville-dark"] .md-typeset .tabbed-set > input:not(.focus-visible) + label
{
/* Tab background not focus */
background: var(--md-default-bg-color--light);
color: var(--md-default-fg-color--lightest);
}
:root [data-md-color-scheme="rdeville-dark"] .md-typeset .tabbed-set > input:checked + label,
:root [data-md-color-scheme="rdeville-dark"] .md-typeset .tabbed-content
{
/* Tab and content focus */
background: var(--md-default-bg-color--dark);
color: var(--md-default-fg-color);
}
:root [data-md-color-scheme="rdeville-light"] .md-typeset .tabbed-set > input:not(.focus-visible) + label
{
/* Tab background not focus */
background: var(--md-default-bg-color--darkest);
color: var(--md-default-fg-color--darkest);
}
:root [data-md-color-scheme="rdeville-light"] .md-typeset .tabbed-set > input:checked + label,
:root [data-md-color-scheme="rdeville-light"] .md-typeset .tabbed-content
{
/* Tab and content focus */
background: var(--md-default-bg-color--lightest);
color: var(--md-default-fg-color);
}
/* Codehilight */
.md-typeset .highlight .special::before
{
background-color:var(--md-code-special-bg-color);
}
.md-typeset .highlighttable .linenodiv .special
{
background-color : var(--md-code-special-bg-color)
}
/* Progress bar */
.progress-label
{
position : absolute;
text-align : center;
font-weight : 700;
width : 100%;
margin : 0;
line-height : 1.2rem;
white-space : nowrap;
overflow : hidden;
}
.md-typeset .progress.candystripe-animate .progress-bar
{
-webkit-animation:animate-stripes 3s linear infinite;
animation:animate-stripes 3s linear infinite
}
:root [data-md-color-scheme="rdeville-light"] .md-typeset .progress.candystripe .progress-bar
{
background-image: linear-gradient(
135deg,
rgba(var(--md_color__white),0.25) 27%,
transparent 27%,
transparent 52%,
rgba(var(--md_color__white),0.25) 52%,
rgba(var(--md_color__white),0.25) 77%,
transparent 77%,
transparent);
background-size:2rem 2rem
}
:root [data-md-color-scheme="rdeville-dark"] .md-typeset .progress.candystripe .progress-bar
{
background-image: linear-gradient(
135deg,
rgba(var(--md_color__black),0.25) 27%,
transparent 27%,
transparent 52%,
rgba(var(--md_color__black),0.25) 52%,
rgba(var(--md_color__black),0.25) 77%,
transparent 77%,
transparent);
background-size:2rem 2rem
}
.progress-bar
{
height : 1.2rem;
float : left;
background-color : var(--md-code-bf-color);
}
.md-typeset .progress
{
display : block;
width : 100%;
margin : 0.5rem 0;
height : 1.2rem;
background-color : var(--md-code-bg-color);
position : relative;
}
.progress-100plus .progress-bar
{
background-color: rgba(var(--md_color__green_500));
}
.progress-80plus .progress-bar
{
background-color: rgba(var(--md_color__light_green_500));
}
.progress-60plus .progress-bar
{
background-color: rgba(var(--md_color__lime_500));
}
.progress-40plus .progress-bar
{
background-color: rgba(var(--md_color__yellow_500));
}
.progress-20plus .progress-bar
{
background-color: rgba(var(--md_color__amber_500));
}
.progress-0plus .progress-bar
{
background-color: rgba(var(--md_color__red_500));
}
.default-color .progress-bar
{
background-color : var(--md-primary-fg-color);
}
.default-color .progress-bar
{
background-color : var(--md-primary-fg-color);
}
.red-color .progress-bar
{
background-color : rgba(var(--md_color__red_500),1);
}
.pink-color .progress-bar
{
background-color : rgba(var(--md_color__pink_500),1);
}
.purple-color .progress-bar
{
background-color : rgba(var(--md_color__purple_500),1);
}
.deep-purple-color .progress-bar
{
background-color : rgba(var(--md_color__deep_purple_500),1);
}
.indigo-color .progress-bar
{
background-color : rgba(var(--md_color__indigo_500),1);
}
.blue-color .progress-bar
{
background-color : rgba(var(--md_color__blue_500),1);
}
.light-blue-color .progress-bar
{
background-color : rgba(var(--md_color__light_blue_500),1);
}
.cyan-color .progress-bar
{
background-color : rgba(var(--md_color__cyan_500),1);
}
.teal-color .progress-bar
{
background-color : rgba(var(--md_color__teal_500),1);
}
.green-color .progress-bar
{
background-color : rgba(var(--md_color__green_500),1);
}
.light-green-color .progress-bar
{
background-color : rgba(var(--md_color__light_green_500),1);
}
.lime-color .progress-bar
{
background-color : rgba(var(--md_color__lime_500),1);
}
.yellow-color .progress-bar
{
background-color : rgba(var(--md_color__yellow_500),1);
}
.amber-color .progress-bar
{
background-color : rgba(var(--md_color__amber_500),1);
}
.orange-color .progress-bar
{
background-color : rgba(var(--md_color__orange_500),1);
}
.deep-orange-color .progress-bar
{
background-color : rgba(var(--md_color__deep_orange_500),1);
}
.brown-color .progress-bar
{
background-color : rgba(var(--md_color__brown_500),1);
}
.grey-color .progress-bar
{
background-color : rgba(var(--md_color__grey_500),1);
}
.blue-grey-color .progress-bar
{
background-color : rgba(var(--md_color__blue_grey_500),1);
}
.rounded .progress-bar
{
border-top-right-radius : 1em;
border-bottom-right-radius : 1em;
}
@-webkit-keyframes animate-stripes
{
0% {
background-position:0 0
}
100% {
background-position:6rem 0
}
}
@keyframes animate-stripes
{
0%
{
background-position:0 0
}
100%
{
background-position:6rem 0
}
}
/* Tasklist */
.md-typeset [type="checkbox"]:checked + .task-list-indicator::before
{
background-color: rgba(var(--md_color__green_500),1);
}
/* *****************************************************************************
* VIM MODELINE
* vim: fdm=indent
* ****************************************************************************/
This diff is collapsed.
/*
* LIGHTGALLERY
* ----------------------------------------------------------------------------
* Lightgallery extra javascript
* From: https://github.com/g-provost/lightgallery-markdown
*/
/*
* Loading lightgallery
*/
var elements = document.getElementsByClassName("lightgallery");
for(var i=0; i<elements.length; i++) {
lightGallery(elements[i]);
}
/*
* Loading video plugins for lightgallery
*/
lightGallery(document.getElementById('html5-videos'));
/*
* Loading parameter to auto-generate thumbnails for vimeo/youtube video
*/
lightGallery(document.getElementById('video-thumbnails'), {
loadYoutubeThumbnail: true,
youtubeThumbSize: 'default',
loadVimeoThumbnail: true,
vimeoThumbSize: 'thumbnail_medium',
});
/*
* Table Sort
* ----------------------------------------------------------------------------
* Code snippet to allow sorting table
* From: https://squidfunk.github.io/mkdocs-material/reference/data-tables/#sortable-tables
*/
document$.subscribe(function() {
var tables = document.querySelectorAll("article table")
tables.forEach(function(table) {
new Tablesort(table)
})
})
/*
* Mermaid Configuration to support dark/light switching
* ----------------------------------------------------------------------------
* Table Sort
* Optional config
* If your document is not specifying `data-md-color-scheme` for color schemes
* you just need to specify `default`.
*/
window.mermaidConfig = {
"rdeville-light": {
startOnLoad: false,
theme: "default",
flowchart: {
htmlLabels: false
},
er: {
useMaxWidth: false
},
sequence: {
useMaxWidth: false,
/*
* Mermaid handles Firefox a little different. For some reason, it
* doesn't attach font sizes to the labels in Firefox. If we specify the
* documented defaults, font sizes are written to the labels in Firefox.
*/
noteFontWeight: "14px",
actorFontSize: "14px",
messageFontSize: "16px"
}
},
"rdeville-dark": {
startOnLoad: false,
theme: "dark",
flowchart: {
htmlLabels: false
},
er: {
useMaxWidth: false
},
sequence: {
useMaxWidth: false,
noteFontWeight: "14px",
actorFontSize: "14px",
messageFontSize: "16px"
}
}
}
/*!
* tablesort v5.2.1 (2020-06-02)
* http://tristen.ca/tablesort/demo/
* Copyright (c) 2020 ; Licensed MIT
*/
!function(){function a(b,c){if(!(this instanceof a))return new a(b,c);if(!b||"TABLE"!==b.tagName)throw new Error("Element must be a table");this.init(b,c||{})}var b=[],c=function(a){var b;return window.CustomEvent&&"function"==typeof window.CustomEvent?b=new CustomEvent(a):(b=document.createEvent("CustomEvent"),b.initCustomEvent(a,!1,!1,void 0)),b},d=function(a){return a.getAttribute("data-sort")||a.textContent||a.innerText||""},e=function(a,b){return a=a.trim().toLowerCase(),b=b.trim().toLowerCase(),a===b?0:a<b?1:-1},f=function(a,b){return[].slice.call(a).find(function(a){return a.getAttribute("data-sort-column-key")===b})},g=function(a,b){return function(c,d){var e=a(c.td,d.td);return 0===e?b?d.index-c.index:c.index-d.index:e}};a.extend=function(a,c,d){if("function"!=typeof c||"function"!=typeof d)throw new Error("Pattern and sort must be a function");b.push({name:a,pattern:c,sort:d})},a.prototype={init:function(a,b){var c,d,e,f,g=this;if(g.table=a,g.thead=!1,g.options=b,a.rows&&a.rows.length>0)if(a.tHead&&a.tHead.rows.length>0){for(e=0;e<a.tHead.rows.length;e++)if("thead"===a.tHead.rows[e].getAttribute("data-sort-method")){c=a.tHead.rows[e];break}c||(c=a.tHead.rows[a.tHead.rows.length-1]),g.thead=!0}else c=a.rows[0];if(c){var h=function(){g.current&&g.current!==this&&g.current.removeAttribute("aria-sort"),g.current=this,g.sortTable(this)};for(e=0;e<c.cells.length;e++)f=c.cells[e],f.setAttribute("role","columnheader"),"none"!==f.getAttribute("data-sort-method")&&(f.tabindex=0,f.addEventListener("click",h,!1),null!==f.getAttribute("data-sort-default")&&(d=f));d&&(g.current=d,g.sortTable(d))}},sortTable:function(a,h){var i=this,j=a.getAttribute("data-sort-column-key"),k=a.cellIndex,l=e,m="",n=[],o=i.thead?0:1,p=a.getAttribute("data-sort-method"),q=a.getAttribute("aria-sort");if(i.table.dispatchEvent(c("beforeSort")),h||(q="ascending"===q?"descending":"descending"===q?"ascending":i.options.descending?"descending":"ascending",a.setAttribute("aria-sort",q)),!(i.table.rows.length<2)){if(!p){for(var r;n.length<3&&o<i.table.tBodies[0].rows.length;)r=j?f(i.table.tBodies[0].rows[o].cells,j):i.table.tBodies[0].rows[o].cells[k],m=r?d(r):"",m=m.trim(),m.length>0&&n.push(m),o++;if(!n)return}for(o=0;o<b.length;o++)if(m=b[o],p){if(m.name===p){l=m.sort;break}}else if(n.every(m.pattern)){l=m.sort;break}for(i.col=k,o=0;o<i.table.tBodies.length;o++){var s,t=[],u={},v=0,w=0;if(!(i.table.tBodies[o].rows.length<2)){for(s=0;s<i.table.tBodies[o].rows.length;s++){var r;m=i.table.tBodies[o].rows[s],"none"===m.getAttribute("data-sort-method")?u[v]=m:(r=j?f(m.cells,j):m.cells[i.col],t.push({tr:m,td:r?d(r):"",index:v})),v++}for("descending"===q?t.sort(g(l,!0)):(t.sort(g(l,!1)),t.reverse()),s=0;s<v;s++)u[s]?(m=u[s],w++):m=t[s-w].tr,i.table.tBodies[o].appendChild(m)}}i.table.dispatchEvent(c("afterSort"))}},refresh:function(){void 0!==this.current&&this.sortTable(this.current,!0)}},"undefined"!=typeof module&&module.exports?module.exports=a:window.Tablesort=a}();
\ No newline at end of file
### BEGIN MKDOCS TEMPLATE ###
# ---------------------------------------------------------------------------
# Below content is automatically managed with repo mkdocs_template.
# Do not edit manually
# ---------------------------------------------------------------------------
# Website Information
# ---------------------------------------------------------------------------
site_name: "" # Automatically set by mkdocs_macros_plugin (see docs/_data/plugins.py)
#site_description: # Automatically set by mkdocs_macros_plugin (see docs/_data/plugins.py)
#site_url: # Automatically set by mkdocs_macros_plugin (see docs/_data/plugins.py)
#copyright: # Automatically set by mkdocs_macros_plugin (see docs/_data/plugins.py)
docs_dir: docs
# Repository Information
# ---------------------------------------------------------------------------
#repo_name: # Automatically set by mkdocs_macros_plugin (see docs/_data/plugins.py)
#repo_url: # Automatically set by mkdocs_macros_plugin (see docs/_data/plugins.py)
edit_uri: ""
# This setting controls the style used for linking to pages within the
# documentation.
use_directory_urls: false
# Theme Configuration
# ---------------------------------------------------------------------------
theme:
# Using mkdocs-material theme
# https://squidfunk.github.io/mkdocs-material/
name: material
# Overriding parent theme configuration
custom_dir: docs/theme
# Determines whether the search plugin expects the theme to provide a
# dedicated search page via a template located at search/search.html.
include_search_page: false
# Determines whether the search plugin should only generate a search
# index or a complete search solution.
search_index_only: true
# Language site
language: en
# Optional features like tabs and instant loading are now implemented
# as flags and can be enabled by listing them in mkdocs.yml under
# theme.features:
features:
- navigation.tabs
- navigation.instant
- navigation.top
# Setting colors palette (these are defined in docs/theme/css/{colors,theme}.css)
palette:
# Light mode
- media: "(prefers-color-scheme: light)"
scheme: pagoda-light
primary: pagoda-deep-purple-light
accent: pagoda-orange-light
toggle:
icon: material/weather-night
name: Switch to dark mode
# Dark mode
- media: "(prefers-color-scheme: dark)"
scheme: pagoda-dark
primary: pagoda-deep-purple-dark
accent: pagoda-orange-dark
toggle:
icon: material/weather-sunny
name: Switch to light mode
# Font configuration for the website (FurCode are provided in
# docs/theme/fonts)
font: false
# text: FuraCode Nerd Font
# code: FuraCode Nerd Font
# Path to logo and icons to use for the website
#logo: # Automatically set by mkdocs_macros_plugin (see docs/_data/plugins.py)
#icon:
# repo: # Automatically set by mkdocs_macros_plugin (see docs/_data/plugins.py)
#favicon: # Automatically set by mkdocs_macros_plugin (see docs/_data/plugins.py)
# External CSS
# ---------------------------------------------------------------------------
extra_css:
# Define personal extra css
- theme/css/extra.css
# Define colors (all materials colors RGB code)
- theme/css/colors.css
# Define themes
- theme/css/theme.css
# Define css of base markdown extension and pymdown extension
- theme/css/python_markdown_extension.css
# External JS
# ---------------------------------------------------------------------------
extra_javascript:
# Define javascript to allow table sorting
# From: https://squidfunk.github.io/mkdocs-material/reference/data-tables/#sortable-tables
- theme/js/tablesort.min.js
# Define personal custom javascript
- theme/js/extra.js
# Extensions
# ---------------------------------------------------------------------------
markdown_extensions:
# Allow to include markdown files
# https://github.com/sethen/markdown-include
- markdown_include.include:
base_path: ./
# Python Markdown Extensions
# https://python-markdown.github.io/extensions/
- markdown.extensions.toc:
slugify: !!python/name:pymdownx.slugs.uslugify
permalink: ""
- markdown.extensions.admonition:
- markdown.extensions.smarty:
smart_quotes: false
- markdown.extensions.attr_list:
- markdown.extensions.def_list:
- markdown.extensions.tables:
- markdown.extensions.abbr:
- markdown.extensions.footnotes:
- markdown.extensions.meta:
- markdown.extensions.md_in_html:
# Pymdown Extensions
- pymdownx.extra:
- pymdownx.betterem:
- pymdownx.details:
- pymdownx.caret:
- pymdownx.escapeall:
hardbreak: True
nbsp: True
- pymdownx.critic:
- pymdownx.emoji:
emoji_index: !!python/name:pymdownx.emoji.twemoji
emoji_generator: !!python/name:pymdownx.emoji.to_svg
- pymdownx.inlinehilite:
- pymdownx.highlight:
linenums: true
linenums_special: 2
linenums_style: pymdownx-inline
guess_lang: false
extend_pygments_lang:
- name: pycon3
lang: pycon
options:
python3: true
- pymdownx.keys:
separator: "\uff0b"
- pymdownx.mark:
- pymdownx.magiclink:
repo_url_shortener: true
- pymdownx.progressbar:
- pymdownx.pathconverter:
- pymdownx.smartsymbols:
- pymdownx.snippets:
- pymdownx.striphtml:
- pymdownx.superfences:
preserve_tabs: true
- pymdownx.tabbed:
- pymdownx.tasklist:
custom_checkbox: true
- pymdownx.tilde:
# Locally installed in docs/theme/plugins/ from original repo
# https://github.com/g-provost/lightgallery-markdown
- lightgallery:
# Extra Data Information & Customization
# ---------------------------------------------------------------------------
# Dictionary storing social icon that will be shown on the bottom right.
extra:
social:
- icon: fontawesome/solid/globe
link: https://projet.liris.cnrs.fr/pagoda
name: PAGoDA Website
- icon: fontawesome/brands/gitlab
link: https://gitlab.liris.cnrs.fr/pagoda/
name: "@pagoda on Gitlab LIRIS"
version:
provider: mike
# Plugins
# ---------------------------------------------------------------------------
plugins:
- search:
# https://github.com/timvink/mkdocs-git-revision-date-localized-plugin
# MkDocs plugin that enables displaying the date of the last git
# modification of a page.
- git-revision-date-localized:
locale: en
fallback_to_build_date: true
# https://github.com/oprypin/mkdocs-section-index
# MkDocs plugin to allow clickable sections that lead to an index page
- section-index:
# https://github.com/apenwarr/mkdocs-exclude
# A mkdocs plugin that lets you exclude files or trees.
- exclude:
regex:
- .*theme.*.md
# https://github.com/fralau/mkdocs_macros_plugin
# Unleash the power of MkDocs with variables and macros
- macros:
module_name: docs/_data/plugins
include_dir: ./
include_yaml:
- docs/_data/vars.yaml
# Others yaml include are done automatically using
# mkdocs_macros_plugin (see docs/_data/plugins.py)
# https://spotify.github.io/mkdocs-monorepo-plugin/
# This plugin enables you to build multiple sets of documentation in a
# single Mkdocs.
- monorepo:
# https://pawamoy.github.io/mkdocstrings/
# Automatic documentation from sources, for MkDocs.
- mkdocstrings:
default_handler: python
handlers:
python:
rendering:
show_source: true
show_if_no_docstring: true
show_root_heading: false
show_root_toc_entry: false
show_root_full_path: true
show_object_full_path: true
show_root_members_full_path: true
show_category_heading: true
show_signature_annotations: false
group_by_category: true
heading_level: 2
setup_commands:
- import sys
# Others command such as sys.path.append("path") are
# Automatically added using mkdocs_macros_plugin
# (see docs/_data/plugins.py)
# DO NOT FORGET TO ADD/UPDATE THE \`nav\` KEY BELOW.
### END MKDOCS TEMPLATE ###
# - redirects:
# redirect_maps:
# index.md: index.fork.md
# Navigation Pane
# ---------------------------------------------------------------------------
nav:
- Home: index.md
- About:
- about/index.md
- Code of Conduct: about/code_of_conduct.md
- Contributing: about/contributing.md
- Data Privacy: about/data_privacy.md
- License: about/license.md
- Release Notes: about/release_notes.md
# *****************************************************************************
# VIM MODELINE
# vim: ft=yaml: fdm=indent
# *****************************************************************************
#!/usr/bin/env bash
# """Post setup script to handle the README.md file
#
# SYNOPSIS:
# NOT TO BE USED ALONE, MUST BE SOURCED
#
# DESCRIPTION:
# This script will define methods to install/upgrade the file README.md base
# on the git remote origin if its exists else, will ask the user to provide
# information.
#
# """
# Set constant variables
BASE_ONLINE_DOC_URL="https://docs.romaindeville.fr/"
REPO_URL=""
REPO_NAME=""
REPO_NAME_FIRST_UPPERCASE=""
REPO_ONLINE_DOC_URL=""
main_post_setup()
{
# """User defined post-setup config which handle update of `README.md`
#
# Main post-setup method which handle the management of `README.md` file from
# `user_config` folder using git repo information. If current repo is not a
# git repository without `origin` remote defined, print an error and exit.
#
# Globals:
# MKDOCS_ROOT
# MKDOCS_CLONE_ROOT
# UPGRADE
#
# Arguments:
# None
#
# Output:
# None
#
# Returns:
# 0, If everything went right
# 1, If something went wrong
#
# """
# - SC2034: var appears unused, Verify use (or export if used externally)
# shellcheck disable=SC2034
mkdocs_log()
{
# """Print debug message in colors depending on message severity on stderr.
#
# Echo colored log depending on user provided message severity. Message
# severity are associated to following color output:
#
# - `DEBUG` print in the fifth color of the terminal (usually magenta)
# - `INFO` print in the second color of the terminal (usually green)
# - `WARNING` print in the third color of the terminal (usually yellow)
# - `ERROR` print in the third color of the terminal (usually red)
#
# If no message severity is provided, severity will automatically be set to
# INFO.
#
# Globals:
# ZSH_VERSION
# MKDOCS_DEBUG_LEVEL
#
# Arguments:
# $1 : string, message severity or message content
# $@ : string, message content
#
# Output:
# Colored log informations
#
# Returns:
# None
#
# """
# Store color prefixes in variable to ease their use.
# Base on only 8 colors to ensure portability of color when in tty
local e_normal="\e[0m" # Normal (usually white fg & transparent bg)
local e_bold="\e[1m" # Bold
local e_underline="\e[4m" # Underline
local e_debug="\e[0;35m" # Fifth term color (usually magenta fg)
local e_info="\e[0;32m" # Second term color (usually green fg)
local e_warning="\e[0;33m" # Third term color (usually yellow fg)
local e_error="\e[0;31m" # First term color (usually red fg)
# Store preformated colored prefix for log message
local error="${e_bold}${e_error}[ERROR]${e_normal}${e_error}"
local warning="${e_bold}${e_warning}[WARNING]${e_normal}${e_warning}"
local info="${e_bold}${e_info}[INFO]${e_normal}${e_info}"
local debug="${e_bold}${e_debug}[DEBUG]${e_normal}${e_debug}"
local color_output="e_error"
local msg_severity
local msg
# Not using ${1^^} to ensure portability when using ZSH
msg_severity=$(echo "$1" | tr '[:upper:]' '[:lower:]')
if [[ "${msg_severity}" =~ ^(error|time|warning|info|debug)$ ]]
then
# Shift arguments by one such that $@ start from the second arguments
shift
# Place the content of variable which name is defined by ${msg_severity}
# For instance, if `msg_severity` is INFO, then `prefix` will have the same
# value as variable `info`.
if [[ -n "${ZSH_VERSION}" ]]
then
prefix="${(P)msg_severity}"
else
prefix="${!msg_severity}"
fi
color_output="e_${msg_severity}"
else
prefix="${info}"
fi
if [[ -n "${ZSH_VERSION}" ]]
then
color_output="${(P)color_output}"
else
color_output="${!color_output}"
fi
# Concat all remaining arguments in the message content and apply markdown
# like syntax.
msg_content=$(echo "$*" \
| sed -e "s/ \*\*/ \\${e_bold}/g" \
-e "s/\*\*\./\\${e_normal}\\${color_output}./g" \
-e "s/\*\* /\\${e_normal}\\${color_output} /g" \
-e "s/\*\*$/\\${e_normal}\\${color_output} /g" \
-e "s/ \_\_/ \\${e_underline}/g" \
-e "s/\_\_\./\\${e_normal}\\${color_output}./g" \
-e "s/\_\_ /\\${e_normal}\\${color_output} /g")
msg="${prefix} ${msg_content}${e_normal}"
# Print message or not depending on message severity and MKDOCS_DEBUG_LEVEL
if [[ -z "${MKDOCS_DEBUG_LEVEL}" ]] && [[ "${msg_severity}" == "error" ]]
then
echo -e "${msg}" 1>&2
elif [[ -n "${MKDOCS_DEBUG_LEVEL}" ]]
then
case ${MKDOCS_DEBUG_LEVEL} in
DEBUG)
echo "${msg_severity}" \
| grep -q -E "(debug|info|warning|error)" && echo -e "${msg}" 1>&2
;;
INFO)
echo "${msg_severity}" \
| grep -q -E "(info|warning|error)" && echo -e "${msg}" 1>&2
;;
WARNING)
echo "${msg_severity}" \
| grep -q -E "(warning|error)" && echo -e "${msg}" 1>&2
;;
ERROR)
echo "${msg_severity}" \
| grep -q -E "error" && echo -e "${msg}" 1>&2
;;
esac
fi
}
extract_repo_info()
{
# """Extract repository from the origin remote
#
# Parse output of command `git remote -v | grep origin` to setup repo
# information store in `REPO_*` variables
#
# Globals:
# REPO_URL
# REPO_NAME
# REPO_NAME_FIRST_UPPERCASE
# REPO_NAME_FIRST_UPPERCASE_ARRAY
# REPO_ONLINE_DOC_URL
#
# Arguments:
# None
#
# Output:
# None
#
# Returns:
# None
# """
local repo_remote
local repo_domain
repo_remote=$(git remote -v | \
grep origin | \
head -1 | \
sed -e "s/origin\t//g" -e "s/ *([a-z]*)//g")
if [[ "${repo_remote}" =~ @ ]]
then
repo_remote=${repo_remote##*@}
repo_domain="https://${repo_remote%%:*}/"
repo_with_namespace="${repo_remote##*:}"
else
repo_domain=${repo_remote##https:\/\/}
repo_domain="https://${repo_domain%%/*}/"
repo_with_namespace="${repo_remote/${repo_domain}/}"
fi
REPO_URL="${repo_domain}${repo_with_namespace/.git/}"
REPO_NAME="${repo_with_namespace##*/}"
REPO_NAME="${REPO_NAME/.git/}"
REPO_NAME_FIRST_UPPERCASE="${REPO_NAME/_/ }"
REPO_NAME_FIRST_UPPERCASE="${REPO_NAME_FIRST_UPPERCASE/-/ }"
# shellcheck disable=SC2206
# - SC2206: Quote to prevent word splitting/globbing
REPO_NAME_FIRST_UPPERCASE_ARRAY=( ${REPO_NAME_FIRST_UPPERCASE} )
# shellcheck disable=SC2178
# - SC2178: Variabel was used as an array but is now assigned a string
REPO_NAME_FIRST_UPPERCASE="${REPO_NAME_FIRST_UPPERCASE_ARRAY[*]^}"
REPO_ONLINE_DOC_URL="${BASE_ONLINE_DOC_URL}${repo_with_namespace/.git/}"
}
ensure_remote_origin()
{
# """Ensure remote `origin` exists and parse remote info
#
# Ensure current folder is a git folder with an `origin` remote defined. If
# not, print an error else extract repository information from remote.
#
# Globals:
# None
#
# Arguments:
# None
#
# Output:
# Error message if git remote `origin` does not exists
#
# Returns:
# 0, if everything went right
# 1, if remote `origin` does not exists or not in a git repository
# """
if ! git remote -v | grep origin &> /dev/null
then
mkdocs_log "WARNING" "Unable to fetch git remote **\`origin\`**!"
mkdocs_log "WARNING" "Are you sure you are in a git repository with an origin remote defined ?"
return 1
else
extract_repo_info
fi
}
upgrade_readme()
{
# """Upgrade latest version of README.md
#
# Check if latest version of README.md is different from the old version. If
# yes, then move the old version to ${MKDOCS_ROOT}/.old then upgrade to
# latest version.
#
# Globals:
# MKDOCS_ROOT
# REPO_URL
# REPO_NAME
# REPO_NAME_FIRST_UPPERCASE
# REPO_NAME_FIRST_UPPERCASE_ARRAY
# REPO_ONLINE_DOC_URL
#
# Arguments:
# $1, string, absolute path to the latest file version to be installed
# $2, string, absolute path to the location of the installation
#
# Output:
# Log messages
#
# Returns:
# None
#
# """
local file_from="$1"
local file_to="$2"
local relative_file_to="${file_to##*${MKDOCS_ROOT}\/}"
local tmp_file_from="${MKDOCS_TMP}/${relative_file_to}.new"
local tmp_file_to="${MKDOCS_TMP}/${relative_file_to}.old"
local bak_file=${file_to//${MKDOCS_ROOT}/${MKDOCS_ROOT}\/.old}
local begin="<\!-- BEGIN MKDOCS TEMPLATE -->"
local end="<\!-- END MKDOCS TEMPLATE -->"
local bak_dir
bak_file=${bak_file}.$(date "+%Y-%m-%d-%H-%M")
bak_dir=$(dirname "${bak_file}")
sed -n -e "/${begin}/,/${end}/"p "${file_from}" > "${tmp_file_from}"
sed -i \
-e "s|<TPL:REPO_NAME>|${REPO_NAME}|g" \
-e "s|<TPL:REPO_URL>|${REPO_URL}|g" \
-e "s|<TPL:REPO_ONLINE_DOC_URL>|${REPO_ONLINE_DOC_URL}|g" \
-e "s|<TPL:REPO_NAME_FIRST_UPPERCASE>|${REPO_NAME_FIRST_UPPERCASE}|g" \
"${tmp_file_from}"
sed -n -e "/${begin}/,/${end}/"p "${file_to}" > "${tmp_file_to}"
if [[ "$(sha1sum "${tmp_file_from}" | cut -d " " -f 1 )" \
!= "$(sha1sum "${tmp_file_to}" | cut -d " " -f 1 )" ]]
then
mkdocs_log "INFO" "Backup file **${relative_file_to}** to **${bak_file##*${MKDOCS_ROOT}\/}.**"
if ! [[ -d "${bak_dir}" ]]
then
mkdir -p "${bak_dir}"
fi
cp "${file_to}" "${bak_file}"
grep -B 1000000 "${begin}" "${file_to}" | sed -e "s/${begin}//g" > "${tmp_file_to}"
cat "${tmp_file_from}" >> "${tmp_file_to}"
grep -A 1000000 "${end}" "${file_to}" | sed -e "s/${end}//g" >> "${tmp_file_to}"
cat "${tmp_file_to}" > "${file_to}"
fi
}
setup_readme()
{
# """Install latest version of README.md from user_config folder
#
# Simply install README.md file replacing <TPL:XXX> with previously computed
# value.
#
# Globals:
# MKDOCS_ROOT
# REPO_URL
# REPO_NAME
# REPO_NAME_FIRST_UPPERCASE
# REPO_NAME_FIRST_UPPERCASE_ARRAY
# REPO_ONLINE_DOC_URL
#
#
# Arguments:
# $1, string, absolute path to the latest file version to be installed
# $2, string, absolute path to the location of the installation
#
# Output:
# Log messages
#
# Returns:
# None
#
# """
local file_from="$1"
local file_to="$2"
local relative_file_to="${file_to##*${MKDOCS_ROOT}\/}"
local begin="<!-- BEGIN MKDOCS TEMPLATE -->"
local end="<!-- END MKDOCS TEMPLATE -->"
mkdocs_log "INFO" "Installing file **${relative_file_to}**."
content=""
if ! grep "${begin}" "${file_from}" &> /dev/null
then
content+="\
${begin}
<!--
WARNING, DO NOT UPDATE CONTENT BETWEEN MKDOCS TEMPLATE TAG !
Modified content will be overwritten when updating
-->
$(cat "${file_from}")
${end}"
else
content="$(cat "${file_from}")"
fi
echo -e "${content}" | \
sed -e "s|<TPL:REPO_NAME>|${REPO_NAME}|g" \
-e "s|<TPL:REPO_URL>|${REPO_URL}|g" \
-e "s|<TPL:REPO_ONLINE_DOC_URL>|${REPO_ONLINE_DOC_URL}|g" \
-e "s|<TPL:REPO_NAME_FIRST_UPPERCASE>|${REPO_NAME_FIRST_UPPERCASE}|g" \
> "${file_to}"
}
if ! ensure_remote_origin
then
return 1
fi
file_from="${MKDOCS_CLONE_ROOT}/user_config/README.md"
file_to="${MKDOCS_ROOT}/README.md"
if [[ "${UPGRADE}" == "true" ]]
then
upgrade_readme "${file_from}" "${file_to}"
else
setup_readme "${file_from}" "${file_to}"
fi
}
# *****************************************************************************
# VIM MODELINE
# vim: fdm=indent:fdi=
# *****************************************************************************
This diff is collapsed.
# DEVELOPER REQUIREMENTS
# ============================================================
# DESCRIPTION:
# Mainly testing suite tools to ensure and/or enfore code syntax
# Testing tools
# ------------------------------------------------------------
# Tox is a generic virtualenv management and test command line tool
# https://pypi.org/project/tox/
tox
# The uncompromising code formatter.
# https://pypi.org/project/black/
black
# A Python utility / library to sort Python imports.
# https://pypi.org/project/isort/
isort
# pytest: simple powerful testing with Python
# https://pypi.org/project/pytest/
pytest
# Flake8 with pyproject support
# https://pypi.org/project/flake9/
flake9
# python code static checker
# https://pypi.org/project/pylint/
pylint
# Python docstring style checker
# https://pypi.org/project/pydocstyle/
pydocstyle
# Python wrapper around invoking shellcheck (https://www.shellcheck.net/)
# https://pypi.org/project/shellcheck-py/
shellcheck-py
# A linter for YAML files.
# https://pypi.org/project/yamllint/
yamllint
\ No newline at end of file
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile requirements.dev.in
#
appdirs==1.4.4
# via
# black
# virtualenv
astroid==2.5.6
# via pylint
attrs==21.2.0
# via pytest
black==21.5b0
# via -r requirements.dev.in
click==7.1.2
# via black
distlib==0.3.1
# via virtualenv
filelock==3.0.12
# via
# tox
# virtualenv
flake9==3.8.3.post2
# via -r requirements.dev.in
iniconfig==1.1.1
# via pytest
isort==5.8.0
# via
# -r requirements.dev.in
# pylint
lazy-object-proxy==1.6.0
# via astroid
mccabe==0.6.1
# via
# flake9
# pylint
mypy-extensions==0.4.3
# via black
packaging==20.9
# via
# pytest
# tox
pathspec==0.8.1
# via
# black
# yamllint
pluggy==0.13.1
# via
# pytest
# tox
py==1.10.0
# via
# pytest
# tox
pycodestyle==2.6.0
# via flake9
pydocstyle==6.0.0
# via -r requirements.dev.in
pyflakes==2.2.0
# via flake9
pylint==2.8.2
# via -r requirements.dev.in
pyparsing==2.4.7
# via packaging
pytest==6.2.4
# via -r requirements.dev.in
pyyaml==5.4.1
# via yamllint
regex==2021.4.4
# via black
shellcheck-py==0.7.2.1
# via -r requirements.dev.in
six==1.16.0
# via
# tox
# virtualenv
snowballstemmer==2.1.0
# via pydocstyle
toml==0.10.2
# via
# black
# pylint
# pytest
# tox
tox==3.23.1
# via -r requirements.dev.in
virtualenv==20.4.6
# via tox
wrapt==1.12.1
# via astroid
yamllint==1.26.1
# via -r requirements.dev.in
# DOCUMENTATION REQUIREMENTS
# ============================================================
# DESCRIPTION:
# Requirements to be able to render documentation locally
# Documentation rendering dependencies
# ------------------------------------------------------------
# Project documentation with Markdown.
# https://pypi.org/project/mkdocs/
mkdocs
# A Material Design theme for MkDocs
# https://pypi.org/project/mkdocs-material/
mkdocs-material>=7.1
# Plugin for adding monorepository support in Mkdocs.
# https://pypi.org/project/mkdocs-monorepo-plugin/
mkdocs-monorepo-plugin
# Mkdocs plugin that enables displaying the localized date of the last git
# modification of a markdown file.
# https://pypi.org/project/mkdocs-git-revision-date-localized-plugin/
mkdocs-git-revision-date-localized-plugin
# MkDocs plugin to allow clickable sections that lead to an index page
# https://pypi.org/project/mkdocs-section-index/
mkdocs-section-index
# Automatic documentation from sources, for MkDocs.
# https://pypi.org/project/mkdocstrings/
mkdocstrings
# This is an extension to Python-Markdown which provides an "include" function.
# https://pypi.org/project/markdown-include/
markdown-include
# Unleash the power of MkDocs with macros and variables
# https://pypi.org/project/mkdocs-macros-plugin/
mkdocs-macros-plugin
# A mkdocs plugin that lets you exclude files or trees.
# https://github.com/apenwarr/mkdocs-exclude
mkdocs-exclude
# Python lib/cli for JSON/YAML schema validation
# https://pypi.org/project/pykwalify/
pykwalify
# A MkDocs plugin for dynamic page redirects to prevent broken links.
# https://pypi.org/project/mkdocs-redirects/
mkdocs-redirects
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile requirements.docs.in
#
astunparse==1.6.3
# via pytkdocs
babel==2.9.1
# via mkdocs-git-revision-date-localized-plugin
click==8.0.0
# via
# mkdocs
# nltk
docopt==0.6.2
# via pykwalify
future==0.18.2
# via lunr
gitdb==4.0.7
# via gitpython
gitpython==3.1.17
# via mkdocs-git-revision-date-localized-plugin
jinja2==3.0.0
# via
# mkdocs
# mkdocs-macros-plugin
# mkdocstrings
joblib==1.0.1
# via nltk
livereload==2.6.3
# via mkdocs
lunr[languages]==0.5.8
# via mkdocs
markdown-include==0.6.0
# via -r requirements.docs.in
markdown==3.3.4
# via
# markdown-include
# mkdocs
# mkdocs-autorefs
# mkdocs-material
# mkdocstrings
# pymdown-extensions
markupsafe==2.0.0
# via
# jinja2
# mkdocstrings
mkdocs-autorefs==0.2.1
# via mkdocstrings
mkdocs-exclude==1.0.2
# via -r requirements.docs.in
mkdocs-git-revision-date-localized-plugin==0.9.2
# via -r requirements.docs.in
mkdocs-macros-plugin==0.5.5
# via -r requirements.docs.in
mkdocs-material-extensions==1.0.1
# via mkdocs-material
mkdocs-material==7.1.4
# via
# -r requirements.docs.in
# mkdocs-macros-plugin
# mkdocs-material-extensions
mkdocs-monorepo-plugin==0.4.14
# via -r requirements.docs.in
mkdocs-redirects==1.0.3
# via -r requirements.docs.in
mkdocs-section-index==0.3.0
# via -r requirements.docs.in
mkdocs==1.1.2
# via
# -r requirements.docs.in
# mkdocs-autorefs
# mkdocs-exclude
# mkdocs-git-revision-date-localized-plugin
# mkdocs-macros-plugin
# mkdocs-material
# mkdocs-monorepo-plugin
# mkdocs-redirects
# mkdocs-section-index
# mkdocstrings
mkdocstrings==0.15.1
# via -r requirements.docs.in
nltk==3.6.2
# via lunr
pygments==2.9.0
# via mkdocs-material
pykwalify==1.8.0
# via -r requirements.docs.in
pymdown-extensions==8.2
# via
# mkdocs-material
# mkdocstrings
python-dateutil==2.8.1
# via
# mkdocs-macros-plugin
# pykwalify
pytkdocs==0.11.1
# via mkdocstrings
pytz==2021.1
# via babel
pyyaml==5.4.1
# via
# mkdocs
# mkdocs-macros-plugin
regex==2021.4.4
# via nltk
ruamel.yaml.clib==0.2.2
# via ruamel.yaml
ruamel.yaml==0.17.4
# via pykwalify
six==1.16.0
# via
# astunparse
# livereload
# lunr
# mkdocs-redirects
# python-dateutil
smmap==4.0.0
# via gitdb
termcolor==1.1.0
# via mkdocs-macros-plugin
tornado==6.1
# via
# livereload
# mkdocs
tqdm==4.60.0
# via nltk
wheel==0.36.2
# via astunparse