Patchwork [2,of,9] minirst: HTML formatter tweaks

login
register
mail settings
Submitter Dan Villiom Podlaski Christiansen
Date March 2, 2013, 3:51 p.m.
Message ID <13aa81e2fded35389403.1362239497@dookie.local>
Download mbox | patch
Permalink /patch/1068/
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 13aa81e2fded35389403d2ae3a750e5af6c65dab
# Parent  c9d923f5d8aebe2f5f297be9dab27f2f307b086b
minirst: HTML formatter tweaks

output table rows on distinct lines
don't make the first row a table header

Patch

diff --git a/mercurial/minirst.py b/mercurial/minirst.py
--- a/mercurial/minirst.py
+++ b/mercurial/minirst.py
@@ -564,7 +564,7 @@  def formathtml(blocks):
                 l = []
                 for v in row:
                     l.append('<td>%s</td>' % escape(v))
-                t.append(' <tr>%s</tr>\n' % ''.join(l))
+                t.append('<tr>%s</tr>\n' % '\n'.join(l))
             out.append('<table>\n%s</table>\n' % ''.join(t))
         elif btype == 'definition':
             openlist('dl', level)
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1531,10 +1531,18 @@  Dish up an empty repo; serve it cold.
   options:
   </p>
   <table>
-   <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>
+  <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>
   </table>
   <p>
   [+] marked option can be specified multiple times
@@ -1543,22 +1551,54 @@  Dish up an empty repo; serve it cold.
   global options:
   </p>
   <table>
-   <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>
-   <tr><td>-v</td><td>--verbose</td><td>enable additional output</td></tr>
-   <tr><td></td><td>--config CONFIG [+]</td><td>set/override config option (use 'section.name=value')</td></tr>
-   <tr><td></td><td>--debug</td><td>enable debugging output</td></tr>
-   <tr><td></td><td>--debugger</td><td>start debugger</td></tr>
-   <tr><td></td><td>--encoding ENCODE</td><td>set the charset encoding (default: ascii)</td></tr>
-   <tr><td></td><td>--encodingmode MODE</td><td>set the charset encoding mode (default: strict)</td></tr>
-   <tr><td></td><td>--traceback</td><td>always print a traceback on exception</td></tr>
-   <tr><td></td><td>--time</td><td>time how long the command takes</td></tr>
-   <tr><td></td><td>--profile</td><td>print command execution profile</td></tr>
-   <tr><td></td><td>--version</td><td>output version information and exit</td></tr>
-   <tr><td>-h</td><td>--help</td><td>display help and exit</td></tr>
-   <tr><td></td><td>--hidden</td><td>consider hidden changesets</td></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>
+  <tr><td>-v</td>
+  <td>--verbose</td>
+  <td>enable additional output</td></tr>
+  <tr><td></td>
+  <td>--config CONFIG [+]</td>
+  <td>set/override config option (use 'section.name=value')</td></tr>
+  <tr><td></td>
+  <td>--debug</td>
+  <td>enable debugging output</td></tr>
+  <tr><td></td>
+  <td>--debugger</td>
+  <td>start debugger</td></tr>
+  <tr><td></td>
+  <td>--encoding ENCODE</td>
+  <td>set the charset encoding (default: ascii)</td></tr>
+  <tr><td></td>
+  <td>--encodingmode MODE</td>
+  <td>set the charset encoding mode (default: strict)</td></tr>
+  <tr><td></td>
+  <td>--traceback</td>
+  <td>always print a traceback on exception</td></tr>
+  <tr><td></td>
+  <td>--time</td>
+  <td>time how long the command takes</td></tr>
+  <tr><td></td>
+  <td>--profile</td>
+  <td>print command execution profile</td></tr>
+  <tr><td></td>
+  <td>--version</td>
+  <td>output version information and exit</td></tr>
+  <tr><td>-h</td>
+  <td>--help</td>
+  <td>display help and exit</td></tr>
+  <tr><td></td>
+  <td>--hidden</td>
+  <td>consider hidden changesets</td></tr>
   </table>
   <p>
   [+] marked option can be specified multiple times
@@ -1643,10 +1683,18 @@  Dish up an empty repo; serve it cold.
   options:
   </p>
   <table>
-   <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>
+  <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>
   </table>
   <p>
   [+] marked option can be specified multiple times
@@ -1655,22 +1703,54 @@  Dish up an empty repo; serve it cold.
   global options:
   </p>
   <table>
-   <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>
-   <tr><td>-v</td><td>--verbose</td><td>enable additional output</td></tr>
-   <tr><td></td><td>--config CONFIG [+]</td><td>set/override config option (use 'section.name=value')</td></tr>
-   <tr><td></td><td>--debug</td><td>enable debugging output</td></tr>
-   <tr><td></td><td>--debugger</td><td>start debugger</td></tr>
-   <tr><td></td><td>--encoding ENCODE</td><td>set the charset encoding (default: ascii)</td></tr>
-   <tr><td></td><td>--encodingmode MODE</td><td>set the charset encoding mode (default: strict)</td></tr>
-   <tr><td></td><td>--traceback</td><td>always print a traceback on exception</td></tr>
-   <tr><td></td><td>--time</td><td>time how long the command takes</td></tr>
-   <tr><td></td><td>--profile</td><td>print command execution profile</td></tr>
-   <tr><td></td><td>--version</td><td>output version information and exit</td></tr>
-   <tr><td>-h</td><td>--help</td><td>display help and exit</td></tr>
-   <tr><td></td><td>--hidden</td><td>consider hidden changesets</td></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>
+  <tr><td>-v</td>
+  <td>--verbose</td>
+  <td>enable additional output</td></tr>
+  <tr><td></td>
+  <td>--config CONFIG [+]</td>
+  <td>set/override config option (use 'section.name=value')</td></tr>
+  <tr><td></td>
+  <td>--debug</td>
+  <td>enable debugging output</td></tr>
+  <tr><td></td>
+  <td>--debugger</td>
+  <td>start debugger</td></tr>
+  <tr><td></td>
+  <td>--encoding ENCODE</td>
+  <td>set the charset encoding (default: ascii)</td></tr>
+  <tr><td></td>
+  <td>--encodingmode MODE</td>
+  <td>set the charset encoding mode (default: strict)</td></tr>
+  <tr><td></td>
+  <td>--traceback</td>
+  <td>always print a traceback on exception</td></tr>
+  <tr><td></td>
+  <td>--time</td>
+  <td>time how long the command takes</td></tr>
+  <tr><td></td>
+  <td>--profile</td>
+  <td>print command execution profile</td></tr>
+  <tr><td></td>
+  <td>--version</td>
+  <td>output version information and exit</td></tr>
+  <tr><td>-h</td>
+  <td>--help</td>
+  <td>display help and exit</td></tr>
+  <tr><td></td>
+  <td>--hidden</td>
+  <td>consider hidden changesets</td></tr>
   </table>
   <p>
   [+] marked option can be specified multiple times
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,9 +758,15 @@  30 column format:
 html format:
 ----------------------------------------------------------------------
 <table>
- <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>
+<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>
 ----------------------------------------------------------------------