[PATCH] hgweb: render tabs to 8 spaces (v2)

Brendan Cully brendan at kublai.com
Thu May 14 13:39:38 CDT 2009


On Thursday, 14 May 2009 at 13:07, Matt Mackall wrote:
> On Thu, May 14, 2009 at 05:52:36PM +0200, Martin Geisler wrote:
> > Rocco Rutte <pdmef at gmx.net> writes:
> > 
> > > Hi,
> > >
> > > * Rocco Rutte wrote:
> > >> Attached is another rebased to latest crew (plus documentation).
> > >
> > > Sorry for the noise, I (again) forgot to update test output so here we
> > > go.
> > 
> > I have a question: when expanding tabs, I would expect a string like
> > 
> >   "1\t12\t123\t1234"
> > 
> > to become
> > 
> >   "1       12      123     1234"
> > 
> > where each tab moves from the current position to the next multiple of
> > 8, instead of just inserting 8 spaces.
> > 
> > Is that not what you want for this filter? If so, it's much simpler:
> > 
> >  +    "expandtabs": str.expandtabs,
> > 
> > since the builtin Python strings has such a method. I suggest renaming
> > the filter to match the Python name as well.
> > 
> > 
> > It would be great if you could update and resend your patch using the
> > patchbomb extension (or use 'hg export') to automatically include the
> > right meta data.
> 
> I would prefer that we instead focus on making real tabs work in hgweb
> properly again.

The div is already white-space: pre, which should do something halfway
sensible for tabs. I think it's just an alignment problem within the
line. The attached little hack (not a full fix, just a demo) makes the
filebrowser look pretty good on my firefox 3.0.10.
-------------- next part --------------
diff --git a/templates/paper/map b/templates/paper/map
--- a/templates/paper/map
+++ b/templates/paper/map
@@ -30,7 +30,7 @@
 fileannotate = fileannotate.tmpl
 filediff = filediff.tmpl
 filelog = filelog.tmpl
-fileline = '<div class="parity{parity} source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</div>'
+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="source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</td></tr>'


More information about the Mercurial-devel mailing list