Patchwork hgweb: remove stripes from code views

login
register
mail settings
Submitter Alexander Plavin
Date April 10, 2013, 4:48 p.m.
Message ID <9a89040d53d4d592b64d.1365612490@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/1267/
State Deferred, archived
Headers show

Comments

Alexander Plavin - April 10, 2013, 4:48 p.m.
# HG changeset patch
# User Alexander Plavin <me@aplavin.ru>
# Date 1365612310 -14400
# Node ID 9a89040d53d4d592b64deee63ebc1e3d5c7f8a4c
# Parent  bd6aed2ad5eed666319bc3bdad1c1e37582cf4b1
hgweb: remove stripes from code views

Stripes are removed only in file content view pages, lists still have them.
Modified only the default templates set (namely 'paper').
Tests are modified accordingly.
Augie Fackler - April 12, 2013, 9:08 p.m.
On Wed, Apr 10, 2013 at 08:48:10PM +0400, Alexander Plavin wrote:
> # HG changeset patch
> # User Alexander Plavin <me@aplavin.ru>
> # Date 1365612310 -14400
> # Node ID 9a89040d53d4d592b64deee63ebc1e3d5c7f8a4c
> # Parent  bd6aed2ad5eed666319bc3bdad1c1e37582cf4b1
> hgweb: remove stripes from code views
>
> Stripes are removed only in file content view pages, lists still have them.
> Modified only the default templates set (namely 'paper').
> Tests are modified accordingly.

Motivation? I see the what, but not the why. Did I miss a thread?

