Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 29759:aba2bb2a6d0f
help: don't try to render a section on sub-topics
This patch subtly changes the behavior of the parsing of "X.Y" values
to not set the "section" variable when rendering a known sub-topic.
Previously, "section" would be the same as the sub-topic name. This
required the sub-topic RST to have a section named the same as the
sub-topic name.
When I made this change, the descriptions from help.internalstable
started being rendered in command line output. This didn't look correct
to me, as it didn't match the formatting of main help pages. I
corrected this by moving the top section to help.internalstable and
changing the section levels of all the "internals" topics.
The end result is that "internals" topics now match the rendering of
main topics on both the CLI and HTML. And, "internals" topics no longer
require a main section matching the name of the topic.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 06 Aug 2016 17:04:22 -0700 |
parents | cbeb2cb578b1 |
children | b37f65b047c7 |
comparison
equal
deleted
inserted
replaced
29758:3dbc95f3eb31 | 29759:aba2bb2a6d0f |
---|---|
4591 keep.append('verbose') | 4591 keep.append('verbose') |
4592 | 4592 |
4593 section = None | 4593 section = None |
4594 subtopic = None | 4594 subtopic = None |
4595 if name and '.' in name: | 4595 if name and '.' in name: |
4596 name, section = name.split('.', 1) | 4596 name, remaining = name.split('.', 1) |
4597 section = encoding.lower(section) | 4597 remaining = encoding.lower(remaining) |
4598 if '.' in section: | 4598 if '.' in remaining: |
4599 subtopic, section = section.split('.', 1) | 4599 subtopic, section = remaining.split('.', 1) |
4600 else: | 4600 else: |
4601 subtopic = section | 4601 if name in help.subtopics: |
4602 subtopic = remaining | |
4603 else: | |
4604 section = remaining | |
4602 | 4605 |
4603 text = help.help_(ui, name, subtopic=subtopic, **opts) | 4606 text = help.help_(ui, name, subtopic=subtopic, **opts) |
4604 | 4607 |
4605 formatted, pruned = minirst.format(text, textwidth, keep=keep, | 4608 formatted, pruned = minirst.format(text, textwidth, keep=keep, |
4606 section=section) | 4609 section=section) |