1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| # fonction qui change les balise "\emph" -> "<i>"
def make_emph(emph):
reg_emph = r"\\emph{"
emph_tex = re.compile(reg_emph)
# change les balise "\emph{" -> "<i>"
emph = re.sub(emph_tex, r"<i>", emph, count=1)
# change le prochain "}"
emph = re.sub(r"}", r"</i>", emph, count=1)
return emph
def make_textbf(textbf):
reg_textbf = r"\\textbf{"
textbf_tex = re.compile(reg_textbf)
textbf = re.sub(textbf_tex, r"<strong>", textbf, count=1)
textbf = re.sub(r"}", r"</strong>", textbf, count=1)
# renvoie le texte modifie
return textbf |
Partager