changeset 19424:762e51ce3411

gendoc: add showtopic This function prints any topic.
author Takumi IINO <trot.thunder@gmail.com>
date Wed, 03 Jul 2013 21:49:39 +0900
parents 5046fede7684
children 81fbd4e66ff5
files doc/gendoc.py
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/doc/gendoc.py	Wed Jul 03 21:49:37 2013 +0900
+++ b/doc/gendoc.py	Wed Jul 03 21:49:39 2013 +0900
@@ -7,7 +7,7 @@
 from mercurial import minirst
 from mercurial.commands import table, globalopts
 from mercurial.i18n import gettext, _
-from mercurial.help import helptable
+from mercurial.help import helptable, loaddoc
 from mercurial import extensions
 from mercurial import util
 
@@ -96,6 +96,17 @@
             ui.write(minirst.subsubsection(_('Commands')))
             commandprinter(ui, cmdtable, minirst.subsubsubsection)
 
+def showtopic(ui, topic):
+    extrahelptable = [
+        (["common"], '', loaddoc('common')),
+        (["hg.1"], '', loaddoc('hg.1')),
+        (["hgignore.5"], '', loaddoc('hgignore.5')),
+        (["hgrc.5"], '', loaddoc('hgrc.5')),
+        (["hgignore.5.gendoc"], '', loaddoc('hgignore')),
+        (["hgrc.5.gendoc"], '', loaddoc('config')),
+    ]
+    helpprinter(ui, helptable + extrahelptable, None, include=[topic])
+
 def helpprinter(ui, helptable, sectionfunc, include=[], exclude=[]):
     for names, sec, doc in helptable:
         if exclude and names[0] in exclude: