Patchwork [2,of,2] hgweb: use css margin instead of empty <p> before diffstat table

login
register
mail settings
Submitter Anton Shestakov
Date Feb. 5, 2015, 4:36 p.m.
Message ID <bf661a03fddcaa9d50ca.1423154213@neuro>
Download mbox | patch
Permalink /patch/7685/
State Accepted
Commit bf661a03fddcaa9d50ca545241e903f1f3b6b0a9
Headers show

Comments

Anton Shestakov - Feb. 5, 2015, 4:36 p.m.
# HG changeset patch
# User Anton Shestakov <engored@ya.ru>
# Date 1423139670 -28800
#      Thu Feb 05 20:34:30 2015 +0800
# Node ID bf661a03fddcaa9d50ca545241e903f1f3b6b0a9
# Parent  9756f943634f08e0b6a242d8324c5c68b76f080a
hgweb: use css margin instead of empty <p> before diffstat table

The <p> elements were used to create an empty space between the diffstat link
and the diffstat table, but they don't have any semantic meaning, so it is
better to use css instead.

Default margins for <p> elements can differ depending on the browser, but
usually the margin is 1em (exceptions are IE 6 and 7 with 14pt, which is
comparable). The css rule sets top margin to 1em.

This change is a "better version" of 70cfa7e1611b, where <p> elements were
simply properly closed.
Augie Fackler - Feb. 10, 2015, 3:23 a.m.
On Fri, Feb 06, 2015 at 12:36:53AM +0800, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov <engored@ya.ru>
> # Date 1423139670 -28800
> #      Thu Feb 05 20:34:30 2015 +0800
> # Node ID bf661a03fddcaa9d50ca545241e903f1f3b6b0a9
> # Parent  9756f943634f08e0b6a242d8324c5c68b76f080a
> hgweb: use css margin instead of empty <p> before diffstat table

these two are queued, thanks

