From: Márton Németh <nm...@freemail.hu>

Make sure that the HTML output can be cleanly validated by the W3C Markup
Validation Service and W3C CSS Validation Service:
 * http://validator.w3.org/#validate_by_upload
 * http://jigsaw.w3.org/css-validator/#validate_by_upload

Signed-off-by: Márton Németh <nm...@freemail.hu>
---
diff --git a/README b/README
index 1eacfa7..681f395 100644
--- a/README
+++ b/README
@@ -62,6 +62,11 @@ powertop --html
 which will create a "powertop.html" file which is static and can be sent to
 others to help diagnose power issues.

+Note for the developers: if you make changes on the report format please
+make sure that the output can be cleanly validated by the W3C Markup
+Validation Service and W3C CSS Validation Service:
+ * http://validator.w3.org/#validate_by_upload
+ * http://jigsaw.w3.org/css-validator/#validate_by_upload


 Calibrating & Power Numbers
diff --git a/cpu/cpu.cpp b/cpu/cpu.cpp
index 563aa30..d8b4081 100644
--- a/cpu/cpu.cpp
+++ b/cpu/cpu.cpp
@@ -361,7 +361,7 @@ void report_display_cpu_cstates(void)
                        continue;

                if (reporttype)
-                       fprintf(reportout.http_report,"<table width=100%%>\n");
+                       fprintf(reportout.http_report,"<table 
width=\"100%%\">\n");
                else
                        fprintf(reportout.csv_report,"\n");

