diff --git a/src/README.md b/src/README.md index 0e8eb93..9e5fbcc 100644 --- a/src/README.md +++ b/src/README.md @@ -51,6 +51,7 @@ digraph Dependency { index_app_names -> index_categories index_categories -> html_categories html_categories -> html_ranking + html_index_apps -> html_ranking index_rank -> html_bundle index_rank -> html_index_domains index_domains -> html_index_domains diff --git a/src/html_categories.py b/src/html_categories.py index 6f2cb65..e48b6dc 100755 --- a/src/html_categories.py +++ b/src/html_categories.py @@ -11,18 +11,19 @@ def process(affected=None, per_page=60): arr = [] for fname, json in mylib.enum_categories(): cid, cname = json['meta'] - arr.append((cid, cname)) + arr.append([cid, cname]) if affected and cid not in affected: continue out_dir = mylib.path_add(base, cid) # full url since categories can have page 2, 3, etc. - A = '

' + HTML.a_path([(parent, '/category/')], cname) + \ - 'Ranking

' + A = HTML.h2_path_n_rank(cname, [(parent, '/category/')], 'ranking/') Z = HTML.p_download_json('data.json', 'category-{}.json'.format(cid)) - # does BREAK html_ranking!! call html_categories before html_ranking _, a = HTML.write_app_pages(out_dir, json['apps'], cname, per_page, pre=A, post=Z) + # write_app_pages breaks html_ranking!! call html_ranking after this! print(' {} ({})'.format(cname, a)) + if a > 1: + arr[-1][-1] += ' ({})'.format(a) # append count mylib.symlink(fname, mylib.path_add(out_dir, 'data.json')) print(' .. {} categories'.format(len(arr))) diff --git a/src/html_index_apps.py b/src/html_index_apps.py index 8f6fa19..c63dab6 100755 --- a/src/html_index_apps.py +++ b/src/html_index_apps.py @@ -8,10 +8,11 @@ import index_app_names # get_sorted_app_names def process(per_page=60): print('generating html: app-index ...') title = 'Apps (A–Z)' - header = '

' + HTML.a_path([('Results', '/results/')], title) + '

' + header = HTML.h2_path_n_rank(title, [('Results', '/results/')], 'ranking/') p, a = HTML.write_app_pages(mylib.path_out('index', 'apps'), index_app_names.get_sorted_app_names(), title, per_page=per_page, pre=header) + # write_app_pages breaks html_ranking!! call html_ranking after this! print(' {} apps'.format(a)) print(' {} pages'.format(p)) print('') diff --git a/src/html_index_domains.py b/src/html_index_domains.py index 056f2c9..f04e587 100755 --- a/src/html_index_domains.py +++ b/src/html_index_domains.py @@ -124,7 +124,6 @@ def gen_results(c_apps, c_domains, title):
  • List of Requested Domains
  • List of Trackers
  • -

    Or go ahead to the Ranking directly.

    '''.format(title, c_apps, c_domains, c_recordings, c_logs), title=title) mylib.symlink(index_rank.fname_app_rank(), mylib.path_out('results', 'rank.json')) # after HTML.write diff --git a/src/html_ranking.py b/src/html_ranking.py index da8f230..06ecdbe 100755 --- a/src/html_ranking.py +++ b/src/html_ranking.py @@ -33,7 +33,7 @@ def write_ranking_category(cid, category_name): src = html_base(('All Categories', '/category/'), (category_name, '/category/{}/'.format(cid))) src += HTML.p_download_json('data.json', - 'results-category-{}.json'.format(cid)) + 'raw-category-{}.json'.format(cid)) src += html_script_chunk('data.json') HTML.write(base, src, title='Category Ranking: ' + category_name) mylib.symlink(index_rank.fname_ranking_category(cid), @@ -41,8 +41,10 @@ def write_ranking_category(cid, category_name): def write_ranking_all(title, base_dir): - src = html_base(('Results', '/results/')) - src += HTML.p_download_json('data.json', 'results-all.json') + # full urls since app index can have page 2, 3, etc. + src = html_base(('Results', '/results/'), + ('Apps (A–Z)', '/index/apps/')) + src += HTML.p_download_json('data.json', 'raw-apps.json') src += html_script_chunk('data.json') HTML.write(base_dir, src, title=title) mylib.symlink(index_rank.fname_ranking_all(), @@ -51,7 +53,7 @@ def write_ranking_all(title, base_dir): def process(): print('generating html: ranking ...') - write_ranking_all('Ranking', mylib.path_out('ranking')) + write_ranking_all('Ranking', mylib.path_out('index', 'apps', 'ranking')) for _, json in mylib.enum_categories(): cid, name = json['meta'] write_ranking_category(cid, name) diff --git a/src/lib_html.py b/src/lib_html.py index 50bbe0d..d035c8b 100755 --- a/src/lib_html.py +++ b/src/lib_html.py @@ -23,6 +23,11 @@ def a_subdomain(x, inner=None, attr_str=''): return '{}'.format(attr_str, x, inner or x) +def h2_path_n_rank(title, path_parts, rank_href): + return '

    {} Ranking

    '.format( + a_path(path_parts, title), rank_href) + + def p_download_json(href, download_name): return '

    Download: json

    '.format( href, download_name) diff --git a/src/main.py b/src/main.py index 9641fac..9d74aea 100755 --- a/src/main.py +++ b/src/main.py @@ -36,12 +36,12 @@ def rebuild_html(bundle_ids=None, cat_ids=None, inclIApp=True, inclRoot=False): if bundle_ids: html_bundle.process(bundle_ids) # after index_rank html_categories.process(affected=cat_ids) # after index_categories - html_ranking.process() # after html_categories html_index_domains.process() # after index_domains & index_rank if inclIApp: html_index_apps.process() # after index_categories else: print('no new bundle, not rebuilding index') + html_ranking.process() # after html_categories & html_index_apps if inclRoot: # TODO: remove check if root contains dynamic content html_root.process() diff --git a/src/z_dependency.svg b/src/z_dependency.svg index 57131a4..4ae51db 100644 --- a/src/z_dependency.svg +++ b/src/z_dependency.svg @@ -38,12 +38,12 @@ -download_tracker +download_tracker download_tracker -.->download_tracker +.->download_tracker @@ -93,27 +93,27 @@ -html_bundle +html_bundle html_bundle -index_rank->html_bundle +index_rank->html_bundle -html_index_domains +html_index_domains html_index_domains -index_rank->html_index_domains +index_rank->html_index_domains -index_domains->html_index_domains +index_domains->html_index_domains @@ -139,13 +139,18 @@ html_ranking - -html_ranking + +html_ranking + + +html_index_apps->html_ranking + + html_categories->html_ranking - - + + \ No newline at end of file