>
> diff -r bd6aed2ad5ee -r 9a89040d53d4 mercurial/templates/paper/map
> --- a/mercurial/templates/paper/map	Mon Apr 08 17:57:42 2013 -0500
> +++ b/mercurial/templates/paper/map	Wed Apr 10 20:45:10 2013 +0400
> @@ -72,7 +72,7 @@
>  filecomparison = filecomparison.tmpl
>  filelog = filelog.tmpl
>  fileline = '
> -  <div class="parity{parity} source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</div>'
> +  <div class="source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</div>'
>  filelogentry = filelogentry.tmpl
>
>  annotateline = '
> diff -r bd6aed2ad5ee -r 9a89040d53d4 tests/test-hgweb-commands.t
> --- a/tests/test-hgweb-commands.t	Mon Apr 08 17:57:42 2013 -0500
> +++ b/tests/test-hgweb-commands.t	Wed Apr 10 20:45:10 2013 +0400
> @@ -669,7 +669,7 @@
>    <div class="overflow">
>    <div class="sourcefirst"> line source</div>
>
> -  <div class="parity0 source"><a href="#l1" id="l1">     1</a> foo
> +  <div class="source"><a href="#l1" id="l1">     1</a> foo
>    </div>
>    <div class="sourcelast"></div>
>    </div>
> diff -r bd6aed2ad5ee -r 9a89040d53d4 tests/test-highlight.t
> --- a/tests/test-highlight.t	Mon Apr 08 17:57:42 2013 -0500
> +++ b/tests/test-highlight.t	Wed Apr 10 20:45:10 2013 +0400
> @@ -138,38 +138,38 @@
>    <div class="overflow">
>    <div class="sourcefirst"> line source</div>
>
> -  <div class="parity0 source"><a href="#l1" id="l1">     1</a> <span class="c">#!/usr/bin/env python</span></div>
> -  <div class="parity1 source"><a href="#l2" id="l2">     2</a> </div>
> -  <div class="parity0 source"><a href="#l3" id="l3">     3</a> <span class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell implementation:</span></div>
> -  <div class="parity1 source"><a href="#l4" id="l4">     4</a> </div>
> -  <div class="parity0 source"><a href="#l5" id="l5">     5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></div>
> -  <div class="parity1 source"><a href="#l6" id="l6">     6</a> <span class="sd">    where sieve (p:ns) = p : sieve [n | n &lt;- ns, mod n p /= 0]</span></div>
> -  <div class="parity0 source"><a href="#l7" id="l7">     7</a> <span class="sd">&quot;&quot;&quot;</span></div>
> -  <div class="parity1 source"><a href="#l8" id="l8">     8</a> </div>
> -  <div class="parity0 source"><a href="#l9" id="l9">     9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></div>
> -  <div class="parity1 source"><a href="#l10" id="l10">    10</a> </div>
> -  <div class="parity0 source"><a href="#l11" id="l11">    11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></div>
> -  <div class="parity1 source"><a href="#l12" id="l12">    12</a>     <span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></div>
> -  <div class="parity0 source"><a href="#l13" id="l13">    13</a>     <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></div>
> -  <div class="parity1 source"><a href="#l14" id="l14">    14</a>         <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></div>
> -  <div class="parity0 source"><a href="#l15" id="l15">    15</a>         <span class="c"># It is important to yield *here* in order to stop the</span></div>
> -  <div class="parity1 source"><a href="#l16" id="l16">    16</a>         <span class="c"># infinite recursion.</span></div>
> -  <div class="parity0 source"><a href="#l17" id="l17">    17</a>         <span class="kn">yield</span> <span class="n">p</span></div>
> -  <div class="parity1 source"><a href="#l18" id="l18">    18</a>         <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></div>
> -  <div class="parity0 source"><a href="#l19" id="l19">    19</a>         <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></div>
> -  <div class="parity1 source"><a href="#l20" id="l20">    20</a>             <span class="kn">yield</span> <span class="n">n</span></div>
> -  <div class="parity0 source"><a href="#l21" id="l21">    21</a> </div>
> -  <div class="parity1 source"><a href="#l22" id="l22">    22</a>     <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></div>
> -  <div class="parity0 source"><a href="#l23" id="l23">    23</a>     <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></div>
> -  <div class="parity1 source"><a href="#l24" id="l24">    24</a> </div>
> -  <div class="parity0 source"><a href="#l25" id="l25">    25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></div>
> -  <div class="parity1 source"><a href="#l26" id="l26">    26</a>     <span class="kn">import</span> <span class="nn">sys</span></div>
> -  <div class="parity0 source"><a href="#l27" id="l27">    27</a>     <span class="kn">try</span><span class="p">:</span></div>
> -  <div class="parity1 source"><a href="#l28" id="l28">    28</a>         <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></div>
> -  <div class="parity0 source"><a href="#l29" id="l29">    29</a>     <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></div>
> -  <div class="parity1 source"><a href="#l30" id="l30">    30</a>         <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></div>
> -  <div class="parity0 source"><a href="#l31" id="l31">    31</a>     <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></div>
> -  <div class="parity1 source"><a href="#l32" id="l32">    32</a>     <span class="kn">print</span> <span class="s">&quot;The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></div>
> +  <div class="source"><a href="#l1" id="l1">     1</a> <span class="c">#!/usr/bin/env python</span></div>
> +  <div class="source"><a href="#l2" id="l2">     2</a> </div>
> +  <div class="source"><a href="#l3" id="l3">     3</a> <span class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell implementation:</span></div>
> +  <div class="source"><a href="#l4" id="l4">     4</a> </div>
> +  <div class="source"><a href="#l5" id="l5">     5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></div>
> +  <div class="source"><a href="#l6" id="l6">     6</a> <span class="sd">    where sieve (p:ns) = p : sieve [n | n &lt;- ns, mod n p /= 0]</span></div>
> +  <div class="source"><a href="#l7" id="l7">     7</a> <span class="sd">&quot;&quot;&quot;</span></div>
> +  <div class="source"><a href="#l8" id="l8">     8</a> </div>
> +  <div class="source"><a href="#l9" id="l9">     9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></div>
> +  <div class="source"><a href="#l10" id="l10">    10</a> </div>
> +  <div class="source"><a href="#l11" id="l11">    11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></div>
> +  <div class="source"><a href="#l12" id="l12">    12</a>     <span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></div>
> +  <div class="source"><a href="#l13" id="l13">    13</a>     <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></div>
> +  <div class="source"><a href="#l14" id="l14">    14</a>         <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></div>
> +  <div class="source"><a href="#l15" id="l15">    15</a>         <span class="c"># It is important to yield *here* in order to stop the</span></div>
> +  <div class="source"><a href="#l16" id="l16">    16</a>         <span class="c"># infinite recursion.</span></div>
> +  <div class="source"><a href="#l17" id="l17">    17</a>         <span class="kn">yield</span> <span class="n">p</span></div>
> +  <div class="source"><a href="#l18" id="l18">    18</a>         <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></div>
> +  <div class="source"><a href="#l19" id="l19">    19</a>         <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></div>
> +  <div class="source"><a href="#l20" id="l20">    20</a>             <span class="kn">yield</span> <span class="n">n</span></div>
> +  <div class="source"><a href="#l21" id="l21">    21</a> </div>
> +  <div class="source"><a href="#l22" id="l22">    22</a>     <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></div>
> +  <div class="source"><a href="#l23" id="l23">    23</a>     <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></div>
> +  <div class="source"><a href="#l24" id="l24">    24</a> </div>
> +  <div class="source"><a href="#l25" id="l25">    25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></div>
> +  <div class="source"><a href="#l26" id="l26">    26</a>     <span class="kn">import</span> <span class="nn">sys</span></div>
> +  <div class="source"><a href="#l27" id="l27">    27</a>     <span class="kn">try</span><span class="p">:</span></div>
> +  <div class="source"><a href="#l28" id="l28">    28</a>         <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></div>
> +  <div class="source"><a href="#l29" id="l29">    29</a>     <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></div>
> +  <div class="source"><a href="#l30" id="l30">    30</a>         <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></div>
> +  <div class="source"><a href="#l31" id="l31">    31</a>     <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></div>
> +  <div class="source"><a href="#l32" id="l32">    32</a>     <span class="kn">print</span> <span class="s">&quot;The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></div>
>    <div class="sourcelast"></div>
>    </div>
>    </div>
> @@ -586,24 +586,24 @@
>    >
>    >     echo % hgweb filerevision, html
>    >     "$TESTDIR/get-with-headers.py" localhost:$HGPORT "file/tip/$2" \
> -  >         | grep '<div class="parity0 source">'
> +  >         | grep '<div class="source">'
>    >     echo % errors encountered
>    >     cat errors.log
>    > }
>    $ hgserveget euc-jp eucjp.txt
>    % HGENCODING=euc-jp hg serve
>    % hgweb filerevision, html
> -  <div class="parity0 source"><a href="#l1" id="l1">     1</a> \xb5\xfe</div> (esc)
> +  <div class="source"><a href="#l1" id="l1">     1</a> \xb5\xfe</div> (esc)
>    % errors encountered
>    $ hgserveget utf-8 eucjp.txt
>    % HGENCODING=utf-8 hg serve
>    % hgweb filerevision, html
> -  <div class="parity0 source"><a href="#l1" id="l1">     1</a> \xef\xbf\xbd\xef\xbf\xbd</div> (esc)
> +  <div class="source"><a href="#l1" id="l1">     1</a> \xef\xbf\xbd\xef\xbf\xbd</div> (esc)
>    % errors encountered
>    $ hgserveget us-ascii eucjp.txt
>    % HGENCODING=us-ascii hg serve
>    % hgweb filerevision, html
> -  <div class="parity0 source"><a href="#l1" id="l1">     1</a> ??</div>
> +  <div class="source"><a href="#l1" id="l1">     1</a> ??</div>
>    % errors encountered
>
>    $ cd ..
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Matt Mackall - April 12, 2013, 10:53 p.m.
On Fri, 2013-04-12 at 17:08 -0400, Augie Fackler wrote:
> On Wed, Apr 10, 2013 at 08:48:10PM +0400, Alexander Plavin wrote:
> > # HG changeset patch
> > # User Alexander Plavin <me@aplavin.ru>
> > # Date 1365612310 -14400
> > # Node ID 9a89040d53d4d592b64deee63ebc1e3d5c7f8a4c
> > # Parent  bd6aed2ad5eed666319bc3bdad1c1e37582cf4b1
> > hgweb: remove stripes from code views
> >
> > Stripes are removed only in file content view pages, lists still have them.
> > Modified only the default templates set (namely 'paper').
> > Tests are modified accordingly.
> 
> Motivation? I see the what, but not the why. Did I miss a thread?

