mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Added replacement of head tag again
This commit is contained in:
5
Moose Development/docs-header.html
Normal file
5
Moose Development/docs-header.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<head>
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-97385487-1"></script>
|
||||
<script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'UA-97385487-1');</script>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
26
Moose Development/docs-header.py
Normal file
26
Moose Development/docs-header.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# import required module
|
||||
from pathlib import Path
|
||||
import os
|
||||
|
||||
# assign directory
|
||||
directory = '.'
|
||||
|
||||
print( "Replacing head tag in all html files" )
|
||||
|
||||
# Read template file
|
||||
with open( os.path.dirname(__file__) + '/docs-header.html', 'r') as file:
|
||||
newhead = file.read()
|
||||
|
||||
# iterate over files in
|
||||
# that directory
|
||||
files = Path(directory).glob('*.html')
|
||||
for file in files:
|
||||
# print(file)
|
||||
with open(file, 'r') as fileread:
|
||||
filedata = fileread.read()
|
||||
# Replace the target string
|
||||
filedata = filedata.replace( '<head>', newhead )
|
||||
|
||||
# Write the file out again
|
||||
with open(file, 'w') as filewrite:
|
||||
filewrite.write(filedata)
|
||||
Reference in New Issue
Block a user