Patchwork [2,of,4] hgweb: close <p> elements

login
register
mail settings
Submitter Anton Shestakov
Date Jan. 10, 2015, 1:41 p.m.
Message ID <27d20a4ed2e6d570b99a.1420897303@neuro>
Download mbox | patch
Permalink /patch/7418/
State Accepted
Commit 70cfa7e1611b7ee3851aeae8b6e1a133a3a450aa
Headers show

Comments

Anton Shestakov - Jan. 10, 2015, 1:41 p.m.
# HG changeset patch
# User Anton Shestakov <engored@ya.ru>
# Date 1420883522 -28800
#      Sat Jan 10 17:52:02 2015 +0800
# Node ID 27d20a4ed2e6d570b99a1f0b4a688fcb02e2659e
# Parent  febf58cfae9ec7f8a29ab785d145169998008d55
hgweb: close <p> elements

<p> elements can only contain inline elements, so as soon as browser encounters
a block element (e.g. block <div>) "inside" a <p>, it puts an implicit </p>.
It's better to do this explicitly.
Mads Kiilerich - Jan. 12, 2015, 5:14 p.m.
On 01/10/2015 02:41 PM, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov <engored@ya.ru>
> # Date 1420883522 -28800
> #      Sat Jan 10 17:52:02 2015 +0800
> # Node ID 27d20a4ed2e6d570b99a1f0b4a688fcb02e2659e
> # Parent  febf58cfae9ec7f8a29ab785d145169998008d55
> hgweb: close <p> elements
>
> <p> elements can only contain inline elements, so as soon as browser encounters
> a block element (e.g. block <div>) "inside" a <p>, it puts an implicit </p>.
> It's better to do this explicitly.

This is obviously fixing a bug. But leaving an empty p also seems weird. 
It is very un-semantic markup.

Would it break the rendering if it was removed? If so, shouldn't that be 
addressed in CSS instead?

(This pattern seems to be repeated so often that a comment would be 
un-DRY ...)

/Mads

>
> diff --git a/mercurial/templates/paper/bookmarks.tmpl b/mercurial/templates/paper/bookmarks.tmpl
> --- a/mercurial/templates/paper/bookmarks.tmpl
> +++ b/mercurial/templates/paper/bookmarks.tmpl
> @@ -23,7 +23,7 @@
>   <ul>
>   <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
>   </ul>
> -<p>
> +<p></p>
>   <div class="atom-logo">
>   <a href="{url|urlescape}atom-bookmarks" title="subscribe to atom feed">
>   <img class="atom-logo" src="{staticurl|urlescape}feed-icon-14x14.png" alt="atom feed">
> diff --git a/mercurial/templates/paper/branches.tmpl b/mercurial/templates/paper/branches.tmpl
>
Anton Shestakov - Jan. 14, 2015, 9:11 a.m.
13.01.2015, 01:15, "Mads Kiilerich" <mads@kiilerich.com>:
> On 01/10/2015 02:41 PM, Anton Shestakov wrote:
>>  # HG changeset patch
>>  # User Anton Shestakov <engored@ya.ru>
>>  # Date 1420883522 -28800
>>  #      Sat Jan 10 17:52:02 2015 +0800
>>  # Node ID 27d20a4ed2e6d570b99a1f0b4a688fcb02e2659e
>>  # Parent  febf58cfae9ec7f8a29ab785d145169998008d55
>>  hgweb: close <p> elements
>>
>>  <p> elements can only contain inline elements, so as soon as browser encounters
>>  a block element (e.g. block <div>) "inside" a <p>, it puts an implicit </p>.
>>  It's better to do this explicitly.
>
> This is obviously fixing a bug. But leaving an empty p also seems weird.
> It is very un-semantic markup.
>
> Would it break the rendering if it was removed? If so, shouldn't that be
> addressed in CSS instead?

Apparently all those <p> did was add some padding, so yes, that will go to css.
I'll get to that in my next series, since this is already queued.

