2
Vote

styling should be in CSS, not hard-coded

description

See one example @ https://stw.codeplex.com/SourceControl/latest#Core/DiffTools.cs
sb.Append("<tr>");

sb.Append(@"<td valign=""top"" width=""30"" style=""font-family: Courier New, monospace;"">");
if(n >= 0) sb.Append(((int)(n + 1)).ToString());
else sb.Append("&nbsp;");
sb.Append("</td>");

sb.Append(@"<td valign=""top"" style=""font-family: Courier New, monospace;"">");
sb.Append(@"<div style=""");
switch(typ) {
    case "i":
        sb.Append("background-color: #88CC33;");
        break;
    case "d":
        sb.Append("background-color: #FFDF66;");
        break;
}
sb.Append(@""">" + HttpContext.Current.Server.HtmlEncode(line) + "</div>");
sb.Append("</td>");

sb.Append("</tr>");
I'm not even going to address the tables thing. Sometimes that okay, I guess.

But shouldn't the diff tools be outputting a diff, and something else be formatting it?

Separation of Concerns

comments

Mriswith wrote Sep 23, 2013 at 10:58 AM

That probably can all be stripped and a class placed on the table. Also a table is valid for this classes output.

But saying that this should be returning a class with the diff information and that passed to a control to render. Not rendering content itself as in theory the core api should be consumable by a service endpoint / windows application etc.

But to fix the issue at hand I would recommend my first answer not second that should be done at a later stage