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

Martin Geisler martin at geisler.net
Mon Jul 15 02:36:14 CDT 2013


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.

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 :)

>  .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.

-- 
Martin Geisler


More information about the Mercurial-devel mailing list