Merge "Nest tag project output to make sorting look sane"
This commit is contained in:
@@ -10,8 +10,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
"""Show information about tagged projects.
|
"""Show information about tagged projects."""
|
||||||
"""
|
|
||||||
|
from collections import defaultdict
|
||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
from docutils.parsers import rst
|
from docutils.parsers import rst
|
||||||
@@ -27,8 +28,7 @@ _projects_by_tag = {}
|
|||||||
|
|
||||||
|
|
||||||
class TaggedProjectsDirective(rst.Directive):
|
class TaggedProjectsDirective(rst.Directive):
|
||||||
"""List the projects tagged with the given tag.
|
"""List the projects tagged with the given tag."""
|
||||||
"""
|
|
||||||
|
|
||||||
has_content = True
|
has_content = True
|
||||||
|
|
||||||
@@ -52,14 +52,18 @@ class TaggedProjectsDirective(rst.Directive):
|
|||||||
source_name,
|
source_name,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
for team_name, deliverable in sorted(project_data):
|
team_deliverables = defaultdict(list)
|
||||||
|
|
||||||
|
for team_name, deliverable in project_data:
|
||||||
|
team = projects.slugify(team_name)
|
||||||
if deliverable is None:
|
if deliverable is None:
|
||||||
line = '- :ref:`project-%s`' % projects.slugify(team_name)
|
team_deliverables[team] = []
|
||||||
else:
|
else:
|
||||||
line = '- %s (:ref:`project-%s`)' % (
|
team_deliverables[team].append(deliverable)
|
||||||
deliverable,
|
|
||||||
projects.slugify(team_name),
|
for team in sorted(team_deliverables, key=lambda x: x.lower()):
|
||||||
)
|
line = '- :ref:`project-%s` %s' % (
|
||||||
|
team, ', '.join(team_deliverables[team]))
|
||||||
result.append(line, source_name)
|
result.append(line, source_name)
|
||||||
|
|
||||||
# Parse what we have into a new section.
|
# Parse what we have into a new section.
|
||||||
|
|||||||
Reference in New Issue
Block a user