templates: make earlycommands and othercommands optional
authorGregory Szorc <gregory.szorc@gmail.com>
Wed, 30 Dec 2015 17:12:59 -0700
changeset 27578 d35ff0b0d0da
parent 27577 f9e755736b0e
child 27579 8e8b3371bee1
templates: make earlycommands and othercommands optional We now have sub-topics in the help system. The "helptopics" template serves as a mechanism for displaying an index of help topics. Previously, it was only used to show the top-level list of help topics, which includes special groupings of topics. In the near future, we'll adapt "helptopics" for showing the index of sub-topics. In this patch, we optionally render {earlycommands} and {othercommands} since they aren't present on sub-topics.
mercurial/templates/gitweb/helptopics.tmpl
mercurial/templates/monoblue/helptopics.tmpl
mercurial/templates/paper/helptopics.tmpl
tests/test-help.t
--- a/mercurial/templates/gitweb/helptopics.tmpl	Tue Dec 29 15:32:12 2015 -0800
+++ b/mercurial/templates/gitweb/helptopics.tmpl	Wed Dec 30 17:12:59 2015 -0700
@@ -30,11 +30,16 @@
 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
 {topics % helpentry}
 
+{if(earlycommands, '
 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
 {earlycommands % helpentry}
+')}
 
+{if(othercommands, '
 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
 {othercommands % helpentry}
+')}
+
 </table>
 
 {footer}
--- a/mercurial/templates/monoblue/helptopics.tmpl	Tue Dec 29 15:32:12 2015 -0800
+++ b/mercurial/templates/monoblue/helptopics.tmpl	Wed Dec 30 17:12:59 2015 -0700
@@ -35,11 +35,15 @@
     <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
     {topics % helpentry}
 
+    {if(earlycommands, '
     <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
     {earlycommands % helpentry}
+    ')}
 
+    {if(othercommands, '
     <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
     {othercommands % helpentry}
+    ')}
     </table>
 
 {footer}
--- a/mercurial/templates/paper/helptopics.tmpl	Tue Dec 29 15:32:12 2015 -0800
+++ b/mercurial/templates/paper/helptopics.tmpl	Wed Dec 30 17:12:59 2015 -0700
@@ -32,11 +32,16 @@
 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
 {topics % helpentry}
 
+{if(earlycommands, '
 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
 {earlycommands % helpentry}
+')}
 
+{if(othercommands, '
 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
 {othercommands % helpentry}
+')}
+
 </table>
 </div>
 </div>
--- a/tests/test-help.t	Tue Dec 29 15:32:12 2015 -0800
+++ b/tests/test-help.t	Wed Dec 30 17:12:59 2015 -0700
@@ -1787,6 +1787,7 @@
   This is the topic to test omit indicating.
   </td></tr>
   
+  
   <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
   
   <tr><td>
@@ -1909,6 +1910,8 @@
   update working directory (or switch revisions)
   </td></tr>
   
+  
+  
   <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
   
   <tr><td>
@@ -2149,6 +2152,8 @@
   </td><td>
   output version and copyright information
   </td></tr>
+  
+  
   </table>
   </div>
   </div>