aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorOxbian <got.dacs@slmail.me>2023-05-10 21:56:04 +0200
committerOxbian <got.dacs@slmail.me>2023-05-10 21:56:04 +0200
commit57ccdfae66aad9f3969e37e77a1bb6b5d550ec1e (patch)
tree440bdfb385a7fe1bffbdb13ecaea99f653e67f89 /tools
parent284cf939ce32ed9a85c9d1b8a0d515ccc204bc0e (diff)
downloadArKa-Blog-57ccdfae66aad9f3969e37e77a1bb6b5d550ec1e.tar.gz
ArKa-Blog-57ccdfae66aad9f3969e37e77a1bb6b5d550ec1e.zip
Corrections de petits bugs / fautes, modifications mineures du script python pour accepter les caracètres spéciaux pour le HTML
Diffstat (limited to 'tools')
-rw-r--r--tools/page-generator.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/page-generator.py b/tools/page-generator.py
index 1257a73..63526cb 100644
--- a/tools/page-generator.py
+++ b/tools/page-generator.py
@@ -1,4 +1,5 @@
import os
+import html
articles_path = 'articles/'
generate_path = 'pages/'
@@ -79,8 +80,12 @@ def parsemd(filename):
content['content'] += "</code></pre>\n"
inpre = False
return content
-
+
+"""Parse une ligne de texte afin d'enlever les caractères spéciaux html, les liens, et symboles gras / italiques du markdown"""
def parseline(line):
+ # Change les &, <, > pour le support en HTML
+ html.escape(line)
+
# Vérifie si on a des italiques ou gras
while '*' in line:
line = line.replace('*', '<i>', 1)
@@ -102,6 +107,7 @@ def parseline(line):
line = line.replace('[' + title + '](' + link + ')', '<a href="' + link + '">' + title + '</a>')
return line
+"""Fonction pour transformer un fichier markdown en page html"""
def md2html(filename):
content = parsemd(filename) # Contenu parsé de notre fichier markdown
template = open('page_template.html', 'r').read()
ArKa projects. All rights to me, and your next child right arm.