From 3bd0bd55cc094a831ee6b2a1cd6e35f6847fd600 2016-06-30 18:57:19 From: Matthias Bussonnier Date: 2016-06-30 18:57:19 Subject: [PATCH] Sort by filter, before sorting by shortcut. Tend to group Vi/Emacs things separately. --- diff --git a/docs/autogen_shortcuts.py b/docs/autogen_shortcuts.py index 65108ff..b65ad99 100755 --- a/docs/autogen_shortcuts.py +++ b/docs/autogen_shortcuts.py @@ -71,13 +71,15 @@ for kb in ipy_bindings: if __name__ == '__main__': + sort_key = lambda k:(str(k[0][1]),str(k[0][0])) + here = abspath(dirname(__file__)) dest = join(here, 'source', 'config', 'shortcuts') with open(join(dest, 'single_filtered.csv'), 'w') as csv: - for k, v in sorted(single_filter.items()): + for k, v in sorted(single_filter.items(), key=sort_key): csv.write(':kbd:`{}`\t{}\t{}\n'.format(k[0], k[1], v)) with open(join(dest, 'multi_filtered.csv'), 'w') as csv: - for k, v in sorted(multi_filter.items()): + for k, v in sorted(multi_filter.items(), key=sort_key): csv.write(':kbd:`{}`\t{}\t{}\n'.format(k[0], k[1], v))