This is something Jordi's been pushing for a while. Stripes apparently
interfere with a couple things we'd like to do:

- text select without line numbers
- faster page rendering by eliminating tables in some places

..or something like that.
Jordi Gutiérrez Hermoso - April 17, 2013, 4:25 p.m.
On 12 April 2013 18:53, Matt Mackall <mpm@selenic.com> wrote:
> On Fri, 2013-04-12 at 17:08 -0400, Augie Fackler wrote:
>> On Wed, Apr 10, 2013 at 08:48:10PM +0400, Alexander Plavin wrote:
>> > # HG changeset patch
>> > # User Alexander Plavin <me@aplavin.ru>
>> > # Date 1365612310 -14400
>> > # Node ID 9a89040d53d4d592b64deee63ebc1e3d5c7f8a4c
>> > # Parent  bd6aed2ad5eed666319bc3bdad1c1e37582cf4b1
>> > hgweb: remove stripes from code views
>> >
>> > Stripes are removed only in file content view pages, lists still have them.
>> > Modified only the default templates set (namely 'paper').
>> > Tests are modified accordingly.
>>
>> Motivation? I see the what, but not the why. Did I miss a thread?
>
> This is something Jordi's been pushing for a while. Stripes apparently
> interfere with a couple things we'd like to do:
>
> - text select without line numbers
> - faster page rendering by eliminating tables in some places

Yes, both of those.

- Jordi G. H.
Alexander Plavin - April 20, 2013, 2:37 p.m.
Could you please accept/queue this to the mentioned gsoc queue? It seems
that nobody is against this patch.


2013/4/10 Alexander Plavin <me@aplavin.ru>

> # HG changeset patch
> # User Alexander Plavin <me@aplavin.ru>
> # Date 1365612310 -14400
> # Node ID 9a89040d53d4d592b64deee63ebc1e3d5c7f8a4c
> # Parent  bd6aed2ad5eed666319bc3bdad1c1e37582cf4b1
> hgweb: remove stripes from code views
>
> Stripes are removed only in file content view pages, lists still have them.
> Modified only the default templates set (namely 'paper').
> Tests are modified accordingly.
>
> diff -r bd6aed2ad5ee -r 9a89040d53d4 mercurial/templates/paper/map
> --- a/mercurial/templates/paper/map     Mon Apr 08 17:57:42 2013 -0500
> +++ b/mercurial/templates/paper/map     Wed Apr 10 20:45:10 2013 +0400
> @@ -72,7 +72,7 @@
>  filecomparison = filecomparison.tmpl
>  filelog = filelog.tmpl
>  fileline = '
> -  <div class="parity{parity} source"><a href="#{lineid}"
> id="{lineid}">{linenumber}</a> {line|escape}</div>'
> +  <div class="source"><a href="#{lineid}" id="{lineid}">{linenumber}</a>
> {line|escape}</div>'
>  filelogentry = filelogentry.tmpl
>
>  annotateline = '
> diff -r bd6aed2ad5ee -r 9a89040d53d4 tests/test-hgweb-commands.t
> --- a/tests/test-hgweb-commands.t       Mon Apr 08 17:57:42 2013 -0500
> +++ b/tests/test-hgweb-commands.t       Wed Apr 10 20:45:10 2013 +0400
> @@ -669,7 +669,7 @@
>    <div class="overflow">
>    <div class="sourcefirst"> line source</div>
>
> -  <div class="parity0 source"><a href="#l1" id="l1">     1</a> foo
> +  <div class="source"><a href="#l1" id="l1">     1</a> foo
>    </div>
>    <div class="sourcelast"></div>
>    </div>
> diff -r bd6aed2ad5ee -r 9a89040d53d4 tests/test-highlight.t
> --- a/tests/test-highlight.t    Mon Apr 08 17:57:42 2013 -0500
> +++ b/tests/test-highlight.t    Wed Apr 10 20:45:10 2013 +0400
> @@ -138,38 +138,38 @@
>    <div class="overflow">
>    <div class="sourcefirst"> line source</div>
>
> -  <div class="parity0 source"><a href="#l1" id="l1">     1</a> <span
> class="c">#!/usr/bin/env python</span></div>
> -  <div class="parity1 source"><a href="#l2" id="l2">     2</a> </div>
> -  <div class="parity0 source"><a href="#l3" id="l3">     3</a> <span
> class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell
> implementation:</span></div>
> -  <div class="parity1 source"><a href="#l4" id="l4">     4</a> </div>
> -  <div class="parity0 source"><a href="#l5" id="l5">     5</a> <span
> class="sd">primes = 2 : sieve [3, 5..]</span></div>
> -  <div class="parity1 source"><a href="#l6" id="l6">     6</a> <span
> class="sd">    where sieve (p:ns) = p : sieve [n | n &lt;- ns, mod n p /=
> 0]</span></div>
> -  <div class="parity0 source"><a href="#l7" id="l7">     7</a> <span
> class="sd">&quot;&quot;&quot;</span></div>
> -  <div class="parity1 source"><a href="#l8" id="l8">     8</a> </div>
> -  <div class="parity0 source"><a href="#l9" id="l9">     9</a> <span
> class="kn">from</span> <span class="nn">itertools</span> <span
> class="kn">import</span> <span class="n">dropwhile</span><span
> class="p">,</span> <span class="n">ifilter</span><span class="p">,</span>
> <span class="n">islice</span><span class="p">,</span> <span
> class="n">count</span><span class="p">,</span> <span
> class="n">chain</span></div>
> -  <div class="parity1 source"><a href="#l10" id="l10">    10</a> </div>
> -  <div class="parity0 source"><a href="#l11" id="l11">    11</a> <span
> class="kn">def</span> <span class="nf">primes</span><span
> class="p">():</span></div>
> -  <div class="parity1 source"><a href="#l12" id="l12">    12</a>
> <span class="sd">&quot;&quot;&quot;Generate all
> primes.&quot;&quot;&quot;</span></div>
> -  <div class="parity0 source"><a href="#l13" id="l13">    13</a>
> <span class="kn">def</span> <span class="nf">sieve</span><span
> class="p">(</span><span class="n">ns</span><span class="p">):</span></div>
> -  <div class="parity1 source"><a href="#l14" id="l14">    14</a>
> <span class="n">p</span> <span class="o">=</span> <span
> class="n">ns</span><span class="o">.</span><span class="n">next</span><span
> class="p">()</span></div>
> -  <div class="parity0 source"><a href="#l15" id="l15">    15</a>
> <span class="c"># It is important to yield *here* in order to stop
> the</span></div>
> -  <div class="parity1 source"><a href="#l16" id="l16">    16</a>
> <span class="c"># infinite recursion.</span></div>
> -  <div class="parity0 source"><a href="#l17" id="l17">    17</a>
> <span class="kn">yield</span> <span class="n">p</span></div>
> -  <div class="parity1 source"><a href="#l18" id="l18">    18</a>
> <span class="n">ns</span> <span class="o">=</span> <span
> class="n">ifilter</span><span class="p">(</span><span
> class="kn">lambda</span> <span class="n">n</span><span class="p">:</span>
> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span>
> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span>
> <span class="n">ns</span><span class="p">)</span></div>
> -  <div class="parity0 source"><a href="#l19" id="l19">    19</a>
> <span class="kn">for</span> <span class="n">n</span> <span
> class="ow">in</span> <span class="n">sieve</span><span
> class="p">(</span><span class="n">ns</span><span class="p">):</span></div>
> -  <div class="parity1 source"><a href="#l20" id="l20">    20</a>
>     <span class="kn">yield</span> <span class="n">n</span></div>
> -  <div class="parity0 source"><a href="#l21" id="l21">    21</a> </div>
> -  <div class="parity1 source"><a href="#l22" id="l22">    22</a>
> <span class="n">odds</span> <span class="o">=</span> <span
> class="n">ifilter</span><span class="p">(</span><span
> class="kn">lambda</span> <span class="n">i</span><span class="p">:</span>
> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span>
> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span>
> <span class="n">count</span><span class="p">())</span></div>
> -  <div class="parity0 source"><a href="#l23" id="l23">    23</a>
> <span class="kn">return</span> <span class="n">chain</span><span
> class="p">([</span><span class="mi">2</span><span class="p">],</span> <span
> class="n">sieve</span><span class="p">(</span><span
> class="n">dropwhile</span><span class="p">(</span><span
> class="kn">lambda</span> <span class="n">n</span><span class="p">:</span>
> <span class="n">n</span> <span class="o">&lt;</span> <span
> class="mi">3</span><span class="p">,</span> <span
> class="n">odds</span><span class="p">)))</span></div>
> -  <div class="parity1 source"><a href="#l24" id="l24">    24</a> </div>
> -  <div class="parity0 source"><a href="#l25" id="l25">    25</a> <span
> class="kn">if</span> <span class="n">__name__</span> <span
> class="o">==</span> <span class="s">&quot;__main__&quot;</span><span
> class="p">:</span></div>
> -  <div class="parity1 source"><a href="#l26" id="l26">    26</a>
> <span class="kn">import</span> <span class="nn">sys</span></div>
> -  <div class="parity0 source"><a href="#l27" id="l27">    27</a>
> <span class="kn">try</span><span class="p">:</span></div>
> -  <div class="parity1 source"><a href="#l28" id="l28">    28</a>
> <span class="n">n</span> <span class="o">=</span> <span
> class="nb">int</span><span class="p">(</span><span
> class="n">sys</span><span class="o">.</span><span
> class="n">argv</span><span class="p">[</span><span class="mi">1</span><span
> class="p">])</span></div>
> -  <div class="parity0 source"><a href="#l29" id="l29">    29</a>
> <span class="kn">except</span> <span class="p">(</span><span
> class="ne">ValueError</span><span class="p">,</span> <span
> class="ne">IndexError</span><span class="p">):</span></div>
> -  <div class="parity1 source"><a href="#l30" id="l30">    30</a>
> <span class="n">n</span> <span class="o">=</span> <span
> class="mi">10</span></div>
> -  <div class="parity0 source"><a href="#l31" id="l31">    31</a>
> <span class="n">p</span> <span class="o">=</span> <span
> class="n">primes</span><span class="p">()</span></div>
> -  <div class="parity1 source"><a href="#l32" id="l32">    32</a>
> <span class="kn">print</span> <span class="s">&quot;The first </span><span
> class="si">%d</span><span class="s"> primes: </span><span
> class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span>
> <span class="p">(</span><span class="n">n</span><span class="p">,</span>
> <span class="nb">list</span><span class="p">(</span><span
> class="n">islice</span><span class="p">(</span><span
> class="n">p</span><span class="p">,</span> <span class="n">n</span><span
> class="p">)))</span></div>
> +  <div class="source"><a href="#l1" id="l1">     1</a> <span
> class="c">#!/usr/bin/env python</span></div>
> +  <div class="source"><a href="#l2" id="l2">     2</a> </div>
> +  <div class="source"><a href="#l3" id="l3">     3</a> <span
> class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell
> implementation:</span></div>
> +  <div class="source"><a href="#l4" id="l4">     4</a> </div>
> +  <div class="source"><a href="#l5" id="l5">     5</a> <span
> class="sd">primes = 2 : sieve [3, 5..]</span></div>
> +  <div class="source"><a href="#l6" id="l6">     6</a> <span class="sd">
>    where sieve (p:ns) = p : sieve [n | n &lt;- ns, mod n p /=
> 0]</span></div>
> +  <div class="source"><a href="#l7" id="l7">     7</a> <span
> class="sd">&quot;&quot;&quot;</span></div>
> +  <div class="source"><a href="#l8" id="l8">     8</a> </div>
> +  <div class="source"><a href="#l9" id="l9">     9</a> <span
> class="kn">from</span> <span class="nn">itertools</span> <span
> class="kn">import</span> <span class="n">dropwhile</span><span
> class="p">,</span> <span class="n">ifilter</span><span class="p">,</span>
> <span class="n">islice</span><span class="p">,</span> <span
> class="n">count</span><span class="p">,</span> <span
> class="n">chain</span></div>
> +  <div class="source"><a href="#l10" id="l10">    10</a> </div>
> +  <div class="source"><a href="#l11" id="l11">    11</a> <span
> class="kn">def</span> <span class="nf">primes</span><span
> class="p">():</span></div>
> +  <div class="source"><a href="#l12" id="l12">    12</a>     <span
> class="sd">&quot;&quot;&quot;Generate all
> primes.&quot;&quot;&quot;</span></div>
> +  <div class="source"><a href="#l13" id="l13">    13</a>     <span
> class="kn">def</span> <span class="nf">sieve</span><span
> class="p">(</span><span class="n">ns</span><span class="p">):</span></div>
> +  <div class="source"><a href="#l14" id="l14">    14</a>         <span
> class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span
> class="o">.</span><span class="n">next</span><span class="p">()</span></div>
> +  <div class="source"><a href="#l15" id="l15">    15</a>         <span
> class="c"># It is important to yield *here* in order to stop
> the</span></div>
> +  <div class="source"><a href="#l16" id="l16">    16</a>         <span
> class="c"># infinite recursion.</span></div>
> +  <div class="source"><a href="#l17" id="l17">    17</a>         <span
> class="kn">yield</span> <span class="n">p</span></div>
> +  <div class="source"><a href="#l18" id="l18">    18</a>         <span
> class="n">ns</span> <span class="o">=</span> <span
> class="n">ifilter</span><span class="p">(</span><span
> class="kn">lambda</span> <span class="n">n</span><span class="p">:</span>
> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span>
> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span>
> <span class="n">ns</span><span class="p">)</span></div>
> +  <div class="source"><a href="#l19" id="l19">    19</a>         <span
> class="kn">for</span> <span class="n">n</span> <span class="ow">in</span>
> <span class="n">sieve</span><span class="p">(</span><span
> class="n">ns</span><span class="p">):</span></div>
> +  <div class="source"><a href="#l20" id="l20">    20</a>
> <span class="kn">yield</span> <span class="n">n</span></div>
> +  <div class="source"><a href="#l21" id="l21">    21</a> </div>
> +  <div class="source"><a href="#l22" id="l22">    22</a>     <span
> class="n">odds</span> <span class="o">=</span> <span
> class="n">ifilter</span><span class="p">(</span><span
> class="kn">lambda</span> <span class="n">i</span><span class="p">:</span>
> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span>
> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span>
> <span class="n">count</span><span class="p">())</span></div>
> +  <div class="source"><a href="#l23" id="l23">    23</a>     <span
> class="kn">return</span> <span class="n">chain</span><span
> class="p">([</span><span class="mi">2</span><span class="p">],</span> <span
> class="n">sieve</span><span class="p">(</span><span
> class="n">dropwhile</span><span class="p">(</span><span
> class="kn">lambda</span> <span class="n">n</span><span class="p">:</span>
> <span class="n">n</span> <span class="o">&lt;</span> <span
> class="mi">3</span><span class="p">,</span> <span
> class="n">odds</span><span class="p">)))</span></div>
> +  <div class="source"><a href="#l24" id="l24">    24</a> </div>
> +  <div class="source"><a href="#l25" id="l25">    25</a> <span
> class="kn">if</span> <span class="n">__name__</span> <span
> class="o">==</span> <span class="s">&quot;__main__&quot;</span><span
> class="p">:</span></div>
> +  <div class="source"><a href="#l26" id="l26">    26</a>     <span
> class="kn">import</span> <span class="nn">sys</span></div>
> +  <div class="source"><a href="#l27" id="l27">    27</a>     <span
> class="kn">try</span><span class="p">:</span></div>
> +  <div class="source"><a href="#l28" id="l28">    28</a>         <span
> class="n">n</span> <span class="o">=</span> <span
> class="nb">int</span><span class="p">(</span><span
> class="n">sys</span><span class="o">.</span><span
> class="n">argv</span><span class="p">[</span><span class="mi">1</span><span
> class="p">])</span></div>
> +  <div class="source"><a href="#l29" id="l29">    29</a>     <span
> class="kn">except</span> <span class="p">(</span><span
> class="ne">ValueError</span><span class="p">,</span> <span
> class="ne">IndexError</span><span class="p">):</span></div>
> +  <div class="source"><a href="#l30" id="l30">    30</a>         <span
> class="n">n</span> <span class="o">=</span> <span class="mi">10</span></div>
> +  <div class="source"><a href="#l31" id="l31">    31</a>     <span
> class="n">p</span> <span class="o">=</span> <span
> class="n">primes</span><span class="p">()</span></div>
> +  <div class="source"><a href="#l32" id="l32">    32</a>     <span
> class="kn">print</span> <span class="s">&quot;The first </span><span
> class="si">%d</span><span class="s"> primes: </span><span
> class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span>
> <span class="p">(</span><span class="n">n</span><span class="p">,</span>
> <span class="nb">list</span><span class="p">(</span><span
> class="n">islice</span><span class="p">(</span><span
> class="n">p</span><span class="p">,</span> <span class="n">n</span><span
> class="p">)))</span></div>
>    <div class="sourcelast"></div>
>    </div>
>    </div>
> @@ -586,24 +586,24 @@
>    >
>    >     echo % hgweb filerevision, html
>    >     "$TESTDIR/get-with-headers.py" localhost:$HGPORT "file/tip/$2" \
> -  >         | grep '<div class="parity0 source">'
> +  >         | grep '<div class="source">'
>    >     echo % errors encountered
>    >     cat errors.log
>    > }
>    $ hgserveget euc-jp eucjp.txt
>    % HGENCODING=euc-jp hg serve
>    % hgweb filerevision, html
> -  <div class="parity0 source"><a href="#l1" id="l1">     1</a>
> \xb5\xfe</div> (esc)
> +  <div class="source"><a href="#l1" id="l1">     1</a> \xb5\xfe</div>
> (esc)
>    % errors encountered
>    $ hgserveget utf-8 eucjp.txt
>    % HGENCODING=utf-8 hg serve
>    % hgweb filerevision, html
> -  <div class="parity0 source"><a href="#l1" id="l1">     1</a>
> \xef\xbf\xbd\xef\xbf\xbd</div> (esc)
> +  <div class="source"><a href="#l1" id="l1">     1</a>
> \xef\xbf\xbd\xef\xbf\xbd</div> (esc)
>    % errors encountered
>    $ hgserveget us-ascii eucjp.txt
>    % HGENCODING=us-ascii hg serve
>    % hgweb filerevision, html
> -  <div class="parity0 source"><a href="#l1" id="l1">     1</a> ??</div>
> +  <div class="source"><a href="#l1" id="l1">     1</a> ??</div>
>    % errors encountered
>
>    $ cd ..
>
Matt Mackall - April 22, 2013, 8:22 p.m.
On Sun, 2013-04-21 at 02:26 +0200, Pierre-Yves David wrote:

