Squashed 'custom/convert-usage/' changes from 89c8624..bbefbc5

bbefbc5 Added usage
8be4d39 Fixed an issue with character encoding

git-subtree-dir: custom/convert-usage
git-subtree-split: bbefbc5dd202ca299e1760f6934ace79ba320499
This commit is contained in:
2024-04-07 23:13:27 +02:00
parent 4cb6b5fa4c
commit d63e5ae6a7
3 changed files with 34 additions and 3 deletions

View File

@ -29,7 +29,9 @@ def write_file(filename, text):
### Replace ###
def convert_pattern(text):
text = re.sub(re_usage, '', text, flags=re.MULTILINE)
text, success = re.subn(re_usage, '', text, flags=re.MULTILINE)
if (success == 0):
return text
soup = BeautifulSoup(text, features="html.parser")
@ -40,7 +42,7 @@ def convert_pattern(text):
calloutTitle = BeautifulSoup(callout_title_html, features="html.parser")
tag.insert_before(calloutTitle)
return str(soup)
return (soup.decode(False, formatter=None))
### Execution ###