diff options
author | emkael <emkael@tlen.pl> | 2019-02-20 10:06:07 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2019-02-20 10:06:07 +0100 |
commit | 80292c05a38bbce6a3472ce2c8c86bd3f43e7512 (patch) | |
tree | 084f43bf9ecc622de953fa5dd11f43b2fb77bdf9 /scripts | |
parent | d42dde697c9c0fe72ac291d7809c932231620a0d (diff) |
Ordering ranking editions in editions menu
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/rankings-editions.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/rankings-editions.py b/scripts/rankings-editions.py index 42d036f..de1f2d6 100644 --- a/scripts/rankings-editions.py +++ b/scripts/rankings-editions.py @@ -1,11 +1,12 @@ import copy, json, sys +from collections import OrderedDict from bs4 import BeautifulSoup as bs4 dates_config = json.load(file('config/dates.json')) output_file = bs4(file(sys.argv[1]), 'lxml') -editions = {} +editions = OrderedDict() for date_config in dates_config: year = date_config['name'].split(' ')[1] if year not in editions: @@ -30,7 +31,7 @@ for year, dates in editions.iteritems(): link['href'] = date[1] link['datetime'] = date[2] group.append(link) - date_group.append(group) + date_group.insert(0, group) output_file.select('#editions')[0].replace_with(date_group) file(sys.argv[1], 'w').write(output_file.prettify().encode('utf-8')) |