[PATCH 8 of 8] gendoc: generate documentation for Mercurial extensions

Cédric Duval cedricduval at free.fr
Sat Jul 4 15:05:14 CDT 2009


# HG changeset patch
# User Cédric Duval <cedricduval at free.fr>
# Date 1246737838 -7200
# Node ID 74ccc762beb4749cfeb9964f5bdc99d5171aab26
# Parent  34339d7a94a81820e6aa3e5b649435cd8a0a6b97
gendoc: generate documentation for Mercurial extensions

New EXTENSIONS section, containing the description for each extension.

diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -1,10 +1,11 @@
-import sys, textwrap
+import os, sys, textwrap
 # import from the live mercurial repo
 sys.path.insert(0, "..")
 from mercurial import demandimport; demandimport.enable()
 from mercurial.commands import table, globalopts
 from mercurial.i18n import gettext, _
 from mercurial.help import helptable
+from mercurial import extdoc
 
 def get_desc(docstr):
     if not docstr:
@@ -108,5 +109,15 @@
         ui.write(doc)
         ui.write("\n")
 
+    # print extensions
+    underlined(_("EXTENSIONS"))
+    ui.write('\n')
+    os.chdir('..')
+    for name, desc in sorted(extdoc.extract('hgext', raw=True).iteritems()):
+        ui.write('[[%s]]\n%s::\n' % (name, name))
+        d = '\n'.join([ '    ' + line for line in gettext(desc).splitlines() ])
+        ui.write('%s\n\n' % d)
+    os.chdir('doc')
+
 if __name__ == "__main__":
     show_doc(sys.stdout)



More information about the Mercurial-devel mailing list