943acbc573
Durcit la convention de nommage des projets (dérive constatée : 'Sliding Automation', 'code_versioning'... au lieu des formes canoniques). - trilium_api.py : projets_canoniques() lit le référentiel = valeurs du label projet sur les notes de type=projet (source unique, pas de constante en dur). Note-projet CodeVersioning créée (manquait). - mcp_server.py : _valider_projet() branché dans les 6 tools de création (add_decision/history/backlog, new_conversation, create_entite, add_skill). Refuse un projet non canonique (suggestion si faute) ou inconnu (renvoi au processus de création de projet). Ne verrouille pas si référentiel illisible. - lint_audit.py : VAL-nommage aligné sur le référentiel (attrape casse, espace ET snake_case ; l'ancien 'contient un espace' ratait code_versioning). - Données : 79 notes ré-étiquetées vers les 3 formes canoniques. Quality by design : l'erreur de nommage devient impossible à l'écriture, le Lint n'est plus que le filet de sécurité.
42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
# `NL2BR` Extension
|
|
# ===============
|
|
|
|
# A Python-Markdown extension to treat newlines as hard breaks; like
|
|
# GitHub-flavored Markdown does.
|
|
|
|
# See https://Python-Markdown.github.io/extensions/nl2br
|
|
# for documentation.
|
|
|
|
# Original code Copyright 2011 [Brian Neal](https://deathofagremmie.com/)
|
|
|
|
# All changes Copyright 2011-2014 The Python Markdown Project
|
|
|
|
# License: [BSD](https://opensource.org/licenses/bsd-license.php)
|
|
|
|
"""
|
|
A Python-Markdown extension to treat newlines as hard breaks.
|
|
Similar to GitHub-flavored Markdown's behavior.
|
|
|
|
See the [documentation](https://Python-Markdown.github.io/extensions/nl2br)
|
|
for details.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from . import Extension
|
|
from ..inlinepatterns import SubstituteTagInlineProcessor
|
|
|
|
BR_RE = r'\n'
|
|
|
|
|
|
class Nl2BrExtension(Extension):
|
|
|
|
def extendMarkdown(self, md):
|
|
""" Add a `SubstituteTagInlineProcessor` to Markdown. """
|
|
br_tag = SubstituteTagInlineProcessor(BR_RE, 'br')
|
|
md.inlinePatterns.register(br_tag, 'nl', 5)
|
|
|
|
|
|
def makeExtension(**kwargs): # pragma: no cover
|
|
return Nl2BrExtension(**kwargs)
|