aboutsummaryrefslogtreecommitdiffstats
path: root/tools/colorfilters2js.pl
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2011-05-19 18:10:21 +0000
committerGerald Combs <gerald@wireshark.org>2011-05-19 18:10:21 +0000
commit99d4de66e59c134ba34d61562a03924eddc7df8a (patch)
tree8d090c2b3a5a19f9654b543da753da53d8baa4a4 /tools/colorfilters2js.pl
parent375b1bf4b4331f466acafb1b632a72cc90c76d05 (diff)
From Dirk Jagdmann via bug 5875:
My attachment adds a link to a XSLT file to the preamble of the PDML. The XSLT will transform the PDML to a HTML page, and the HTML page features a look similar to Wireshark. See http://cubic.org/~doj/ebay/a.pdml for an example. The patch also contains a small perl program which converts the Wireshark colortable into javascript code which is used in the XSLT file. If you want to use a different color scheme you would execute the perl program and insert the generated javascript function into your XSLT file. To view the HTML you could either place the PDML and XSLT file on your webserver and verify that your webserver sends the PDML file as "text/xml". Then your webbrowser will find the linked XSLT file, download that as well and convert the PDML to HTML on the fly. You could also use an XSLT processor like xsltproc to convert the PDML and XSLT into a static HTML file. From me: Minor fixups. svn path=/trunk/; revision=37298
Diffstat (limited to 'tools/colorfilters2js.pl')
-rw-r--r--tools/colorfilters2js.pl38
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/colorfilters2js.pl b/tools/colorfilters2js.pl
new file mode 100644
index 0000000000..03f09025a3
--- /dev/null
+++ b/tools/colorfilters2js.pl
@@ -0,0 +1,38 @@
+#!/usr/bin/env perl
+#
+# perl program to convert a Wireshark color scheme to javascript
+# code. The javascript function should then be inserted into the
+# pdml2html.xsl file.
+#
+# run this as: perl tools/colorfilters2js.pl colorfilters
+
+print<<'EOF';
+function set_node_color(node,colorname)
+{
+ if(dojo.isString(node))
+ node = dojo.byId(node);
+ if(!node) return;
+ var fg;
+ var bg;
+EOF
+
+while(<>)
+{
+ if(/\@(.+?)\@.+\[(\d+),(\d+),(\d+)\]\[(\d+),(\d+),(\d+)\]/)
+ {
+ print " if(colorname == '$1') {\n";
+ printf(" bg='#%02x%02x%02x';\n", $2/256, $3/256, $4/256);
+ printf(" fg='#%02x%02x%02x';\n", $5/256, $6/256, $7/256);
+ print " }\n";
+ }
+}
+
+print<<'EOF';
+ if(fg.length > 0)
+ node.style.color = fg;
+ if(bg.length > 0)
+ node.style.background = bg;
+}
+EOF
+
+exit 0;