doc/gendoc.py
changeset 9317 8c1df18452aa
parent 9310 5724cd7b3688
child 9484 c96d73dd956d
equal deleted inserted replaced
9310:5724cd7b3688 9317:8c1df18452aa
     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
       
    11 
    10 
    12 def get_desc(docstr):
    11 def get_desc(docstr):
    13     if not docstr:
    12     if not docstr:
    14         return "", ""
    13         return "", ""
    15     # sanitize
    14     # sanitize
   110         if callable(doc):
   109         if callable(doc):
   111             doc = doc()
   110             doc = doc()
   112         ui.write(doc)
   111         ui.write(doc)
   113         ui.write("\n")
   112         ui.write("\n")
   114 
   113 
   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 
       
   125 if __name__ == "__main__":
   114 if __name__ == "__main__":
   126     show_doc(sys.stdout)
   115     show_doc(sys.stdout)