This commit is contained in:
Guilhem Fauré 2023-05-16 11:31:44 +02:00
parent 1076040316
commit 869714f926
3 changed files with 19 additions and 19 deletions

View File

@ -92,23 +92,6 @@ class Article:
return errors return errors
def highlightUnknownChars(text):
# Define terminal escape sequences to stylize output, regex escaped
COLOR = "\033[91m" + "\033[1m" # Red + Bold
RESET = "\033[0m"
# Highlight in COLOR unknown chars in text
for char in unknownIso:
for match in finditer(char, text):
text = (
text[: match.start()]
+ COLOR
+ match.group()
+ RESET
+ text[match.end() :]
)
return text
class Articles: class Articles:
exported: int = 0 exported: int = 0

View File

@ -1,4 +1,4 @@
from re import I, S, compile from re import I, S, compile, finditer
# SPIP syntax to Markdown # SPIP syntax to Markdown
spipToMarkdown = ( spipToMarkdown = (
@ -274,3 +274,19 @@ def convertMeta(spipMeta):
for iso, utf in isoToUtf: for iso, utf in isoToUtf:
text.replace(iso, utf) text.replace(iso, utf)
return text return text
def highlightUnknownChars(text):
# Define terminal escape sequences to stylize output, regex escaped
COLOR = "\033[91m" + "\033[1m" # Red + Bold
RESET = "\033[0m"
# Highlight in COLOR unknown chars in text
for char in unknownIso:
for match in finditer(char, text):
text = (
text[: match.start()]
+ COLOR
+ match.group()
+ RESET
+ text[match.end() :]
)
return text

View File

@ -1,7 +1,8 @@
#!python #!python
from config import config from config import config
from database import db from database import db
from iterator import Articles, highlightUnknownChars from articles import Articles
from converter import highlightUnknownChars
if __name__ != "__main__": if __name__ != "__main__":
exit() exit()