Patchwork [4,of,9] minirst: don't generate TH elements for the first row in table

login
register
mail settings
Submitter Dan Villiom Podlaski Christiansen
Date March 2, 2013, 3:51 p.m.
Message ID <8aa053b99c24b3be7430.1362239499@dookie.local>
Download mbox | patch
Permalink /patch/1071/
State Accepted, archived
Headers show

Comments

Dan Villiom Podlaski Christiansen - March 2, 2013, 3:51 p.m.
# HG changeset patch
# User Dan Villiom Podlaski Christiansen  <danchr@gmail.com>
# Date 1360446681 0
#      Sat Feb 09 21:51:21 2013 +0000
# Node ID 8aa053b99c24b3be7430b7445d3a51977fa2c4b9
# Parent  6e676fb6ea44188a90ce062b7cbc68e99ea08019
minirst: don't generate TH elements for the first row in table

We mainly use them for option tables -- browsers bolding and centering
them looks wrong.

Patch

diff --git a/mercurial/minirst.py b/mercurial/minirst.py
--- a/mercurial/minirst.py
+++ b/mercurial/minirst.py
@@ -558,10 +558,7 @@  def formathtml(blocks):
             for row in table:
                 l = []
                 for v in zip(row):
-                    if not t:
-                        l.append('<th>%s</th>' % v)
-                    else:
-                        l.append('<td>%s</td>' % v)
+                    l.append('<td>%s</td>' % v)
                 t.append(' <tr>%s</tr>\n' % ''.join(l))
             out.append('<table>\n%s</table>\n' % ''.join(t))
         elif btype == 'definition':
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1531,7 +1531,7 @@  Dish up an empty repo; serve it cold.
   options:
   </p>
   <table>
-   <tr><th>-I</th><th>--include PATTERN [+]</th><th>include names matching the given patterns</th></tr>
+   <tr><td>-I</td><td>--include PATTERN [+]</td><td>include names matching the given patterns</td></tr>
    <tr><td>-X</td><td>--exclude PATTERN [+]</td><td>exclude names matching the given patterns</td></tr>
    <tr><td>-S</td><td>--subrepos</td><td>recurse into subrepositories</td></tr>
    <tr><td>-n</td><td>--dry-run</td><td>do not perform actions, just print output</td></tr>
@@ -1543,7 +1543,7 @@  Dish up an empty repo; serve it cold.
   global options:
   </p>
   <table>
-   <tr><th>-R</th><th>--repository REPO</th><th>repository root directory or name of overlay bundle file</th></tr>
+   <tr><td>-R</td><td>--repository REPO</td><td>repository root directory or name of overlay bundle file</td></tr>
    <tr><td></td><td>--cwd DIR</td><td>change working directory</td></tr>
    <tr><td>-y</td><td>--noninteractive</td><td>do not prompt, automatically pick the first choice for all prompts</td></tr>
    <tr><td>-q</td><td>--quiet</td><td>suppress output</td></tr>
@@ -1643,7 +1643,7 @@  Dish up an empty repo; serve it cold.
   options:
   </p>
   <table>
-   <tr><th>-A</th><th>--after</th><th>record delete for missing files</th></tr>
+   <tr><td>-A</td><td>--after</td><td>record delete for missing files</td></tr>
    <tr><td>-f</td><td>--force</td><td>remove (and delete) file even if added or modified</td></tr>
    <tr><td>-I</td><td>--include PATTERN [+]</td><td>include names matching the given patterns</td></tr>
    <tr><td>-X</td><td>--exclude PATTERN [+]</td><td>exclude names matching the given patterns</td></tr>
@@ -1655,7 +1655,7 @@  Dish up an empty repo; serve it cold.
   global options:
   </p>
   <table>
-   <tr><th>-R</th><th>--repository REPO</th><th>repository root directory or name of overlay bundle file</th></tr>
+   <tr><td>-R</td><td>--repository REPO</td><td>repository root directory or name of overlay bundle file</td></tr>
    <tr><td></td><td>--cwd DIR</td><td>change working directory</td></tr>
    <tr><td>-y</td><td>--noninteractive</td><td>do not prompt, automatically pick the first choice for all prompts</td></tr>
    <tr><td>-q</td><td>--quiet</td><td>suppress output</td></tr>
diff --git a/tests/test-minirst.py.out b/tests/test-minirst.py.out
--- a/tests/test-minirst.py.out
+++ b/tests/test-minirst.py.out
@@ -758,7 +758,7 @@  30 column format:
 html format:
 ----------------------------------------------------------------------
 <table>
- <tr><th>a</th><th>b</th><th>c</th></tr>
+ <tr><td>a</td><td>b</td><td>c</td></tr>
  <tr><td>1</td><td>2</td><td>3</td></tr>
  <tr><td>foo</td><td>bar</td><td>baz this list is very very very long man</td></tr>
 </table>