Anton Shestakov <av6@dwimlabs.net>, Sun, 07 Feb 2016 23:51:41 +0800
viewer: escape description in chart tooltip, show branch in dark blue
--- a/templates/fancy.html Sun Feb 07 22:57:31 2016 +0800
+++ b/templates/fancy.html Sun Feb 07 23:51:41 2016 +0800
var chart = c3.generate({
- tooltip: {format: {title: function(x) { return data.titles[-x]; }}},
+ tooltip: {format: {title: function(x) {
+ var c = data.csetmap[-x];
+ return c.rev + ':' + c.shortnode + ' <span style="color: darkblue;">' + c.branch + '</span> ' + c.firstline;
axis: {x: {tick: {format: function(x) { return -x; }}}},
--- a/viewer.py Sun Feb 07 22:57:31 2016 +0800
+++ b/viewer.py Sun Feb 07 23:51:41 2016 +0800
from collections import OrderedDict
from urllib import quote_plus
+from tornado.escape import xhtml_escape
from tornado.ioloop import IOLoop
from tornado.options import define, options
from tornado.web import Application, RequestHandler, URLSpec
marks, moremarks = self.getmarks()
results, _ = self.getresults(changesets, marks=marks, colors=False)
item = {'rev': -cset['rev']}
extra = [cset['branch']] + cset['tags']
if len(cset['parents']) > 1:
- titles[cset['rev']] = '{}:{}: {} {}'.format(
- cset['desc'].partition('\n')[0])
+ csetmap[cset['rev']] = {
+ 'branch': cset['branch'],
+ 'shortnode': cset['node'][:12],
+ 'firstline': xhtml_escape(cset['desc'].partition('\n')[0])
'keys': {'x': 'rev', 'value': marks.keys()},
'changesets': changesets,