hbox-docs/hooks/iconos.py

39 lines
1.4 KiB
Python

"""Íconos de línea del menú lateral (overrides/.icons/helgen/*.svg).
Material pone el ícono que trae cada página en su front matter (`icon:`). Varias
páginas llegan por scripts/sync-docs.sh desde el repo Drogheda y se sobrescriben,
así que el ícono se asigna aquí, por ruta, sin tocar esas páginas.
Si una página ya trae `icon:` en su front matter, ese manda.
"""
ICONOS = {
"index.md": "helgen/inicio",
"tableros/pendientes.md": "helgen/pendientes",
"bitacora.md": "helgen/bitacora",
# Tableros
"tableros/index.md": "helgen/pendientes",
"tableros/ingenieria.md": "helgen/ingenieria",
"tableros/produccion.md": "helgen/barras",
"tableros/actas.md": "helgen/actas",
"tableros/inventario.md": "helgen/inventario",
"tableros/sitio.md": "helgen/sitios",
"tableros/equipo.md": "helgen/equipo",
"tableros/unidad.md": "helgen/unidad",
"tableros/campo.md": "helgen/visitas",
# Documentos
"guia-ingeniero.md": "helgen/manuales",
"produccion/index.md": "helgen/fabrica",
"taller/index.md": "helgen/taller",
"campo/index.md": "helgen/campo",
"hardware/index.md": "helgen/tarjetas",
"historia/index.md": "helgen/historia",
"descargas/index.md": "helgen/descargas",
}
def on_page_markdown(markdown, page, config, files, **kwargs):
icono = ICONOS.get(page.file.src_uri)
if icono and not page.meta.get("icon"):
page.meta["icon"] = icono
return markdown