[PATCH 4 of 6] hgweb: CSS change to allow correct numbering for multiple code blocks

Alexander Plavin me at aplavin.ru
Mon Jul 15 11:21:45 CDT 2013


2013/7/15 Martin Geisler <martin at geisler.net>:
> Alexander Plavin <me at aplavin.ru> writes:
>
>> # HG changeset patch
>> # User Alexander Plavin <me at aplavin.ru>
>> # Date 1373658651 -14400
>> #      Fri Jul 12 23:50:51 2013 +0400
>> # Node ID 5f28ecff8fd41834918308628462e0b1a97772b2
>> # Parent  8458ee0b0df78ae9ff3fbd809e49e290959fcbc7
>> hgweb: CSS change to allow correct numbering for multiple code blocks
>>
>> diff -r 8458ee0b0df7 -r 5f28ecff8fd4 mercurial/templates/static/style-paper.css
>> --- a/mercurial/templates/static/style-paper.css      Fri Jul 12 23:47:56 2013 +0400
>> +++ b/mercurial/templates/static/style-paper.css      Fri Jul 12 23:50:51 2013 +0400
>> @@ -216,6 +216,7 @@
>>  .sourcelines {
>>    font-size: 90%;
>>    position: relative;
>> +  counter-reset: lineno;
>>  }
>>
>>  .wrap > span {
>> @@ -226,6 +227,9 @@
>>      float: right;
>>  }
>>
>> +.reset-lineno { counter-reset: lineno; }
>> +.inc-lineno { counter-increment: lineno; }
>
> You don't seem to be using these newly introduced classes? It is often
> easier to review a change when functions/classes are introduced together
> with their usage.

Yes, will fold this with the patch where they are used.

>
> Also, when reading the class names I was wondering if they are
> necessary? I mean, it would be strange if you had a 'reset-subsection'
> class that you add to every h1 element to reset the subsection number in
> a document like:
>
>   <h1 class="reset-subsection">
>     <h2>
>     <h2>
>   <h1 class="reset-subsection">
>     <h2>
>     <h2>
>     <h2>
>   <h1 class="reset-subsection">
>     <h2>
>
> In other words, the logical structure of the document allows you to
> reset the subsection counter on all h1 elements. I would have assumed
> that something similar was possible here, but without seeing how the
> classes are used, I cannot tell yet :)

Tried to make this more semantical (and with only one extra class) in
the next version of the patch.

>
>>  .sourcelines > span {
>>    display: inline-block;
>>    width: 100%;
>> @@ -245,7 +249,7 @@
>>    font-size: smaller;
>>    color: #999;
>>    text-align: right;
>> -  content: counter(lineno);
>> +  content: counters(lineno, ".");
>
> That might be an unrelated change -- probably a good change, but not
> something what would "*allow* correct numbering for multiple code
> blocks" as the commit message promises.

It's actually strongly related to the commit name, as this line gives
the ability to get '<n1>.<n2>' numbering (2 numbers separated with a
dot), which is used in hgweb for multiple code blocks.

>
> --
> Martin Geisler


More information about the Mercurial-devel mailing list