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

Martin Geisler mg at lazybytes.net
Mon Jul 6 18:15:23 CDT 2009


Cédric Duval <cedricduval at free.fr> writes:

> 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()):

Would it work to pass '../hgext' as the path instead of doing the
os.chdir back and forth?

> +        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)

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20090707/41795654/attachment.pgp 


More information about the Mercurial-devel mailing list