>
> The <p> elements were used to create an empty space between the diffstat link
> and the diffstat table, but they don't have any semantic meaning, so it is
> better to use css instead.
>
> Default margins for <p> elements can differ depending on the browser, but
> usually the margin is 1em (exceptions are IE 6 and 7 with 14pt, which is
> comparable). The css rule sets top margin to 1em.
>
> This change is a "better version" of 70cfa7e1611b, where <p> elements were
> simply properly closed.
>
> diff --git a/mercurial/templates/paper/changeset.tmpl b/mercurial/templates/paper/changeset.tmpl
> --- a/mercurial/templates/paper/changeset.tmpl
> +++ b/mercurial/templates/paper/changeset.tmpl
> @@ -68,8 +68,7 @@
>      <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
>      <div id="diffstatdetails" style="display:none;">
>        <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
> -      <p></p>
> -      <table class="stripes2">{diffstat}</table>
> +      <table class="diffstat-table stripes2">{diffstat}</table>
>      </div>
>    </td>
>  </tr>
> diff --git a/mercurial/templates/static/style-paper.css b/mercurial/templates/static/style-paper.css
> --- a/mercurial/templates/static/style-paper.css
> +++ b/mercurial/templates/static/style-paper.css
> @@ -108,6 +108,9 @@ a { text-decoration:none; }
>  .minusline { color: #dc143c; } /* crimson */
>  .atline { color: purple; }
>
> +.diffstat-table {
> +  margin-top: 1em;
> +}
>  .diffstat-file {
>    white-space: nowrap;
>    font-size: 90%;
> diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
> --- a/tests/test-hgweb-commands.t
> +++ b/tests/test-hgweb-commands.t
> @@ -893,8 +893,7 @@ Logs and changes
>        <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
>        <div id="diffstatdetails" style="display:none;">
>          <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
> -        <p></p>
> -        <table class="stripes2">  <tr>
> +        <table class="diffstat-table stripes2">  <tr>
>        <td class="diffstat-file"><a href="#l1.1">da/foo</a></td>
>        <td class="diffstat-total" align="right">1</td>
>        <td class="diffstat-graph">
> diff --git a/tests/test-hgweb-diffs.t b/tests/test-hgweb-diffs.t
> --- a/tests/test-hgweb-diffs.t
> +++ b/tests/test-hgweb-diffs.t
> @@ -118,8 +118,7 @@ revision
>        <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
>        <div id="diffstatdetails" style="display:none;">
>          <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
> -        <p></p>
> -        <table class="stripes2">  <tr>
> +        <table class="diffstat-table stripes2">  <tr>
>        <td class="diffstat-file"><a href="#l1.1">a</a></td>
>        <td class="diffstat-total" align="right">1</td>
>        <td class="diffstat-graph">
> @@ -390,8 +389,7 @@ revision
>        <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
>        <div id="diffstatdetails" style="display:none;">
>          <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
> -        <p></p>
> -        <table class="stripes2">  <tr>
> +        <table class="diffstat-table stripes2">  <tr>
>        <td class="diffstat-file"><a href="#l1.1">a</a></td>
>        <td class="diffstat-total" align="right">1</td>
>        <td class="diffstat-graph">
> diff --git a/tests/test-hgweb-removed.t b/tests/test-hgweb-removed.t
> --- a/tests/test-hgweb-removed.t
> +++ b/tests/test-hgweb-removed.t
> @@ -99,8 +99,7 @@ revision
>        <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
>        <div id="diffstatdetails" style="display:none;">
>          <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
> -        <p></p>
> -        <table class="stripes2">  <tr>
> +        <table class="diffstat-table stripes2">  <tr>
>        <td class="diffstat-file"><a href="#l1.1">a</a></td>
>        <td class="diffstat-total" align="right">1</td>
>        <td class="diffstat-graph">
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Augie Fackler - Feb. 10, 2015, 3:26 a.m.
On Fri, Feb 06, 2015 at 12:36:53AM +0800, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov <engored@ya.ru>
> # Date 1423139670 -28800
> #      Thu Feb 05 20:34:30 2015 +0800
> # Node ID bf661a03fddcaa9d50ca545241e903f1f3b6b0a9
> # Parent  9756f943634f08e0b6a242d8324c5c68b76f080a
> hgweb: use css margin instead of empty <p> before diffstat table

er, I missed it and these are already pushed. Thanks!

>
> The <p> elements were used to create an empty space between the diffstat link
> and the diffstat table, but they don't have any semantic meaning, so it is
> better to use css instead.
>
> Default margins for <p> elements can differ depending on the browser, but
> usually the margin is 1em (exceptions are IE 6 and 7 with 14pt, which is
> comparable). The css rule sets top margin to 1em.
>
> This change is a "better version" of 70cfa7e1611b, where <p> elements were
> simply properly closed.
>
> diff --git a/mercurial/templates/paper/changeset.tmpl b/mercurial/templates/paper/changeset.tmpl
> --- a/mercurial/templates/paper/changeset.tmpl
> +++ b/mercurial/templates/paper/changeset.tmpl
> @@ -68,8 +68,7 @@
>      <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
>      <div id="diffstatdetails" style="display:none;">
>        <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
> -      <p></p>
> -      <table class="stripes2">{diffstat}</table>
> +      <table class="diffstat-table stripes2">{diffstat}</table>
>      </div>
>    </td>
>  </tr>
> diff --git a/mercurial/templates/static/style-paper.css b/mercurial/templates/static/style-paper.css
> --- a/mercurial/templates/static/style-paper.css
> +++ b/mercurial/templates/static/style-paper.css
> @@ -108,6 +108,9 @@ a { text-decoration:none; }
>  .minusline { color: #dc143c; } /* crimson */
>  .atline { color: purple; }
>
> +.diffstat-table {
> +  margin-top: 1em;
> +}
>  .diffstat-file {
>    white-space: nowrap;
>    font-size: 90%;
> diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
> --- a/tests/test-hgweb-commands.t
> +++ b/tests/test-hgweb-commands.t
> @@ -893,8 +893,7 @@ Logs and changes
>        <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
>        <div id="diffstatdetails" style="display:none;">
>          <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
> -        <p></p>
> -        <table class="stripes2">  <tr>
> +        <table class="diffstat-table stripes2">  <tr>
>        <td class="diffstat-file"><a href="#l1.1">da/foo</a></td>
>        <td class="diffstat-total" align="right">1</td>
>        <td class="diffstat-graph">
> diff --git a/tests/test-hgweb-diffs.t b/tests/test-hgweb-diffs.t
> --- a/tests/test-hgweb-diffs.t
> +++ b/tests/test-hgweb-diffs.t
> @@ -118,8 +118,7 @@ revision
>        <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
>        <div id="diffstatdetails" style="display:none;">
>          <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
> -        <p></p>
> -        <table class="stripes2">  <tr>
> +        <table class="diffstat-table stripes2">  <tr>
>        <td class="diffstat-file"><a href="#l1.1">a</a></td>
>        <td class="diffstat-total" align="right">1</td>
>        <td class="diffstat-graph">
> @@ -390,8 +389,7 @@ revision
>        <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
>        <div id="diffstatdetails" style="display:none;">
>          <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
> -        <p></p>
> -        <table class="stripes2">  <tr>
> +        <table class="diffstat-table stripes2">  <tr>
>        <td class="diffstat-file"><a href="#l1.1">a</a></td>
>        <td class="diffstat-total" align="right">1</td>
>        <td class="diffstat-graph">
> diff --git a/tests/test-hgweb-removed.t b/tests/test-hgweb-removed.t
> --- a/tests/test-hgweb-removed.t
> +++ b/tests/test-hgweb-removed.t
> @@ -99,8 +99,7 @@ revision
>        <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
>        <div id="diffstatdetails" style="display:none;">
>          <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
> -        <p></p>
> -        <table class="stripes2">  <tr>
> +        <table class="diffstat-table stripes2">  <tr>
>        <td class="diffstat-file"><a href="#l1.1">a</a></td>
>        <td class="diffstat-total" align="right">1</td>
>        <td class="diffstat-graph">
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/templates/paper/changeset.tmpl b/mercurial/templates/paper/changeset.tmpl
--- a/mercurial/templates/paper/changeset.tmpl
+++ b/mercurial/templates/paper/changeset.tmpl
@@ -68,8 +68,7 @@ 
     <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
     <div id="diffstatdetails" style="display:none;">
       <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
-      <p></p>
-      <table class="stripes2">{diffstat}</table>
+      <table class="diffstat-table stripes2">{diffstat}</table>
     </div>
   </td>
 </tr>
diff --git a/mercurial/templates/static/style-paper.css b/mercurial/templates/static/style-paper.css
--- a/mercurial/templates/static/style-paper.css
+++ b/mercurial/templates/static/style-paper.css
@@ -108,6 +108,9 @@  a { text-decoration:none; }
 .minusline { color: #dc143c; } /* crimson */
 .atline { color: purple; }
 
+.diffstat-table {
+  margin-top: 1em;
+}
 .diffstat-file {
   white-space: nowrap;
   font-size: 90%;
diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
--- a/tests/test-hgweb-commands.t
+++ b/tests/test-hgweb-commands.t
@@ -893,8 +893,7 @@  Logs and changes
       <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
       <div id="diffstatdetails" style="display:none;">
         <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
-        <p></p>
-        <table class="stripes2">  <tr>
+        <table class="diffstat-table stripes2">  <tr>
       <td class="diffstat-file"><a href="#l1.1">da/foo</a></td>
       <td class="diffstat-total" align="right">1</td>
       <td class="diffstat-graph">
diff --git a/tests/test-hgweb-diffs.t b/tests/test-hgweb-diffs.t
--- a/tests/test-hgweb-diffs.t
+++ b/tests/test-hgweb-diffs.t
@@ -118,8 +118,7 @@  revision
       <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
       <div id="diffstatdetails" style="display:none;">
         <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
-        <p></p>
-        <table class="stripes2">  <tr>
+        <table class="diffstat-table stripes2">  <tr>
       <td class="diffstat-file"><a href="#l1.1">a</a></td>
       <td class="diffstat-total" align="right">1</td>
       <td class="diffstat-graph">
@@ -390,8 +389,7 @@  revision
       <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
       <div id="diffstatdetails" style="display:none;">
         <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
-        <p></p>
-        <table class="stripes2">  <tr>
+        <table class="diffstat-table stripes2">  <tr>
       <td class="diffstat-file"><a href="#l1.1">a</a></td>
       <td class="diffstat-total" align="right">1</td>
       <td class="diffstat-graph">
diff --git a/tests/test-hgweb-removed.t b/tests/test-hgweb-removed.t
--- a/tests/test-hgweb-removed.t
+++ b/tests/test-hgweb-removed.t
@@ -99,8 +99,7 @@  revision
       <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
       <div id="diffstatdetails" style="display:none;">
         <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
-        <p></p>
-        <table class="stripes2">  <tr>
+        <table class="diffstat-table stripes2">  <tr>
       <td class="diffstat-file"><a href="#l1.1">a</a></td>
       <td class="diffstat-total" align="right">1</td>
       <td class="diffstat-graph">