Patch

diff --git a/mercurial/templates/paper/bookmarks.tmpl b/mercurial/templates/paper/bookmarks.tmpl
--- a/mercurial/templates/paper/bookmarks.tmpl
+++ b/mercurial/templates/paper/bookmarks.tmpl
@@ -23,7 +23,7 @@ 
 <ul>
 <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
 </ul>
-<p>
+<p></p>
 <div class="atom-logo">
 <a href="{url|urlescape}atom-bookmarks" title="subscribe to atom feed">
 <img class="atom-logo" src="{staticurl|urlescape}feed-icon-14x14.png" alt="atom feed">
diff --git a/mercurial/templates/paper/branches.tmpl b/mercurial/templates/paper/branches.tmpl
--- a/mercurial/templates/paper/branches.tmpl
+++ b/mercurial/templates/paper/branches.tmpl
@@ -23,7 +23,7 @@ 
 <ul>
  <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
 </ul>
-<p>
+<p></p>
 <div class="atom-logo">
 <a href="{url|urlescape}atom-branches" title="subscribe to atom feed">
 <img class="atom-logo" src="{staticurl|urlescape}feed-icon-14x14.png" alt="atom feed">
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,7 +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></p>
       <table class="stripes2">{diffstat}</table>
     </div>
   </td>
diff --git a/mercurial/templates/paper/filelog.tmpl b/mercurial/templates/paper/filelog.tmpl
--- a/mercurial/templates/paper/filelog.tmpl
+++ b/mercurial/templates/paper/filelog.tmpl
@@ -35,7 +35,7 @@ 
 <ul>
 <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
 </ul>
-<p>
+<p></p>
 <div class="atom-logo">
 <a href="{url|urlescape}atom-log/{node|short}/{file|urlescape}" title="subscribe to atom feed">
 <img class="atom-logo" src="{staticurl|urlescape}feed-icon-14x14.png" alt="atom feed"></a>
diff --git a/mercurial/templates/paper/graph.tmpl b/mercurial/templates/paper/graph.tmpl
--- a/mercurial/templates/paper/graph.tmpl
+++ b/mercurial/templates/paper/graph.tmpl
@@ -28,7 +28,7 @@ 
 <ul>
  <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
 </ul>
-<p>
+<p></p>
 <div class="atom-logo">
 <a href="{url|urlescape}atom-log" title="subscribe to atom feed">
 <img class="atom-logo" src="{staticurl|urlescape}feed-icon-14x14.png" alt="atom feed">
diff --git a/mercurial/templates/paper/shortlog.tmpl b/mercurial/templates/paper/shortlog.tmpl
--- a/mercurial/templates/paper/shortlog.tmpl
+++ b/mercurial/templates/paper/shortlog.tmpl
@@ -30,7 +30,7 @@ 
 <ul>
  <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
 </ul>
-<p>
+<p></p>
 <div class="atom-logo">
 <a href="{url|urlescape}atom-log" title="subscribe to atom feed">
 <img class="atom-logo" src="{staticurl|urlescape}feed-icon-14x14.png" alt="atom feed">
diff --git a/mercurial/templates/paper/tags.tmpl b/mercurial/templates/paper/tags.tmpl
--- a/mercurial/templates/paper/tags.tmpl
+++ b/mercurial/templates/paper/tags.tmpl
@@ -23,7 +23,7 @@ 
 <ul>
 <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
 </ul>
-<p>
+<p></p>
 <div class="atom-logo">
 <a href="{url|urlescape}atom-tags" title="subscribe to atom feed">
 <img class="atom-logo" src="{staticurl|urlescape}feed-icon-14x14.png" alt="atom feed"></a>
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
@@ -726,7 +726,7 @@  Logs and changes
   <ul>
    <li><a href="/help">help</a></li>
   </ul>
-  <p>
+  <p></p>
   <div class="atom-logo">
   <a href="/atom-log" title="subscribe to atom feed">
   <img class="atom-logo" src="/static/feed-icon-14x14.png" alt="atom feed">
