changeset 7394:03b60f2f90bf

hgweb (coal/paper): make file, diff and annotate easier to render This patch removes tables altogether for file and diff, and removes one column from annotate, making firefox's incremental renderer much faster for large files.
author Brendan Cully <brendan@kublai.com>
date Thu, 20 Nov 2008 18:15:50 -0800
parents 92c952c4470c
children e2048f5c7bf5
files templates/coal/changeset.tmpl templates/coal/fileannotate.tmpl templates/coal/filediff.tmpl templates/coal/filerevision.tmpl templates/coal/map templates/paper/map templates/static/style-coal.css templates/static/style-paper.css
diffstat 8 files changed, 42 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/templates/coal/changeset.tmpl	Wed Nov 19 13:00:48 2008 -0800
+++ b/templates/coal/changeset.tmpl	Thu Nov 20 18:15:50 2008 -0800
@@ -60,12 +60,8 @@
 </table>
 
 <div class="overflow">
-<table class="bigtable">
-<tr>
- <th class="lineno">line</th>
- <th class="source">diff</th>
-</tr>
-</table>
+<div class="sourcefirst">   line diff</div>
+
 {diff}
 </div>
 
--- a/templates/coal/fileannotate.tmpl	Wed Nov 19 13:00:48 2008 -0800
+++ b/templates/coal/fileannotate.tmpl	Thu Nov 20 18:15:50 2008 -0800
@@ -67,8 +67,7 @@
 <table class="bigtable">
 <tr>
  <th class="annotate">rev</th>
- <th class="lineno">line</th>
- <th class="line">source</th>
+ <th class="line">&nbsp;&nbsp;line source</th>
 </tr>
 {annotate%annotateline}
 </table>
--- a/templates/coal/filediff.tmpl	Wed Nov 19 13:00:48 2008 -0800
+++ b/templates/coal/filediff.tmpl	Thu Nov 20 18:15:50 2008 -0800
@@ -61,12 +61,7 @@
 </table>
 
 <div class="overflow">
-<table class="bigtable">
-<tr>
- <th class="lineno">line</th>
- <th class="source">diff</th>
-</tr>
-</table>
+<div class="sourcefirst">   line diff</div>
 
 {diff}
 </div>
--- a/templates/coal/filerevision.tmpl	Wed Nov 19 13:00:48 2008 -0800
+++ b/templates/coal/filerevision.tmpl	Thu Nov 20 18:15:50 2008 -0800
@@ -61,13 +61,9 @@
 </table>
 
 <div class="overflow">
-<table class="bigtable">
-<tr>
- <th class="lineno">line</th>
- <th class="source">source</th>
-</tr>
+<div class="sourcefirst"> line source</div>
 {text%fileline}
-</table>
+<div class="sourcelast"></div>
 </div>
 </div>
 </div>
--- a/templates/coal/map	Wed Nov 19 13:00:48 2008 -0800
+++ b/templates/coal/map	Thu Nov 20 18:15:50 2008 -0800
@@ -30,16 +30,16 @@
 fileannotate = fileannotate.tmpl
 filediff = filediff.tmpl
 filelog = filelog.tmpl
-fileline = '<tr class="parity{parity}"><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source">{line|escape}</td></tr>'
+fileline = '<div class="parity{parity} source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</div>'
 filelogentry = filelogentry.tmpl
 
-annotateline = '<tr class="parity{parity}"><td class="annotate"><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#{targetline}" title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a></td><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source">{line|escape}</td></tr>'
+annotateline = '<tr class="parity{parity}"><td class="annotate"><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#{targetline}" title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a></td><td class="source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</td></tr>'
 
-diffblock = '<table class="bigtable parity{parity}">{lines}</table>'
-difflineplus = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source plusline">{line|escape}</td></tr>'
-difflineminus = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source minusline">{line|escape}</td></tr>'
-difflineat = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source atline">{line|escape}</td></tr>'
-diffline = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source">{line|escape}</td></tr>'
+diffblock = '<div class="source bottomline parity{parity}">{lines}</div>'
+difflineplus = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> <span class="plusline">{line|escape}</span>'
+difflineminus = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> <span class="minusline">{line|escape}</span>'
+difflineat = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> <span class="atline">{line|escape}</span>'
+diffline = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}'
 
 changelogparent = '<tr><th class="parent">parent {rev}:</th><td class="parent"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
 
