From 3d772272a7bf0d582eeaa527197a08545e3399ae Mon Sep 17 00:00:00 2001 From: emkael Date: Sat, 9 Nov 2019 12:21:40 +0100 Subject: Configurable age filter menu Fixes #14 --- bin/rankings-tables-build.sh | 8 ++++---- scripts/rankings-tables-compile.py | 6 ++++++ templates/menu-age-new.html | 8 ++++++++ templates/menu-age-old.html | 6 ++++++ templates/ranking.html | 8 +------- 5 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 templates/menu-age-new.html create mode 100644 templates/menu-age-old.html diff --git a/bin/rankings-tables-build.sh b/bin/rankings-tables-build.sh index 0d85972..d3806a7 100755 --- a/bin/rankings-tables-build.sh +++ b/bin/rankings-tables-build.sh @@ -2,9 +2,9 @@ CONFIG=$1 DIR=$2 cat $CONFIG | - jq '.[] | .date, .url, .index, .name' | - xargs -n4 | - while read DATE URL INDEX NAME + jq '.[] | .date, .url, .index, .menu_age // "old", .name' | + xargs -n5 | + while read DATE URL INDEX AGEMENU NAME do - python scripts/rankings-tables-compile.py "$NAME" $INDEX $DIR/.menu.html $DATE > $DIR/$URL + python scripts/rankings-tables-compile.py "$NAME" $INDEX $DIR/.menu.html $DATE "$AGEMENU" > $DIR/$URL done diff --git a/scripts/rankings-tables-compile.py b/scripts/rankings-tables-compile.py index 925404c..0270c54 100644 --- a/scripts/rankings-tables-compile.py +++ b/scripts/rankings-tables-compile.py @@ -21,6 +21,12 @@ style_href['href'] = '%s?%d' % ('_res/ranking.css', os.path.getmtime('http/_res/ rawlink = table.select('a#rawlink')[0] rawlink['href'] = '%s/%s.csv' % (rawlink['href'], ranking_date) +age_menu = sys.argv[5] +age_menu_file = file('templates/menu-age-%s.html' % (age_menu)) +age_menu_placeholder = table.select('div[data-menu="age"]')[0] +age_menu_placeholder.clear() +age_menu_placeholder.append(bs4(age_menu_file, 'html.parser')) + menu_file = file(sys.argv[3]) menu = table.select('div.static-menu')[0] menu.clear() diff --git a/templates/menu-age-new.html b/templates/menu-age-new.html new file mode 100644 index 0000000..a0d4eb7 --- /dev/null +++ b/templates/menu-age-new.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/templates/menu-age-old.html b/templates/menu-age-old.html new file mode 100644 index 0000000..95172db --- /dev/null +++ b/templates/menu-age-old.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/templates/ranking.html b/templates/ranking.html index 77636f0..4364cb6 100644 --- a/templates/ranking.html +++ b/templates/ranking.html @@ -52,13 +52,7 @@
Kat. wiekowa
-
- - - - - - +
-- cgit v1.2.3