In tables, add URL formatting.

This is pretty simplistic right now.  Any text box starting with http:// or
https:// will be assumed to be an url.  If the URL is followed by "|label
text" (in the style of some wikis) we'll use the text as the hyperlink text,
and it'll hyperlink to the url before the |.
diff --git a/render.js b/render.js
index efb0e87..b12e874 100644
--- a/render.js
+++ b/render.js
@@ -80,8 +80,39 @@
   }
 
 
+  var IS_URL_RE = RegExp('^(http|https)://');
+
+  function looksLikeUrl(s) {
+    var url, label;
+    var pos = (s || '').lastIndexOf('|');
+    if (pos >= 0) {
+      url = s.substr(0, pos);
+      label = s.substr(pos + 1);
+    } else {
+      url = s;
+      label = s;
+    }
+    if (IS_URL_RE.exec(s)) {
+      return [url, label];
+    } else {
+      return;
+    }
+  }
+
+
+  function htmlEscape(s) {
+    if (s == undefined) {
+      return s;
+    }
+    return s.replace(/&/g, '&')
+        .replace(/</g, '&lt;')
+        .replace(/>/g, '&gt;');
+  }
+
+
   function dataToGvizTable(grid, options) {
     if (!options) options = {};
+    var is_html = options.allowHtml;
     var headers = grid.headers, data = grid.data, types = grid.types;
     var dheaders = [];
     for (var i in headers) {
@@ -95,7 +126,17 @@
     for (var rowi in data) {
       var row = [];
       for (var coli in data[rowi]) {
-        var col = { v: data[rowi][coli] };
+        var cell = data[rowi][coli];
+        if (is_html && types[coli] === T_STRING) {
+          var urlresult = looksLikeUrl(cell);
+          if (urlresult) {
+            cell = '<a href="' + encodeURI(urlresult[0]) + '">' +
+                htmlEscape(urlresult[1]) + '</a>';
+          } else {
+            cell = htmlEscape(cell);
+          }
+        }
+        var col = { v: cell };
         if (options.show_only_lastseg && col.v && col.v.split) {
           var lastseg = col.v.split('|').pop();
           if (lastseg != col.v) {
@@ -1193,7 +1234,8 @@
       } else {
         var el = document.getElementById('viztable');
         t = new google.visualization.Table(el);
-        datatable = dataToGvizTable(grid);
+        datatable = dataToGvizTable(grid, { allowHtml: true });
+        options.allowHtml = true;
       }
 
       var wantwidth = trace ? window.innerWidth - 40 : window.innerWidth;