Skip to content
Snippets Groups Projects
Commit a39c5550 authored by David Rouquet's avatar David Rouquet
Browse files

Replace strings in MD

parent 90130c9b
No related branches found
No related tags found
No related merge requests found
...@@ -76,7 +76,7 @@ def postEditMD(str): ...@@ -76,7 +76,7 @@ def postEditMD(str):
regexIMG = re.compile(r"@IMAGESTART.*?@IMAGEEND") regexIMG = re.compile(r"@IMAGESTART.*?@IMAGEEND")
for imageElt in regexIMG.findall(str): for imageElt in regexIMG.findall(str):
imgFilename = imageElt.replace("@IMAGESTART","").replace("@IMAGEEND","").replace(r"\_","_") imgFilename = imageElt.replace("@IMAGESTART","").replace("@IMAGEEND","").replace(r"\_","_")
imgHtml = '<img style="vertical-align:middle;" src="/macao-hugo/media/'+imgFilename+'" id="'+imgFilename+'"/>' imgHtml = '<img class="inlineImage" src="/macao-hugo/media/'+imgFilename+'" id="'+imgFilename+'"/>'
str = str.replace(imageElt, imgHtml) str = str.replace(imageElt, imgHtml)
################################################### ###################################################
...@@ -91,13 +91,21 @@ def postEditMD(str): ...@@ -91,13 +91,21 @@ def postEditMD(str):
if '@COMMENTIDSTART' in str : if '@COMMENTIDSTART' in str :
str = str.replace('@COMMENTIDSTART@','<div class="commentaireInfo" commentaireId="').replace('@COMMENTIDEND','">') + '</div>' str = str.replace('@COMMENTIDSTART@','<div class="commentaireInfo" commentaireId="').replace('@COMMENTIDEND','">') + '</div>'
################################################### ###################################################
# Add html for images and fix media paths # Add html for images and fix media paths
###################################################
regexIMG = re.compile(r"!\[\]\(\.\./media/(.*?)\)") regexIMG = re.compile(r"!\[\]\(\.\./media/(.*?)\)")
str = regexIMG.sub(r"<img src='/macao-hugo/media/\1'>", str) str = regexIMG.sub(r"<img src='/macao-hugo/media/\1'>", str)
###################################################
# Some global string replacement
###################################################
str = str.replace("""Pour vous enregistrer ou interrompre
l'enregistrement, cliquez sur le bouton rouge.
Pour vous réécouter, cliquez sur la flèche
noire.""","")
str = str.replace("hauts-parleurs","flèches")
return(str) return(str)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment