Re: [PATCH yocto-autobuilder-helper v10] Add a banner on the old documentation docs.
Quentin Schulz
Hi Amahnui,
On 4/26/22 13:55, Abongwa Amahnui Bonalais wrote:
For all other releases, use:
This version of the project is now considered obsolete, please select and use a <a href="https://docs.yoctoproject.org">more recent version</a>.
Cheers,
Quentin
On 4/26/22 13:55, Abongwa Amahnui Bonalais wrote:
Signed-off-by: Abongwa Bonalais Amahnui <abongwabonalais@...>This message is ok for Dunfell (3.1.x) releases. You could also point directly to https://docs.yoctoproject.org/dunfell/
---
scripts/docs_fix_all_html_css.py | 75 ++++++++++++++++++++++++++++++++
scripts/run-docs-build | 2 +
2 files changed, 77 insertions(+)
create mode 100755 scripts/docs_fix_all_html_css.py
diff --git a/scripts/docs_fix_all_html_css.py b/scripts/docs_fix_all_html_css.py
new file mode 100755
index 0000000..9ac5a2b
--- /dev/null
+++ b/scripts/docs_fix_all_html_css.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python3
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+#Signed-off-by: Abongwa Bonalais Amahnui <abongwabonalais@...>
+#
+#
+# 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://urldefense.proofpoint.com/v2/url?u=https-3A__docs.yoctoproject.org_&d=DwMDAg&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=QSXvmsOZCPvnujS5xVQeG1_nbbJlo9MdPDnn8pJWC8JwcBRoB0Y1lQVspWNVn0Qy&s=huYXC94XMMYriEdfcMvylQV9z5JxJ6VUTq_IBdmkY7o&e=">latest release version</a> in this series.</div>
+<div xml:lang="en" class="body" lang="en">
For all other releases, use:
This version of the project is now considered obsolete, please select and use a <a href="https://docs.yoctoproject.org">more recent version</a>.
+'''body can be modified directly in the css file without using a div. I seem to recall you told us something related to the content actually overlapping you modifications if body was used without putting it in a div? This is the comment we want in there, you explaining why we cannot keep body tag but need a div with a body class instead.
+# <div xml:lang="en" class="body" lang="en"> and </div> are added to the html files to wrap all the content below the body tag in a div tag whose class is known so it can be controlled in the css file
+last_div = '''Useless comments, please remove.
+</div>
+
+'''
+ > +css_replacement_content = '''
+
+ font-family: Verdana, Sans, sans-serif;
+
+ /*min-width: 640px;*/
+ width: 100%;
+ margin: 0;
+ padding: 0;
+ color: #333;
+ overflow-x: hidden;
+ }
+
+ /*added books too*/
+.body{
+margin: 0 auto;
+min-width: 640px;
+padding: 0 5em 5em 5em;
+}
+/* added the id below to make the banner show and be fixed*/
+#outdated-warning{
+text-align: center;
+background-color: rgb(255, 186, 186);
+color: rgb(106, 14, 14);
+padding: 0.5em 0;
+width: 100%;
+position: fixed;
+top: 0;
+
+
+'''
+ # pattern = '^3.1*'
+ # exclude = re.search(pattern, dir)
+def loop_through_html_directories(dir):It is still supported but the files you're looking through are outdated, so a different message should be printed. But something should still be printed though!
+ for root, dirs, filenames in os.walk(dir):
+ # exclude banner for 3.1.x upward as it is an LTS release and is still supported
+ exclude = set(['3.1', '3.1.1', '3.1.2', '3.1.3'])3.1.4 is still missing. You could just check for any directory whose filename is prefixed by 3.1.
Cheers,
Quentin