Ensure groups have unique names in TOC

This commit is contained in:
Hamish Willee
2017-07-01 20:35:27 +10:00
committed by Lorenz Meier
parent 6f3b6bf55b
commit 071cfc2d31

View File

@@ -404,6 +404,9 @@ class SourceParser(object):
for arch in archs: for arch in archs:
param.SetArch(arch, archs[arch]) param.SetArch(arch, archs[arch])
# Store the parameter # Store the parameter
#Create a class-specific airframe group. This is needed to catch cases where an airframe type might cross classes (e.g. simulation) #Create a class-specific airframe group. This is needed to catch cases where an airframe type might cross classes (e.g. simulation)
@@ -472,4 +475,18 @@ class SourceParser(object):
groups = sorted(groups, key=lambda x: x.GetName()) groups = sorted(groups, key=lambda x: x.GetName())
groups = sorted(groups, key=lambda x: x.GetClass()) groups = sorted(groups, key=lambda x: x.GetClass())
groups = sorted(groups, key=lambda x: self.priority.get(x.GetName(), 0), reverse=True) groups = sorted(groups, key=lambda x: self.priority.get(x.GetName(), 0), reverse=True)
#Rename duplicate groups to include the class (creating unique headings in page TOC)
duplicate_test=set()
duplicate_set=set()
for group in groups:
if group.GetName() in duplicate_test:
duplicate_set.add(group.GetName())
else:
duplicate_test.add(group.GetName() )
for group in groups:
if group.GetName() in duplicate_set:
group.name=group.GetName()+' (%s)' % group.GetClass()
return groups return groups