Skip to content

Commit 831a422

Browse files
author
p12
committed
Transform: sort the arrays in the AutoLinker definition files
1 parent 85460c8 commit 831a422

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

index2autolinker.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,11 @@ def process_item_hook(self, el, full_name, full_link):
141141
tr = Index2AutolinkerLinks()
142142
tr.transform(sys.argv[1])
143143

144-
json_groups = []
145-
for k in groups:
146-
json_groups.append(groups[k])
144+
json_groups = [ v for v in groups.values() ]
147145

148-
out_f.write(json.dumps({ 'groups' : json_groups, 'links' : links }, indent=1,
146+
json_groups = sorted(json_groups, key=lambda x: x['name'])
147+
links = sorted(links, key=lambda x: x['target'])
148+
149+
out_f.write(json.dumps({ 'groups' : json_groups, 'links' : links}, indent=0,
149150
sort_keys=True))
150151
out_f.close()

0 commit comments

Comments
 (0)