changeset 18751:13aa81e2fded

minirst: HTML formatter tweaks output table rows on distinct lines don't make the first row a table header
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Sat, 09 Feb 2013 21:51:21 +0000
parents c9d923f5d8ae
children fabbaa250977
files mercurial/minirst.py tests/test-help.t tests/test-minirst.py.out
diffstat 3 files changed, 130 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/minirst.py	Sat Feb 09 17:44:25 2013 -0500
+++ b/mercurial/minirst.py	Sat Feb 09 21:51:21 2013 +0000
@@ -564,7 +564,7 @@
                 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)
--- a/tests/test-help.t	Sat Feb 09 17:44:25 2013 -0500
+++ b/tests/test-help.t	Sat Feb 09 21:51:21 2013 +0000
@@ -1531,10 +1531,18 @@
   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 @@
   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 @@
   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 @@
   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
--- a/tests/test-minirst.py.out	Sat Feb 09 17:44:25 2013 -0500
+++ b/tests/test-minirst.py.out	Sat Feb 09 21:51:21 2013 +0000
@@ -758,9 +758,15 @@
 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>
 ----------------------------------------------------------------------