[flashrom] [PATCH] print_wiki: Expand previous MediaWiki templates within C.

Stefan Tauner stefan.tauner at alumni.tuwien.ac.at
Wed May 28 15:21:24 CEST 2014


Signed-off-by: Stefan Tauner <stefan.tauner at alumni.tuwien.ac.at>
---

On top of r1804 the discussed approach of expanding the templates within
flashrom would look like below and increase the -z output
from ~186 kB to 393 kB. This is not for merge IMO.

 print_wiki.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/print_wiki.c b/print_wiki.c
index b01ab75..615925d 100644
--- a/print_wiki.c
+++ b/print_wiki.c
@@ -101,12 +101,12 @@ static const char programmer_th[] = "\
 static const char *test_state_to_template(enum test_state test_state)
 {
 	switch (test_state) {
-	case OK: return "OK";
-	case BAD: return "No";
-	case NA: return "NA";
-	case DEP: return "Dep";
+	case OK: return "style=\"background:lime; color:black; text-align:center;\" class=\"table-ok\" | {{{1|OK}}}";
+	case BAD: return "style=\"background:red; color:black; text-align:center;\" class=\"table-no\" | {{{1|No}}}";
+	case NA: return "style=\"background:Gainsboro; color:Gray; text-align:center;\" class=\"table-na\" | {{{1|N/A}}}";
+	case DEP: return "style=\"background:orange; color:black; text-align:center;\" class=\"table-deb\" | {{{1|Dep}}}";
 	case NT:
-	default: return "?3";
+	default: return "style=\"background:#bfff00; color:black; text-align:center;\" class=\"table-unknown\" | {{{1|?}}}";
 	}
 }
 
@@ -207,7 +207,7 @@ static void print_supported_boards_wiki_helper(const char *devicetype, int cols,
 		}
 
 		printf("|- bgcolor=\"#%s\"\n| %s || %s%s %s%s || %s%s%s%s "
-		       "|| {{%s}}", (color) ? "eeeeee" : "dddddd",
+		       "|| %s", (color) ? "eeeeee" : "dddddd",
 		       boards[i].vendor,
 		       boards[i].url ? "[" : "",
 		       boards[i].url ? boards[i].url : "",
@@ -304,7 +304,7 @@ static void print_supported_chips_wiki(int cols)
 		sprintf(vmin, "%0.03f", f->voltage.min / (double)1000);
 		sprintf(vmax, "%0.03f", f->voltage.max / (double)1000);
 		printf("|- bgcolor=\"#%s\"\n| %s || %s || align=\"right\" | %d "
-		       "|| %s || {{%s}} || {{%s}} || {{%s}} || {{%s}}"
+		       "|| %s || %s || %s || %s || %s"
 		       "|| %s || %s \n",
 		       (c == 1) ? "eeeeee" : "dddddd", f->vendor, f->name,
 		       f->total_size, s,
@@ -351,7 +351,7 @@ static void print_supported_devs_wiki_helper(const struct programmer_entry prog)
 		printf("|- bgcolor=\"#%s\"\n", (c) ? "eeeeee" : "dddddd");
 		if (i == 0)
 			printf("| rowspan=\"%u\" | %s |", count, prog.name);
-		printf("| %s || %s || %04x:%04x || {{%s}}\n", devs[i].vendor_name, devs[i].device_name,
+		printf("| %s || %s || %04x:%04x || %s\n", devs[i].vendor_name, devs[i].device_name,
 		       devs[i].vendor_id, devs[i].device_id, test_state_to_template(devs[i].status));
 	}
 }
-- 
Kind regards, Stefan Tauner





More information about the flashrom mailing list