diff mercurial/templates/gitweb/graph.tmpl @ 17421:3eb85477c0d9 stable

hgweb: avoid bad $$ processing in graph (issue3601) JavaScript .replace always magically processed $$ $& $' $` in replacement strings and thus displayed subject lines incorrectly in the graph view. Instead of regexps and .replace we now just create the strings the right way in the first place.
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 29 Aug 2012 02:09:43 +0200
parents 8fd18eb8aab7
children ffe3630cb243
line wrap: on
line diff
--- a/mercurial/templates/gitweb/graph.tmpl	Wed Aug 29 13:16:56 2012 -0500
+++ b/mercurial/templates/gitweb/graph.tmpl	Wed Aug 29 02:09:43 2012 +0200
@@ -51,11 +51,6 @@
 var graph = new Graph();
 graph.scale({bg_height});
 
-var revlink = '<li style="_STYLE"><span class="desc">';
-revlink += '<a class="list" href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID"><b>_DESC</b></a>';
-revlink += '</span> _TAGS';
-revlink += '<span class="info">_DATE, by _USER</span></li>';
-
 graph.vertex = function(x, y, color, parity, cur) \{
 	
 	this.ctx.beginPath();
@@ -66,13 +61,6 @@
 	var bg = '<li class="bg parity' + parity + '"></li>';
 	var left = (this.columns + 1) * this.bg_height;
 	var nstyle = 'padding-left: ' + left + 'px;';
-	var item = revlink.replace(/_STYLE/, nstyle);
-	item = item.replace(/_PARITY/, 'parity' + parity);
-	item = item.replace(/_NODEID/, cur[0]);
-	item = item.replace(/_NODEID/, cur[0]);
-	item = item.replace(/_DESC/, cur[3]);
-	item = item.replace(/_USER/, cur[4]);
-	item = item.replace(/_DATE/, cur[5]);
 	
 	var tagspan = '';
 	if (cur[7].length || cur[8].length || (cur[6][0] != 'default' || cur[6][1])) \{
@@ -99,7 +87,11 @@
 		tagspan += '</span>';
 	}
 	
-	item = item.replace(/_TAGS/, tagspan);
+	var item = '<li style="' + nstyle + '"><span class="desc">';
+	item += '<a class="list" href="{url}rev/' + cur[0] + '{sessionvars%urlparameter}" title="' + cur[0] + '"><b>' + cur[3] + '</b></a>';
+	item += '</span> ' + tagspan + '';
+	item += '<span class="info">' + cur[5] + ', by ' + cur[4] + '</span></li>';
+
 	return [bg, item];
 	
 }