This seems to work as a regex function:
Code:
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
return '<h1>'+match.group(1).replace('<br/>',' ').replace('<br/>',' ').replace('<br/>',' ')+'</h1>'
I did multiple replaces because there are up to three <br/>s in headings.
I used create TOC from headings and it's added ids throughout, including blanks ones, e.g.:
Code:
<h1 id="toc_21">Security measures adopted by Atlantis/Shanghai.</h1><h1 id="toc_22"></h1>
Is this normal?