> I've made some quick experiment here: http://www.octopoid.net/perso/tmp/nu.html#l.1

FYI, this experiment glitches and selects some line numbers sometimes on
my browser.

But annotate is the real challenge.
Matt Mackall - April 22, 2013, 10:12 p.m.
On Wed, 2013-04-10 at 20:48 +0400, Alexander Plavin wrote:
> # HG changeset patch
> # User Alexander Plavin <me@aplavin.ru>
> # Date 1365612310 -14400
> # Node ID 9a89040d53d4d592b64deee63ebc1e3d5c7f8a4c
> # Parent  bd6aed2ad5eed666319bc3bdad1c1e37582cf4b1
> hgweb: remove stripes from code views

So it looks like there's still some debate about whether this is the
right direction. Let's bring this up again post-2.6.

Patch

diff -r bd6aed2ad5ee -r 9a89040d53d4 mercurial/templates/paper/map
--- a/mercurial/templates/paper/map	Mon Apr 08 17:57:42 2013 -0500
+++ b/mercurial/templates/paper/map	Wed Apr 10 20:45:10 2013 +0400
@@ -72,7 +72,7 @@ 
 filecomparison = filecomparison.tmpl
 filelog = filelog.tmpl
 fileline = '
-  <div class="parity{parity} source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</div>'
+  <div class="source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</div>'
 filelogentry = filelogentry.tmpl
 
 annotateline = '