@@ -387,7 +387,7 @@ void report_display_cpu_cstates(void)
                                        if (first_pkg == 0) {
                                                if (reporttype)
                                                        
fprintf(reportout.http_report,
-                                                                               
"<th colspan=2 class=\"package_header\" width=25%%>%s</th>"
+                                                                               
"<th colspan=2 class=\"package_header\" width=\"25%%\">%s</th>"
                                                                                
, _package->fill_cstate_line(line, buffer));
                                                else
                                                        
fprintf(reportout.csv_report, ",%s,", "Package");
@@ -400,7 +400,7 @@ void report_display_cpu_cstates(void)
                                } else if (first_pkg == 0) {

                                        if (reporttype)
-                                               fprintf(reportout.http_report, 
"<td class=\"%s\" width=10%%>%s</td><td class=\"%s\">%s</td>",
+                                               fprintf(reportout.http_report, 
"<td class=\"%s\" width=\"10%%\">%s</td><td class=\"%s\">%s</td>",
                                                        freq_class(actual_line),
                                                        
_package->fill_cstate_name(line, buffer),
                                                        
package_class(actual_line),
@@ -418,7 +418,7 @@ void report_display_cpu_cstates(void)


                                if (reporttype)
-                                               
fprintf(reportout.http_report,"<td width=2%%>&nbsp;</td>");
+                                               
fprintf(reportout.http_report,"<td width=\"2%%\">&nbsp;</td>");

                                if (!_core->can_collapse()) {
                                        buffer[0] = 0;
@@ -427,7 +427,7 @@ void report_display_cpu_cstates(void)
                                        if (line == LEVEL_HEADER) {
                                                if (reporttype) {
                                                        
fprintf(reportout.http_report,
-                                                               "<th colspan=2 
class=\"core_header\" width=25%%>%s</th>",
+                                                               "<th colspan=2 
class=\"core_header\" width=\"25%%\">%s</th>",
                                                                
_core->fill_cstate_line(line, buffer2));
                                            } else {
                                                        if (!first_pkg==0) {
@@ -443,7 +443,7 @@ void report_display_cpu_cstates(void)
                                        } else {
                                                if (reporttype) {
                                                        
fprintf(reportout.http_report,
-                                                               "<td 
class=\"%s\" width=10%%>%s</td><td class=\"%s\">%s</td>",
+                                                               "<td 
class=\"%s\" width=\"10%%\">%s</td><td class=\"%s\">%s</td>",
                                                                
freq_class(actual_line),
                                                                
_core->fill_cstate_name(line, buffer),
                                                                
core_class(actual_line),
@@ -465,7 +465,7 @@ void report_display_cpu_cstates(void)
                                }

                                if (reporttype)
-                                       fprintf(reportout.http_report,"<td 
width=2%%>&nbsp;</td>");
+                                       fprintf(reportout.http_report,"<td 
width=\"2%%\">&nbsp;</td>");

                                for (cpu = 0; cpu < _core->children.size(); 
cpu++) {
                                        _cpu = _core->children[cpu];
@@ -482,7 +482,7 @@ void report_display_cpu_cstates(void)
                                        } else {
                                                if (first == 1) {
                                                        if (reporttype )
-                                                               
fprintf(reportout.http_report,"<td class=\"%s\" width=10%%>%s</td>",
+                                                               
fprintf(reportout.http_report,"<td class=\"%s\" width=\"10%%\">%s</td>",
                                                                        
freq_class(actual_line),
                                                                        
_cpu->fill_cstate_name(line, buffer));
                                                        else
@@ -651,7 +651,7 @@ void report_display_cpu_pstates(void)
                        continue;

                if (reporttype)
-                       fprintf(reportout.http_report,"<table width=100%%>\n");
+                       fprintf(reportout.http_report,"<table 
width=\"100%%\">\n");
                else
                        fprintf(reportout.csv_report,"\n");

@@ -677,7 +677,7 @@ void report_display_cpu_pstates(void)
                                        if (line == LEVEL_HEADER) {
                                                 if (reporttype)
                                                                
fprintf(reportout.http_report,
-                                                                       "<th 
colspan=2 class=\"package_header\" width=25%%>%s%s</th>",
+                                                                       "<th 
colspan=2 class=\"package_header\" width=\"25%%\">%s%s</th>",
                                                                        
_package->fill_pstate_name(line, buffer),
                                                                        
_package->fill_pstate_line(line, buffer2));
                                                else
@@ -686,7 +686,7 @@ void report_display_cpu_pstates(void)
                                        } else {
                                                if (reporttype) {
                                                        
fprintf(reportout.http_report,
-                                                               "<td 
class=\"%s\" width=10%%>%s</td><td class=\"%s\">%s</td>",
+                                                               "<td 
class=\"%s\" width=\"10%%\">%s</td><td class=\"%s\">%s</td>",
                                                                
freq_class(line),
                                                                
_package->fill_pstate_name(line, buffer),
                                                                
package_class(line),
@@ -704,7 +704,7 @@ void report_display_cpu_pstates(void)


                                if (reporttype)
-                                       fprintf(reportout.http_report,"<td 
width=2%%>&nbsp;</td>");
+                                       fprintf(reportout.http_report,"<td 
width=\"2%%\">&nbsp;</td>");

                                if (!_core->can_collapse()) {
                                        buffer[0] = 0;
@@ -712,7 +712,7 @@ void report_display_cpu_pstates(void)
                                        if (line == LEVEL_HEADER) {
                                                if (reporttype) {
                                                fprintf(reportout.http_report,
-                                                       "<th colspan=2 
class=\"core_header\" width=25%%>%s%s</th>",
+                                                       "<th colspan=2 
class=\"core_header\" width=\"25%%\">%s%s</th>",
                                                        
_core->fill_pstate_name(line, buffer),
                                                        
_core->fill_pstate_line(line, buffer2));
                                                } else {
@@ -730,7 +730,7 @@ void report_display_cpu_pstates(void)
                                        }else {
                                                if (reporttype) {
                                                        
fprintf(reportout.http_report,
-                                                               "<td 
class=\"%s\" width=10%%>%s</td><td class=\"%s\">%s</td>",
+                                                               "<td 
class=\"%s\" width=\"10%%\">%s</td><td class=\"%s\">%s</td>",
                                                                
freq_class(line),
                                                                
_core->fill_pstate_name(line, buffer),
                                                                
core_class(line),
@@ -750,7 +750,7 @@ void report_display_cpu_pstates(void)
                                }

                                if (reporttype)
-                                       fprintf(reportout.http_report,"<td 
width=2%%>&nbsp;</td>");
+                                       fprintf(reportout.http_report,"<td 
width=\"2%%\">&nbsp;</td>");

                                for (cpu = 0; cpu < _core->children.size(); 
cpu++) {
                                        buffer[0] = 0;
@@ -770,7 +770,7 @@ void report_display_cpu_pstates(void)
                                                if (first == 1) {
                                                        if (reporttype)
                                                                
fprintf(reportout.http_report,
-                                                                       "<td 
class=\"%s\" width=10%%>%s</td>",
+                                                                       "<td 
class=\"%s\" width=\"10%%\">%s</td>",
                                                                        
freq_class(line),
                                                                        
_cpu->fill_pstate_name(line, buffer));
                                                        else
diff --git a/devices/device.cpp b/devices/device.cpp
index 6fc72a6..1caa9af 100644
--- a/devices/device.cpp
+++ b/devices/device.cpp
@@ -265,10 +265,10 @@ void show_report_devices(void)
                char buf[32];
                if (reporttype) {
                        fprintf(reportout.http_report,
-                               "<p>System baseline power is estimated at 
%sW</p>\n <table width=100%%>\n",
+                               "<p>System baseline power is estimated at 
%sW</p>\n <table width=\"100%%\">\n",
                                fmt_prefix(get_parameter_value("base power"), 
buf));
                        fprintf(reportout.http_report,
-                               "<tr><th width=10%%>Power est.</th><th 
width=10%%>Usage</th><th class=\"device\">Device name</th></tr>\n");
+                               "<tr><th width=\"10%%\">Power est.</th><th 
width=\"10%%\">Usage</th><th class=\"device\">Device name</th></tr>\n");
                } else {
                        fprintf(reportout.csv_report,
                                "System baseline power is estimated at:,  %sW, 
\n\n",
@@ -279,7 +279,7 @@ void show_report_devices(void)
        }else {
                if (reporttype)
                        fprintf(reportout.http_report,
-                                       " <table width=100%%>\n <tr><th 
width=10%%>Usage</th><th class=\"device\">Device name</th></tr>\n");
+                                       " <table width=\"100%%\">\n <tr><th 
width=\"10%%\">Usage</th><th class=\"device\">Device name</th></tr>\n");
                else
                        fprintf(reportout.csv_report,
                                        "Usage:, Device name:, \n");
diff --git a/devlist.cpp b/devlist.cpp
index 993e8d6..6fad8f9 100644
--- a/devlist.cpp
+++ b/devlist.cpp
@@ -306,8 +306,8 @@ void report_show_open_devices(void)
        sort(target->begin(), target->end(), devlist_sort);

        if (reporttype) {
-               fprintf(reportout.http_report,_("<h2>Process device 
activity</h2>\n <table width=100%%>\n"));
-               fprintf(reportout.http_report,_("<tr><th class=\"device\" 
width=40%%>Process</th><th class=\"device\">Device</th></tr>\n"));
+               fprintf(reportout.http_report,_("<h2>Process device 
activity</h2>\n <table width=\"100%%\">\n"));
+               fprintf(reportout.http_report,_("<tr><th class=\"device\" 
width=\"40%%\">Process</th><th class=\"device\">Device</th></tr>\n"));
        }else {
                fprintf(reportout.csv_report,_("**Process Device Activity**, 
\n\n"));
                fprintf(reportout.csv_report,_("Process, Device, \n"));
diff --git a/po/nl.po b/po/nl.po
index e77f435..caa44ad 100644
--- a/po/nl.po
+++ b/po/nl.po
@@ -88,7 +88,7 @@ msgstr ""
 #: devlist.cpp:306
 #, c-format
 msgid ""
-"<tr><th class=\"device\" width=40%%>Process</th><th class=\"device\">Device</"
+"<tr><th class=\"device\" width=\"40%%\">Process</th><th 
class=\"device\">Device</"
 "th></tr>\n"
 msgstr ""

diff --git a/process/do_process.cpp b/process/do_process.cpp
index e247f66..332a8e4 100644
--- a/process/do_process.cpp
+++ b/process/do_process.cpp
@@ -752,13 +752,13 @@ void report_process_update_display(void)

        if (reporttype){
                fprintf(reportout.http_report,
-                       "<h2>Overview of Software Power Consumers</h2>\n <table 
width=100%%>\n");
+                       "<h2>Overview of Software Power Consumers</h2>\n <table 
width=\"100%%\">\n");
                if (show_power)
                        fprintf(reportout.http_report,
-                               "<tr><th width=10%%>Power est.</th><th 
width=10%%>Usage</th><th width=10%%>Wakeups/s</th><th width=10%%>GPU 
ops/s</th><th width=10%%>Disk IO/s</th><th
width=10%%>GFX Wakeups/s</th><th width=10%% class=\"process\">Category</th><th 
class=\"process\">Description</th></tr>\n");
+                               "<tr><th width=\"10%%\">Power est.</th><th 
width=\"10%%\">Usage</th><th width=\"10%%\">Wakeups/s</th><th 
width=\"10%%\">GPU ops/s</th><th
width=\"10%%\">Disk IO/s</th><th width=\"10%%\">GFX Wakeups/s</th><th 
width=\"10%%\" class=\"process\">Category</th><th 
class=\"process\">Description</th></tr>\n");
                else
                        fprintf(reportout.http_report,
-                               "<tr><th width=10%%>Usage</th><th 
width=10%%>Wakeups/s</th><th width=10%%>GPU ops/s</th><th width=10%%>Disk 
IO/s</th><th width=10%%>GFX Wakeups/s</th><th
width=10%% class=\"process\">Category</th><th 
class=\"process\">Description</th></tr>\n");
+                               "<tr><th width=\"10%%\">Usage</th><th 
width=\"10%%\">Wakeups/s</th><th width=\"10%%\">GPU ops/s</th><th 
width=\"10%%\">Disk IO/s</th><th width=\"10%%\">GFX
Wakeups/s</th><th width=\"10%%\" class=\"process\">Category</th><th 
class=\"process\">Description</th></tr>\n");
        }else {
                fprintf(reportout.csv_report,"**Overview of Software Power 
Consumers**, \n\n");
                if (show_power)
@@ -869,15 +869,15 @@ void report_summary(void)
                fprintf(reportout.http_report,
                        "<h2>Power Consumption Summary</h2>\n");
                fprintf(reportout.http_report,
-                       "<p>%3.1f wakeups/second,  %3.1f GPU ops/second, %3.1f 
VFS ops/sec, %3.1f GFX wakes/sec and %3.1f%% CPU use</p>\n <table 
width=100%%>\n",
+                       "<p>%3.1f wakeups/second,  %3.1f GPU ops/second, %3.1f 
VFS ops/sec, %3.1f GFX wakes/sec and %3.1f%% CPU use</p>\n <table 
width=\"100%%\">\n",
                        total_wakeups(), total_gpu_ops(), total_disk_hits(), 
total_xwakes(), total_cpu_time()*100);

                if (show_power)
                        fprintf(reportout.http_report,
-               "<tr><th width=10%%>Power est.</th><th width=10%%>Usage</th><th 
width=10%%>Events/s</th><th width=10%% class=\"process\">Category</th><th
class=\"process\">Description</th></tr>\n");
+                       "<tr><th width=\"10%%\">Power est.</th><th 
width=\"10%%\">Usage</th><th width=\"10%%\">Events/s</th><th width=\"10%%\" 
class=\"process\">Category</th><th
class=\"process\">Description</th></tr>\n");
                else
                fprintf(reportout.http_report,
-               "<tr><th width=10%%>Usage</th><th width=10%%>Events/s</th><th 
width=10%% class=\"process\">Category</th><th
class=\"process\">Description</th></tr>\n");
+                       "<tr><th width=\"10%%\">Usage</th><th 
width=\"10%%\">Events/s</th><th width=\"10%%\" 
class=\"process\">Category</th><th
class=\"process\">Description</th></tr>\n");

        }else {
                fprintf(reportout.csv_report,
diff --git a/report.cpp b/report.cpp
index 47f2f37..4ec7ce9 100644
--- a/report.cpp
+++ b/report.cpp
@@ -122,8 +122,8 @@ static void system_info(void)
        if (reporttype) {
                fprintf(reportout.http_report, "<h1>PowerTOP Report</h1>\n");
                fprintf(reportout.http_report, "<h2>System Information</h2>\n");
-               fprintf(reportout.http_report, "<table width=100%%>\n");
-               fprintf(reportout.http_report, "<tr class=\"system_even\"><td 
width=20%%>PowerTOP Version</td><td>%s</td></tr>\n", POWERTOP_VERSION);
+               fprintf(reportout.http_report, "<table width=\"100%%\">\n");
+               fprintf(reportout.http_report, "<tr class=\"system_even\"><td 
width=\"20%%\">PowerTOP Version</td><td>%s</td></tr>\n", POWERTOP_VERSION);
        } else {
                fprintf(reportout.csv_report, "***PowerTOP Report***, \n");
                fprintf(reportout.csv_report, "**System Information**, \n");
@@ -214,8 +214,10 @@ void init_report_output(char *filename_str)
 void http_header_output(void) {
        if (!reportout.http_report)
                return;
-       fprintf(reportout.http_report, "<!DOCTYPE html PUBLIC \"-//W3C/DTD HTML 
4.01//EN\">\n");
+       fprintf(reportout.http_report, "<!DOCTYPE html PUBLIC \"-//W3C//DTD 
HTML 4.01 Transitional//EN\">\n");
        fprintf(reportout.http_report, "<html>\n\n <head>\n");
+       fprintf(reportout.http_report, "<meta http-equiv=\"Content-Type\" 
content=\"text/html;charset=utf-8\">\n");
+       fprintf(reportout.http_report, "<title>PowerTOP Report</title>\n");

        css_header();

diff --git a/tuning/tuning.cpp b/tuning/tuning.cpp
index d0e0078..c48e209 100644
--- a/tuning/tuning.cpp
+++ b/tuning/tuning.cpp
@@ -223,7 +223,7 @@ void report_show_tunables(void)

                if (line == 0) {
                        if(reporttype)
-                               fprintf(reportout.http_report,"<h2>Software 
Settings in need of Tuning</h2>\n <p><table width=100%%>\n");
+                               fprintf(reportout.http_report,"<h2>Software 
Settings in need of Tuning</h2>\n <table width=\"100%%\">\n");
                        else
                                fprintf(reportout.csv_report,"**Software 
Settings in need of Tuning**, \n\n");

@@ -241,7 +241,7 @@ void report_show_tunables(void)

        if (line > 0)
                if(reporttype)
-                       fprintf(reportout.http_report,"</table></p>\n");
+                       fprintf(reportout.http_report,"</table>\n");
                else
                        fprintf(reportout.csv_report, "\n");

@@ -251,7 +251,7 @@ void report_show_tunables(void)
                if (line == 0) {
                        if(reporttype)
                                fprintf(reportout.http_report,
-                                       "<h2>Untunable Software Issues</h2>\n 
<p><table width=100%%>\n");
+                                       "<h2>Untunable Software Issues</h2>\n 
<table width=\"100%%\">\n");
                        else
                                fprintf(reportout.csv_report,
                                        "**Untunable Software Issues**,\n\n");
@@ -271,7 +271,7 @@ void report_show_tunables(void)

        if (line > 0)
                if(reporttype)
-                       fprintf(reportout.http_report,"</table></p>\n");
+                       fprintf(reportout.http_report,"</table>\n");
                else
                        fprintf(reportout.csv_report,"\n");

@@ -287,7 +287,7 @@ void report_show_tunables(void)
                if (line == 0) {
                        if (reporttype)
                                fprintf(reportout.http_report,
-                                       "<h2>Optimal Tuned Software 
Settings</h2>\n <p><table width=100%%>\n");
+                                       "<h2>Optimal Tuned Software 
Settings</h2>\n <table width=\"100%%\">\n");
                        else
                                fprintf(reportout.csv_report,
                                        "**Optimal Tuned Software Settings**, 
\n\n");
@@ -306,7 +306,7 @@ void report_show_tunables(void)

        if (line > 0){
                if (reporttype)
-                       fprintf(reportout.http_report,"</table></p>\n");
+                       fprintf(reportout.http_report,"</table>\n");
                else
                        fprintf(reportout.csv_report,"\n");
        }

_______________________________________________
Power mailing list
Power@bughost.org
https://bughost.org/mailman/listinfo/power

Reply via email to