Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""
2@file
3@brief Too old to remember what it is needed
4"""
6import re
9def cleanFileFromtohtmlreplace(content):
11 if "#" + "## tohtmlreplace BEGIN ###" in content:
12 exps = "(#" + "## tohtmlreplace BEGIN ###((.|\n)*?)"
13 exps += "#" + "## tohtmlreplace ELSE ###((.|\n)*?)"
14 exps += "#" + "## tohtmlreplace END ###"
15 exps += ")"
16 exp = re.compile(exps)
17 res = exp.findall(content)
18 if len(res) == 0:
19 raise ValueError("unable to understand the format\n" + exps)
21 for rs in res:
22 torep = rs[0]
23 byrep = rs[1]
24 content = content.replace(torep, byrep)
26 return content