diff -r bd6aed2ad5ee -r 9a89040d53d4 tests/test-hgweb-commands.t
--- a/tests/test-hgweb-commands.t	Mon Apr 08 17:57:42 2013 -0500
+++ b/tests/test-hgweb-commands.t	Wed Apr 10 20:45:10 2013 +0400
@@ -669,7 +669,7 @@ 
   <div class="overflow">
   <div class="sourcefirst"> line source</div>
   
-  <div class="parity0 source"><a href="#l1" id="l1">     1</a> foo
+  <div class="source"><a href="#l1" id="l1">     1</a> foo
   </div>
   <div class="sourcelast"></div>
   </div>
diff -r bd6aed2ad5ee -r 9a89040d53d4 tests/test-highlight.t
--- a/tests/test-highlight.t	Mon Apr 08 17:57:42 2013 -0500
+++ b/tests/test-highlight.t	Wed Apr 10 20:45:10 2013 +0400
@@ -138,38 +138,38 @@ 
   <div class="overflow">
   <div class="sourcefirst"> line source</div>
   
-  <div class="parity0 source"><a href="#l1" id="l1">     1</a> <span class="c">#!/usr/bin/env python</span></div>
-  <div class="parity1 source"><a href="#l2" id="l2">     2</a> </div>
-  <div class="parity0 source"><a href="#l3" id="l3">     3</a> <span class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell implementation:</span></div>
-  <div class="parity1 source"><a href="#l4" id="l4">     4</a> </div>
-  <div class="parity0 source"><a href="#l5" id="l5">     5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></div>
-  <div class="parity1 source"><a href="#l6" id="l6">     6</a> <span class="sd">    where sieve (p:ns) = p : sieve [n | n &lt;- ns, mod n p /= 0]</span></div>
-  <div class="parity0 source"><a href="#l7" id="l7">     7</a> <span class="sd">&quot;&quot;&quot;</span></div>
-  <div class="parity1 source"><a href="#l8" id="l8">     8</a> </div>
-  <div class="parity0 source"><a href="#l9" id="l9">     9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></div>
-  <div class="parity1 source"><a href="#l10" id="l10">    10</a> </div>
-  <div class="parity0 source"><a href="#l11" id="l11">    11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></div>
-  <div class="parity1 source"><a href="#l12" id="l12">    12</a>     <span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></div>
-  <div class="parity0 source"><a href="#l13" id="l13">    13</a>     <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></div>
-  <div class="parity1 source"><a href="#l14" id="l14">    14</a>         <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></div>
-  <div class="parity0 source"><a href="#l15" id="l15">    15</a>         <span class="c"># It is important to yield *here* in order to stop the</span></div>
-  <div class="parity1 source"><a href="#l16" id="l16">    16</a>         <span class="c"># infinite recursion.</span></div>
-  <div class="parity0 source"><a href="#l17" id="l17">    17</a>         <span class="kn">yield</span> <span class="n">p</span></div>
-  <div class="parity1 source"><a href="#l18" id="l18">    18</a>         <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></div>
-  <div class="parity0 source"><a href="#l19" id="l19">    19</a>         <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></div>
-  <div class="parity1 source"><a href="#l20" id="l20">    20</a>             <span class="kn">yield</span> <span class="n">n</span></div>
-  <div class="parity0 source"><a href="#l21" id="l21">    21</a> </div>
-  <div class="parity1 source"><a href="#l22" id="l22">    22</a>     <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></div>
-  <div class="parity0 source"><a href="#l23" id="l23">    23</a>     <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></div>
-  <div class="parity1 source"><a href="#l24" id="l24">    24</a> </div>
-  <div class="parity0 source"><a href="#l25" id="l25">    25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></div>
-  <div class="parity1 source"><a href="#l26" id="l26">    26</a>     <span class="kn">import</span> <span class="nn">sys</span></div>
-  <div class="parity0 source"><a href="#l27" id="l27">    27</a>     <span class="kn">try</span><span class="p">:</span></div>
-  <div class="parity1 source"><a href="#l28" id="l28">    28</a>         <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></div>
-  <div class="parity0 source"><a href="#l29" id="l29">    29</a>     <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></div>
-  <div class="parity1 source"><a href="#l30" id="l30">    30</a>         <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></div>
-  <div class="parity0 source"><a href="#l31" id="l31">    31</a>     <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></div>
-  <div class="parity1 source"><a href="#l32" id="l32">    32</a>     <span class="kn">print</span> <span class="s">&quot;The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></div>
+  <div class="source"><a href="#l1" id="l1">     1</a> <span class="c">#!/usr/bin/env python</span></div>
+  <div class="source"><a href="#l2" id="l2">     2</a> </div>
+  <div class="source"><a href="#l3" id="l3">     3</a> <span class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell implementation:</span></div>
+  <div class="source"><a href="#l4" id="l4">     4</a> </div>
+  <div class="source"><a href="#l5" id="l5">     5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></div>
+  <div class="source"><a href="#l6" id="l6">     6</a> <span class="sd">    where sieve (p:ns) = p : sieve [n | n &lt;- ns, mod n p /= 0]</span></div>
+  <div class="source"><a href="#l7" id="l7">     7</a> <span class="sd">&quot;&quot;&quot;</span></div>
+  <div class="source"><a href="#l8" id="l8">     8</a> </div>
+  <div class="source"><a href="#l9" id="l9">     9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></div>
+  <div class="source"><a href="#l10" id="l10">    10</a> </div>
+  <div class="source"><a href="#l11" id="l11">    11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></div>
+  <div class="source"><a href="#l12" id="l12">    12</a>     <span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></div>
+  <div class="source"><a href="#l13" id="l13">    13</a>     <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></div>
+  <div class="source"><a href="#l14" id="l14">    14</a>         <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></div>
+  <div class="source"><a href="#l15" id="l15">    15</a>         <span class="c"># It is important to yield *here* in order to stop the</span></div>
+  <div class="source"><a href="#l16" id="l16">    16</a>         <span class="c"># infinite recursion.</span></div>
+  <div class="source"><a href="#l17" id="l17">    17</a>         <span class="kn">yield</span> <span class="n">p</span></div>
+  <div class="source"><a href="#l18" id="l18">    18</a>         <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></div>
+  <div class="source"><a href="#l19" id="l19">    19</a>         <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></div>
+  <div class="source"><a href="#l20" id="l20">    20</a>             <span class="kn">yield</span> <span class="n">n</span></div>
+  <div class="source"><a href="#l21" id="l21">    21</a> </div>
+  <div class="source"><a href="#l22" id="l22">    22</a>     <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></div>
+  <div class="source"><a href="#l23" id="l23">    23</a>     <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></div>
+  <div class="source"><a href="#l24" id="l24">    24</a> </div>
+  <div class="source"><a href="#l25" id="l25">    25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></div>
+  <div class="source"><a href="#l26" id="l26">    26</a>     <span class="kn">import</span> <span class="nn">sys</span></div>
+  <div class="source"><a href="#l27" id="l27">    27</a>     <span class="kn">try</span><span class="p">:</span></div>
+  <div class="source"><a href="#l28" id="l28">    28</a>         <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></div>
+  <div class="source"><a href="#l29" id="l29">    29</a>     <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></div>
+  <div class="source"><a href="#l30" id="l30">    30</a>         <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></div>
+  <div class="source"><a href="#l31" id="l31">    31</a>     <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></div>
+  <div class="source"><a href="#l32" id="l32">    32</a>     <span class="kn">print</span> <span class="s">&quot;The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></div>
   <div class="sourcelast"></div>
   </div>
   </div>
