From 2ef472f157e72cb30e8bd422c2bca6a611a78ea5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 24 Dec 2020 10:49:23 +0100
Subject: [PATCH] run_my_doc: make TestPage_viewTestReport valid HTML
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Don't use inline <style> in a <div>, but in an external <link>.

This fixes:

    Using nu validator to parse the view "TestPage_viewTestReport" (from erp5_run_my_doc bt) with warnings displayed :
    Error: line 581 column 23 : Element “style” not allowed as child of element “div” in this context. (Suppressing further errors from this subtree.): "><div  >
    <style type="text/css">
    body,
---
 .../erp5_run_my_doc/TestPage_testReportCSS.py | 43 ++-----------------
 .../erp5_run_my_doc/test_page_report.css.css  | 35 +++++++++++++++
 .../erp5_run_my_doc/test_page_report.css.xml  | 28 ++++++++++++
 3 files changed, 66 insertions(+), 40 deletions(-)
 create mode 100644 bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/test_page_report.css.css
 create mode 100644 bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/test_page_report.css.xml

diff --git a/bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPage_testReportCSS.py b/bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPage_testReportCSS.py
index e8ea6aef12..19ef7f53d4 100644
--- a/bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPage_testReportCSS.py
+++ b/bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPage_testReportCSS.py
@@ -1,40 +1,3 @@
-return """
-<style type="text/css">
-body, table {
-    font-family: Verdana,Arial,sans-serif;
-    font-size: 24px;
-    margin:auto;
-}
-table {
-    border: 1px solid #CCCCCC;
-    border-collapse: collapse;
-}
-th, td {
-    padding-left: 0.3em;
-    padding-right: 0.3em;
-}
-a {
-    text-decoration: none;
-}
-.title {
-    font-style: italic;
-}
-.selected {
-    background-color: #FFFFCC;
-}
-.status_done {
-    background-color: #EEFFEE;
-}
-.status_passed {
-    background-color: #CCFFCC;
-}
-.status_failed {
-    background-color: #FFCCCC;
-}
-.breakpoint {
-    background-color: #CCCCCC;
-    border: 1px solid black;
-}
-</style>
-
-"""
+return """\
+<link rel="stylesheet" type="text/css" href="{}/test_page_report.css">
+""".format(context.getPortalObject().absolute_url())
diff --git a/bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/test_page_report.css.css b/bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/test_page_report.css.css
new file mode 100644
index 0000000000..c938a3a55b
--- /dev/null
+++ b/bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/test_page_report.css.css
@@ -0,0 +1,35 @@
+body, table {
+    font-family: Verdana,Arial,sans-serif;
+    font-size: 24px;
+    margin:auto;
+}
+table {
+    border: 1px solid #CCCCCC;
+    border-collapse: collapse;
+}
+th, td {
+    padding-left: 0.3em;
+    padding-right: 0.3em;
+}
+a {
+    text-decoration: none;
+}
+.title {
+    font-style: italic;
+}
+.selected {
+    background-color: #FFFFCC;
+}
+.status_done {
+    background-color: #EEFFEE;
+}
+.status_passed {
+    background-color: #CCFFCC;
+}
+.status_failed {
+    background-color: #FFCCCC;
+}
+.breakpoint {
+    background-color: #CCCCCC;
+    border: 1px solid black;
+}
\ No newline at end of file
diff --git a/bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/test_page_report.css.xml b/bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/test_page_report.css.xml
new file mode 100644
index 0000000000..65873dc7de
--- /dev/null
+++ b/bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/test_page_report.css.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="File" module="OFS.Image"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>__name__</string> </key>
+            <value> <string>test_page_report.css</string> </value>
+        </item>
+        <item>
+            <key> <string>content_type</string> </key>
+            <value> <string>text/css</string> </value>
+        </item>
+        <item>
+            <key> <string>precondition</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
-- 
2.30.9