[PATCH] minirst: establish leveling for nested definitions
Augie Fackler
raf at durin42.com
Sun Sep 13 21:29:58 CDT 2015
On Thu, Sep 10, 2015 at 12:48:41PM -0500, timeless at mozdev.org wrote:
> # HG changeset patch
> # User timeless at mozdev.org
> # Date 1441896500 14400
> # Thu Sep 10 10:48:20 2015 -0400
> # Node ID c8ae009a6ebd0b0fdd2a1dc35f394a26a59e613f
> # Parent ea489d94e1dc1fc3dc1dcbef1c86c18c49605ed1
> minirst: establish leveling for nested definitions
queued, thanks
>
> diff --git a/mercurial/minirst.py b/mercurial/minirst.py
> --- a/mercurial/minirst.py
> +++ b/mercurial/minirst.py
> @@ -722,6 +722,20 @@
> nest += i
> level = nest.index(i) + 1
> nest = nest[:level]
> + for i in range(1, len(secs) + 1):
> + sec = secs[-i]
> + if sec[1] < level:
> + break
> + siblings = [a for a in sec[2] if a['type'] == 'definition']
> + if siblings:
> + siblingindent = siblings[-1]['indent']
> + indent = b['indent']
> + if siblingindent < indent:
> + level += 1
> + break
> + elif siblingindent == indent:
> + level = sec[1]
> + break
> secs.append((getname(b), level, [b]))
> else:
> if not secs:
> diff --git a/tests/test-help.t b/tests/test-help.t
> --- a/tests/test-help.t
> +++ b/tests/test-help.t
> @@ -936,6 +936,12 @@
> $ hg help config.charsets |grep "Email example:" > /dev/null
> [1]
>
> +Show nested definitions
> +("profiling.type"[break]"ls"[break]"stat"[break])
> +
> + $ hg help config.type|grep '^$'|wc -l
> + \s*3 (re)
> +
> Last item in help config.*:
>
> $ hg help config.`hg help config|grep '^ "'| \
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list