--- a/templates/paper/map	Wed Nov 19 13:00:48 2008 -0800
+++ b/templates/paper/map	Thu Nov 20 18:15:50 2008 -0800
@@ -30,16 +30,16 @@
 fileannotate = ../coal/fileannotate.tmpl
 filediff = ../coal/filediff.tmpl
 filelog = ../coal/filelog.tmpl
-fileline = '<tr class="parity{parity}"><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source">{line|escape}</td></tr>'
+fileline = '<div class="parity{parity} source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</div>'
 filelogentry = ../coal/filelogentry.tmpl
 
-annotateline = '<tr class="parity{parity}"><td class="annotate"><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#{targetline}" title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a></td><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source">{line|escape}</td></tr>'
+annotateline = '<tr class="parity{parity}"><td class="annotate"><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#{targetline}" title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a></td><td class="source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</td></tr>'
 
-diffblock = '<table class="bigtable parity{parity}">{lines}</table>'
-difflineplus = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source plusline">{line|escape}</td></tr>'
-difflineminus = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source minusline">{line|escape}</td></tr>'
-difflineat = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source atline">{line|escape}</td></tr>'
-diffline = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source">{line|escape}</td></tr>'
+diffblock = '<div class="source bottomline parity{parity}">{lines}</div>'
+difflineplus = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> <span class="plusline">{line|escape}</span>'
+difflineminus = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> <span class="minusline">{line|escape}</span>'
+difflineat = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> <span class="atline">{line|escape}</span>'
+diffline = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}'
 
 changelogparent = '<tr><th class="parent">parent {rev}:</th><td class="parent"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
 
--- a/templates/static/style-coal.css	Wed Nov 19 13:00:48 2008 -0800
+++ b/templates/static/style-coal.css	Thu Nov 20 18:15:50 2008 -0800
@@ -148,11 +148,21 @@
 .bigtable .node { width: 5em; font-family: monospace;}
 .bigtable .lineno { width: 2em; text-align: right;}
 .bigtable .lineno a { color: #999; font-size: smaller; font-family: monospace;}
-.bigtable td.source { font-family: monospace; white-space: pre; }
 .bigtable .permissions { width: 8em; text-align: left;}
 .bigtable .size { width: 5em; text-align: right; }
 .bigtable .annotate { text-align: right; }
 .bigtable td.annotate { font-size: smaller; }
+.bigtable td.source { font-size: inherit; }
+
+.source, .sourcefirst, .sourcelast {
+  font-family: monospace;
+  white-space: pre;
+  font-size: 90%;
+}
+.sourcefirst { border-bottom: 1px solid #999; font-weight: bold; font-size: smaller; }
+.sourcelast { border-top: 1px solid #999; }
+.source a { color: #999; font-size: smaller; font-family: monospace;}
+.bottomline { border-bottom: 1px solid #999; }
 
 .fileline { font-family: monospace; }
 .fileline img { border: 0; }
--- a/templates/static/style-paper.css	Wed Nov 19 13:00:48 2008 -0800
+++ b/templates/static/style-paper.css	Thu Nov 20 18:15:50 2008 -0800
@@ -137,13 +137,21 @@
 .bigtable .author { width: 12em; }
 .bigtable .description { }
 .bigtable .node { width: 5em; font-family: monospace;}
-.bigtable .lineno { width: 2em; text-align: right;}
-.bigtable .lineno a { color: #999; font-size: smaller; font-family: monospace;}
-.bigtable td.source { font-family: monospace; white-space: pre; }
 .bigtable .permissions { width: 8em; text-align: left;}
 .bigtable .size { width: 5em; text-align: right; }
 .bigtable .annotate { text-align: right; }
 .bigtable td.annotate { font-size: smaller; }
+.bigtable td.source { font-size: inherit; }
+
+.source, .sourcefirst, .sourcelast {
+  font-family: monospace;
+  white-space: pre;
+  font-size: 90%;
+}
+.sourcefirst { border-bottom: 1px solid #999; font-weight: bold; font-size: smaller; }
+.sourcelast { border-top: 1px solid #999; }
+.source a { color: #999; font-size: smaller; font-family: monospace;}
+.bottomline { border-bottom: 1px solid #999; }
 
 .fileline { font-family: monospace; }
 .fileline img { border: 0; }