Add a banner on the old documentation docs
PATCH v5 1/1 Add a banner on the old documentation docs
Signed-off-by Abongwa Bonalais Amahnui <[email protected]>
--- trial.py | 36 ++++++++++++++++++++++++++++++ trialstyle.py | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 trial.py create mode 100644 trialstyle.py
trial.py new file +36 -0
@@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: GPL-2.0-only +# +#Signed-off-by: Abongwa Bonalais Amahnui <[email protected]> +# +# +# function to append to the content of a html file below the body tag +# +# +import os +html_content = ''' +<div id="outdated-warning">This document is outdated, you should select the <a href="https://docs.yoctoproject.org/">latest release version</a> in this series.</div> +<div xml:lang="en" class="body" lang="en"> +''' +last_div = ''' +</div> + +''' + +def loop_through_html_directories(dir): + for dirpath, dirnames, filenames in os.walk(dir): + # loop through all files in the directory + for filename in filenames: + # check if the file is an html file + if filename.endswith('.html'): + # open the html file in read mode + with open(os.path.join(dirpath, filename), 'r', encoding="ISO-8859-1") as f: + # read the content of the html file + current_content = f.read() + # open the html file in write mode + with open(os.path.join(dirpath, filename), 'w') as f: + # write the content of the html file + f.write(current_content.replace('<body>', '<body>' + html_content)) + f.write(current_content.replace('</body>', last_div + '</body>')) +loop_through_html_directories('.')
trialstyle.py new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
2.25.1