@@ -894,7 +894,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></p>
         <table class="stripes2">  <tr>
       <td class="diffstat-file"><a href="#l1.1">da/foo</a></td>
       <td class="diffstat-total" align="right">1</td>
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,7 +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></p>
         <table class="stripes2">  <tr>
       <td class="diffstat-file"><a href="#l1.1">a</a></td>
       <td class="diffstat-total" align="right">1</td>
@@ -390,7 +390,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></p>
         <table class="stripes2">  <tr>
       <td class="diffstat-file"><a href="#l1.1">a</a></td>
       <td class="diffstat-total" align="right">1</td>
diff --git a/tests/test-hgweb-empty.t b/tests/test-hgweb-empty.t
--- a/tests/test-hgweb-empty.t
+++ b/tests/test-hgweb-empty.t
@@ -48,7 +48,7 @@  Some tests for hgweb in an empty reposit
   <ul>
    <li><a href="/help">help</a></li>
   </ul>
-  <p>
+  <p></p>
   <div class="atom-logo">
   <a href="/atom-log" title="subscribe to atom feed">
   <img class="atom-logo" src="/static/feed-icon-14x14.png" alt="atom feed">
@@ -158,7 +158,7 @@  Some tests for hgweb in an empty reposit
   <ul>
    <li><a href="/help">help</a></li>
   </ul>
-  <p>
+  <p></p>
   <div class="atom-logo">
   <a href="/atom-log" title="subscribe to atom feed">
   <img class="atom-logo" src="/static/feed-icon-14x14.png" alt="atom feed">
@@ -264,7 +264,7 @@  Some tests for hgweb in an empty reposit
   <ul>
    <li><a href="/help">help</a></li>
   </ul>
-  <p>
+  <p></p>
   <div class="atom-logo">
   <a href="/atom-log" title="subscribe to atom feed">
   <img class="atom-logo" src="/static/feed-icon-14x14.png" alt="atom feed">
diff --git a/tests/test-hgweb-filelog.t b/tests/test-hgweb-filelog.t
--- a/tests/test-hgweb-filelog.t
+++ b/tests/test-hgweb-filelog.t
@@ -156,7 +156,7 @@  tip - two revisions
   <ul>
   <li><a href="/help">help</a></li>
   </ul>
-  <p>
+  <p></p>
   <div class="atom-logo">
   <a href="/atom-log/01de2d66a28d/a" title="subscribe to atom feed">
   <img class="atom-logo" src="/static/feed-icon-14x14.png" alt="atom feed"></a>
@@ -265,7 +265,7 @@  second version - two revisions
   <ul>
   <li><a href="/help">help</a></li>
   </ul>
-  <p>
+  <p></p>
   <div class="atom-logo">
   <a href="/atom-log/01de2d66a28d/a" title="subscribe to atom feed">
   <img class="atom-logo" src="/static/feed-icon-14x14.png" alt="atom feed"></a>
@@ -374,7 +374,7 @@  first deleted - one revision
   <ul>
   <li><a href="/help">help</a></li>
   </ul>
-  <p>
+  <p></p>
   <div class="atom-logo">
   <a href="/atom-log/5ed941583260/a" title="subscribe to atom feed">
   <img class="atom-logo" src="/static/feed-icon-14x14.png" alt="atom feed"></a>
@@ -478,7 +478,7 @@  first version - one revision
   <ul>
   <li><a href="/help">help</a></li>
   </ul>
-  <p>
+  <p></p>
   <div class="atom-logo">
   <a href="/atom-log/5ed941583260/a" title="subscribe to atom feed">
   <img class="atom-logo" src="/static/feed-icon-14x14.png" alt="atom feed"></a>
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,7 +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></p>
         <table class="stripes2">  <tr>
       <td class="diffstat-file"><a href="#l1.1">a</a></td>
       <td class="diffstat-total" align="right">1</td>