replace internal links

This commit is contained in:
Guilhem Fauré 2023-05-24 13:46:03 +02:00
parent 27938f92b9
commit 74aeb8474c

View File

@ -1,4 +1,5 @@
from os.path import basename, splitext from os.path import basename, splitext
from re import I, S, compile
from peewee import ModelSelect from peewee import ModelSelect
from slugify import slugify from slugify import slugify
@ -16,6 +17,13 @@ from database import (
EXPORTTYPE: str = "md" EXPORTTYPE: str = "md"
ARTICLE_LINK = compile(r"<(art|article)([0-9]+)(\|.*?)*>", S | I)
def link_articles(text: str):
for match in ARTICLE_LINK.findall(text):
article = Article.select().where(Article.id_article == match[0])
class Document(SpipDocuments): class Document(SpipDocuments):
class Meta: class Meta: