[PATCH 3 of 6] help: ReST tweaks

Martin Geisler martin at geisler.net
Sat Feb 9 17:10:16 CST 2013


Dan Villiom Podlaski Christiansen <danchr at gmail.com> writes:

> # HG changeset patch
> # User Dan Villiom Podlaski Christiansen  <danchr at gmail.com>
> # Date 1360414103 0
> # Node ID 03c9cfc461cce54da65f0ad0529a734181022b83
> # Parent  aa74feb1f11d43453e6ef3797e6c4c24f950a9dc
> help: ReST tweaks
>
> Use a full header for topic titles; make the indent configurable by
> the caller
>
> diff --git a/mercurial/help.py b/mercurial/help.py
> --- a/mercurial/help.py
> +++ b/mercurial/help.py
> @@ -389,12 +389,17 @@ def help_(ui, name, unknowncmd=False, fu
>          else:
>              raise error.UnknownCommand(name)
>  
> -        rst = ["%s\n\n" % header]
> +        headerstyleline = '=' * encoding.colwidth(header)
> +        rst = ["%s\n%s\n%s\n\n" % (headerstyleline, header, headerstyleline)]
> +
>          # description
>          if not doc:
> -            rst.append("    %s\n" % _("(no help text available)"))
> +            doc = _("(no help text available)")
>          if util.safehasattr(doc, '__call__'):
> -            rst += ["    %s\n" % l for l in doc().splitlines()]
> +            doc = doc()
> +
> +        indent = ' ' * int(opts.get('indent', 4))
> +        rst += ["%s%s\n" % (indent, l) for l in doc.splitlines()]

The minirst.format function has an indent argument -- can that not be
used instead?

-- 
Martin Geisler


More information about the Mercurial-devel mailing list