[PATCH 12 of 20] hgweb, paper: add shortlogajax template and use it

Alexander Plavin alexander at plav.in
Mon Aug 12 13:39:32 CDT 2013


12.08.2013, 22:16, "Matt Mackall" <mpm at selenic.com>:

>  On Fri, 2013-08-09 at 22:57 +0400, Alexander Plavin wrote:
>>   # HG changeset patch
>>   # User Alexander Plavin <alexander at plav.in>
>>   # Date 1376061214 -14400
>>   #      Fri Aug 09 19:13:34 2013 +0400
>>   # Node ID d29091e49e209d58302e2835a3cdf63b6df7f8f2
>>   # Parent  d207510e86ed78f44521ce847283ac5abafa9eeb
>>   hgweb, paper: add shortlogajax template and use it
>  I get the extremely vague impression that this is the form that's used
>  by the client to fill in async requests..

You are right.

>  If so, the sensible way to do it is to add a new xml style.

The first idea and implementation I thought of was exactly this, a separate style (of course it still exists somehow, thanks to evolve :) ). It generated a well-structured xml style, i.e. all revision elements like hash or description were in separate machine-readable xml tags. However, this adds extra difficulty then: javascript will need to render this to html and add to this page, thus we need two things here. One is a separate template for entries, as the existent serverside one can't be reused for several reasons, and other is the actual template language and implementation of it (this language doesn't need to be as complex as serverside one of course, but it is needed).

On the other hand, the solution implemented here fully reuses serverside templates for the entries, as they are generated same way as usual shortlog page (it applies to other pages as well), just without all the markup: the rendered, complete html code is sent as a CDATA section, and js just has to add it to the page. Thus the only things needed to add neat ajaxy shortlog to a style (I mean theme here, like coal and so on) are creating this shortlogajax template (which must always be the same, so may be it's possible to define it as a default somewhere?) and add a small piece of js to shortlog template, which would call initialization function.

Or you have other suggestions here?

>  --
>  Mathematics is the supreme nostalgia of our time.


More information about the Mercurial-devel mailing list