@@ -586,24 +586,24 @@ 
   > 
   >     echo % hgweb filerevision, html
   >     "$TESTDIR/get-with-headers.py" localhost:$HGPORT "file/tip/$2" \
-  >         | grep '<div class="parity0 source">'
+  >         | grep '<div class="source">'
   >     echo % errors encountered
   >     cat errors.log
   > }
   $ hgserveget euc-jp eucjp.txt
   % HGENCODING=euc-jp hg serve
   % hgweb filerevision, html
-  <div class="parity0 source"><a href="#l1" id="l1">     1</a> \xb5\xfe</div> (esc)
+  <div class="source"><a href="#l1" id="l1">     1</a> \xb5\xfe</div> (esc)
   % errors encountered
   $ hgserveget utf-8 eucjp.txt
   % HGENCODING=utf-8 hg serve
   % hgweb filerevision, html
-  <div class="parity0 source"><a href="#l1" id="l1">     1</a> \xef\xbf\xbd\xef\xbf\xbd</div> (esc)
+  <div class="source"><a href="#l1" id="l1">     1</a> \xef\xbf\xbd\xef\xbf\xbd</div> (esc)
   % errors encountered
   $ hgserveget us-ascii eucjp.txt
   % HGENCODING=us-ascii hg serve
   % hgweb filerevision, html
-  <div class="parity0 source"><a href="#l1" id="l1">     1</a> ??</div>
+  <div class="source"><a href="#l1" id="l1">     1</a> ??</div>
   % errors encountered
 
   $ cd ..