replace internal links
This commit is contained in:
parent
27938f92b9
commit
74aeb8474c
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user