Merge pull request #2277 from FlightControl-Master/master

Update docs-header.py
This commit is contained in:
Thomas 2025-04-06 16:33:05 +02:00 committed by GitHub
commit b9f6c1b9c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,7 @@
# import required module
from pathlib import Path
import os
import codecs
# assign directory
directory = '.'
@ -15,8 +16,9 @@ with open( os.path.dirname(__file__) + '/docs-header.html', 'r') as file:
# that directory
files = Path(directory).glob('*.html')
for file in files:
print(file)
with open(file, 'r') as fileread:
#print(file)
#with open(file, 'r') as fileread:
with codecs.open(file, 'r', encoding='utf-8', errors='ignore') as fileread:
filedata = fileread.read()
# Replace the target string
filedata = filedata.replace( '<head>', newhead )