Fix regex for some versions of python
This commit is contained in:
parent
7ada960206
commit
550f95570b
1 changed files with 2 additions and 2 deletions
|
@ -283,12 +283,12 @@ def addAnchors(path):
|
|||
with open(path, "rb") as f:
|
||||
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:
|
||||
for line in lines:
|
||||
line = line.decode("UTF-8")
|
||||
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'))
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue