OcttKB/Wiki-OcttKB/tiddlers/System/$__OcttKB_Repo_PatchStatic.py.txt

13 lines
350 B
Python

#!/usr/bin/env python3
from bs4 import BeautifulSoup
from re import sub
File = 'Static.html'
def Fix1(m):
return f'<details><a name="{m.group(1)}"></a><summary>{m.group(2)}</summary>'
Source = str(BeautifulSoup(open(File, 'r'), 'html5lib'));
open(File, 'w').write(sub('<details><a name="(.+)"><summary>(.+)<\/summary>\s*<\/a>', Fix1, Source));