mirror of
https://github.com/matrix-org/matrix-spec
synced 2025-12-24 01:58:36 +01:00
Fix regex for some versions of python
This commit is contained in:
parent
7ada960206
commit
550f95570b
|
|
@ -283,12 +283,12 @@ def addAnchors(path):
|
||||||
with open(path, "rb") as f:
|
with open(path, "rb") as f:
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
|
|
||||||
replacement = replacement = r'<p><a class="anchor" id="\3"></a></p>\n\1'
|
replacement = r'<p><a class="anchor" id="\2"></a></p>\n\1'
|
||||||
with open(path, "wb") as f:
|
with open(path, "wb") as f:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
line = line.decode("UTF-8")
|
line = line.decode("UTF-8")
|
||||||
line = re.sub(r'(<h\d id="#?(.*?)">)', replacement, line.rstrip())
|
line = re.sub(r'(<h\d id="#?(.*?)">)', replacement, line.rstrip())
|
||||||
line = re.sub(r'(<div class="section" (id)="(.*?)">)', replacement, line.rstrip())
|
line = re.sub(r'(<div class="section" id="(.*?)">)', replacement, line.rstrip())
|
||||||
f.write((line + "\n").encode('UTF-8'))
|
f.write((line + "\n").encode('UTF-8'))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue