Mercurial > hg
comparison doc/gendoc.py @ 9310:5724cd7b3688
gendoc: documentation section describing available extensions
author | Cédric Duval <cedricduval@free.fr> |
---|---|
date | Wed, 05 Aug 2009 14:44:36 +0200 |
parents | 3d78a6c5bdc0 |
children | 8c1df18452aa |
comparison
equal
deleted
inserted
replaced
9309:cfdcb7a465af | 9310:5724cd7b3688 |
---|---|
5 sys.path.append(os.path.join('..', 'mercurial', 'pure')) | 5 sys.path.append(os.path.join('..', 'mercurial', 'pure')) |
6 from mercurial import demandimport; demandimport.enable() | 6 from mercurial import demandimport; demandimport.enable() |
7 from mercurial.commands import table, globalopts | 7 from mercurial.commands import table, globalopts |
8 from mercurial.i18n import _ | 8 from mercurial.i18n import _ |
9 from mercurial.help import helptable | 9 from mercurial.help import helptable |
10 from mercurial import extensions | |
10 | 11 |
11 def get_desc(docstr): | 12 def get_desc(docstr): |
12 if not docstr: | 13 if not docstr: |
13 return "", "" | 14 return "", "" |
14 # sanitize | 15 # sanitize |
109 if callable(doc): | 110 if callable(doc): |
110 doc = doc() | 111 doc = doc() |
111 ui.write(doc) | 112 ui.write(doc) |
112 ui.write("\n") | 113 ui.write("\n") |
113 | 114 |
115 # print extensions | |
116 underlined(_("EXTENSIONS")) | |
117 ui.write('\n') | |
118 for name in sorted(extensions.listexts('../hgext')): | |
119 ui.write('.. _%s:\n\n' % name) | |
120 doc = extensions.doc(name).splitlines() | |
121 synopsis, rest = doc[0], doc[1:] | |
122 ui.write("``%s: %s``" % (name, synopsis)) | |
123 ui.write('%s\n\n' % '\n '.join(rest)) | |
124 | |
114 if __name__ == "__main__": | 125 if __name__ == "__main__": |
115 show_doc(sys.stdout) | 126 show_doc(sys.stdout) |