doc/gendoc.py
changeset 3800 54fd4d3b4fce
parent 1814 7956893e8458
child 5209 bbdcdc7f170e
equal deleted inserted replaced
3799:58133ba5847d 3800:54fd4d3b4fce
     1 import sys, textwrap
     1 import sys, textwrap
     2 # import from the live mercurial repo
     2 # import from the live mercurial repo
     3 sys.path.insert(0, "..")
     3 sys.path.insert(0, "..")
     4 from mercurial.commands import table, globalopts
     4 from mercurial.commands import table, globalopts
     5 from mercurial.i18n import gettext as _
     5 from mercurial.i18n import gettext as _
       
     6 from mercurial.help import helptable
     6 
     7 
     7 def get_desc(docstr):
     8 def get_desc(docstr):
     8     if not docstr:
     9     if not docstr:
     9         return "", ""
    10         return "", ""
    10     # sanitize
    11     # sanitize
    86                 ui.write("\n")
    87                 ui.write("\n")
    87             # aliases
    88             # aliases
    88             if d['aliases']:
    89             if d['aliases']:
    89                 ui.write(_("    aliases: %s\n\n") % " ".join(d['aliases']))
    90                 ui.write(_("    aliases: %s\n\n") % " ".join(d['aliases']))
    90 
    91 
       
    92     # print topics
       
    93     for t in helptable:
       
    94         l = t.split("|")
       
    95         section = l[-1]
       
    96         underlined(_(section).upper())
       
    97         doc = helptable[t]
       
    98         if callable(doc):
       
    99             doc = doc()
       
   100         ui.write(_(doc))
       
   101         ui.write("\n")
       
   102 
    91 if __name__ == "__main__":
   103 if __name__ == "__main__":
    92     show_doc(sys.stdout)
   104     show_doc(sys.stdout)