Optimations for makefile and iframes

This commit is contained in:
Kevin Veen-Birkenbach 2025-03-20 12:37:41 +01:00
parent 6680f64e50
commit 6868b0d8ba
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E
9 changed files with 31 additions and 18 deletions

3
.gitignore vendored
View File

@ -2,4 +2,5 @@ site.retry
*__pycache__
docs/*
venv
*.log
*.log
modules/*

View File

@ -350,7 +350,7 @@ defaults_applications:
flavor: "oidc_login" # Keeping on sociallogin because the other option is not implemented yet
matomo_tracking_enabled: "{{matomo_tracking_enabled_default}}" # Enables\Disables Matomo Tracking
css_enabled: "{{css_enabled_default}}" # Enables\Disables Global CSS Style
landingpage_iframe_enabled: "true" # Enables\Disables the possibility to embed this on landing page via iframe
landingpage_iframe_enabled: "{{landingpage_iframe_enabled_default}}" # Enables\Disables the possibility to embed this on landing page via iframe
database:
central_storage: True # Activate Central Database Storage
credentials:

View File

@ -2,29 +2,37 @@
#
# You can set these variables from the command line, and also
# from the environment
SPHINXOPTS ?= -c .
SPHINXBUILD ?= sphinx-build
SPHINX_SOURCE_DIR ?= ../
SPHINX_BUILD_DIR ?= ../docs
SPHINXOPTS ?= -c .
SPHINXBUILD ?= sphinx-build
SPHINX_SOURCE_DIR ?= ../
SPHINX_BUILD_DIR ?= ../docs
SPHINX_APIDOC_BUILD_DIR = $(SPHINX_SOURCE_DIR)modules
.PHONY: help install copy-images apidoc html Makefile
.PHONY: help install copy-images apidoc remove-apidoc html Makefile
# Copy images before running any Sphinx command (except for help)
copy-images:
@echo "Copying images from ../assets/img/ to ./assets/img/..."
cp -r ../assets/img/* ./assets/img/
cp -vr ../assets/img/* ./assets/img/
# Generate reStructuredText files from Python modules using sphinx-apidoc
apidoc:
@echo "Running sphinx-apidoc..."
sphinx-apidoc -f -o $(SPHINX_SOURCE_DIR)/modules $(SPHINX_SOURCE_DIR)
sphinx-apidoc -f -o $(SPHINX_APIDOC_BUILD_DIR) $(SPHINX_SOURCE_DIR)
remove-apidoc:
@echo "Removing sphinx-apidoc files..."
- rm -rv $(SPHINX_APIDOC_BUILD_DIR)
# "help" target does not copy images
help:
@$(SPHINXBUILD) -M help "$(SPHINX_SOURCE_DIR)" "$(SPHINX_BUILD_DIR)" $(SPHINXOPTS) $(O)
# HTML target depends on apidoc so that sphinx-apidoc runs first
html: copy-images apidoc
html: copy-images
@$(SPHINXBUILD) -M html "$(SPHINX_SOURCE_DIR)" "$(SPHINX_BUILD_DIR)" $(SPHINXOPTS) $(O)
clean: remove-apidoc
@$(SPHINXBUILD) -M html "$(SPHINX_SOURCE_DIR)" "$(SPHINX_BUILD_DIR)" $(SPHINXOPTS) $(O)
# Catch-all target: route all unknown targets to Sphinx using the new

View File

@ -1,6 +1,3 @@
Hier die angepasste Version der README.md mit Erläuterungen zu den zusätzlichen Befehlen:
```markdown
# Documentation
CyMaIS uses [Sphinx](https://www.sphinx-doc.org/) to automatically generate its documentation and leverages the [Awesome Sphinx Theme](https://sphinxawesome.xyz/) for a sleek and responsive design. Enjoy a seamless, visually engaging experience 🚀✨.

View File

@ -29,8 +29,8 @@ def add_local_file_headings(app, pagename, templatename, context, doctree):
files = [f for f in os.listdir(abs_dir) if f.endswith('.md') or f.endswith('.rst')]
# If an index file is present, remove any readme files (case-insensitive).
files_lower = [f.lower() for f in files]
if 'index.md' in files_lower or 'index.rst' in files_lower:
files = [f for f in files if f.lower() not in ['readme.md', 'readme.rst']]
if 'index.rst' in files_lower:
files = [f for f in files if f.lower() not in ['readme.md']]
file_items = []
for file in files:

View File

@ -4,6 +4,8 @@ from .nav_utils import extract_headings_from_file, MAX_HEADING_LEVEL
logger = logging.getLogger(__name__)
CANDIDATES = ['index.rst', 'readme.md', 'main.rst']
def collect_folder_tree(dir_path, base_url):
"""
Recursively collects the folder tree starting from the given directory.
@ -28,7 +30,7 @@ def collect_folder_tree(dir_path, base_url):
# Find representative file for folder title using index or readme
rep_file = None
for candidate in ['index.rst', 'index.md', 'readme.md', 'readme.rst']:
for candidate in CANDIDATES:
for f in files:
if f.lower() == candidate:
rep_file = f
@ -48,7 +50,7 @@ def collect_folder_tree(dir_path, base_url):
# Remove the representative file from the list to avoid duplication,
# and filter out any additional "readme.md" or "index.rst" files.
files.remove(rep_file)
files = [f for f in files if f.lower() not in ['readme.md', 'index.rst']]
files = [f for f in files if f.lower() not in CANDIDATES]
# Process the remaining files in the current directory
file_items = []

View File

@ -61,5 +61,5 @@
{% endif %}
</div>
{% endif %}
<script src="{{ pathto('assets/js/current-nav.js', 1) }}"></script>
<script src="{{ pathto('_static/js/current-nav.js', 1) }}"></script>

1
tasks/README.md Normal file
View File

@ -0,0 +1 @@
This folder contains the cross role tasks

View File

@ -59,6 +59,10 @@
users: "{{users}}"
when: enable_debug | bool
- name: init root user
include_role:
name: user-root
- name: update device
include_role:
name: update