Create individual category json
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
import lib_common as mylib
|
||||
import lib_html as HTML
|
||||
import index_categories # enum_all_categories
|
||||
|
||||
|
||||
def process(affected=None, per_page=60):
|
||||
@@ -10,18 +9,19 @@ def process(affected=None, per_page=60):
|
||||
base = mylib.path_out('category')
|
||||
parent = 'All Categories'
|
||||
arr = []
|
||||
for cid, cat, apps in sorted(index_categories.enum_all_categories(),
|
||||
key=lambda x: x[1].lower()):
|
||||
arr.append((cid, cat))
|
||||
for json in mylib.enum_categories():
|
||||
cid, cname = json['cat']
|
||||
arr.append((cid, cname))
|
||||
if affected and cid not in affected:
|
||||
continue
|
||||
pre = HTML.h2(HTML.a_path([(parent, '../')], cat))
|
||||
_, a = HTML.write_app_pages(mylib.path_add(base, cid), apps, cat,
|
||||
per_page, pre=pre)
|
||||
print(' {} ({})'.format(cat, a))
|
||||
pre = HTML.h2(HTML.a_path([(parent, '../')], cname))
|
||||
_, a = HTML.write_app_pages(mylib.path_add(base, cid), json['apps'],
|
||||
cname, per_page, pre=pre)
|
||||
print(' {} ({})'.format(cname, a))
|
||||
|
||||
print(' .. {} categories'.format(len(arr)))
|
||||
src = ''.join([HTML.a_category(cid, n) for cid, n in arr])
|
||||
mylib.sort_by_name(arr, 1)
|
||||
src = ''.join([HTML.a_category(*x) for x in arr])
|
||||
HTML.write(base, '''
|
||||
<h2>{}</h2>
|
||||
<div class="tags large center">
|
||||
|
||||
Reference in New Issue
Block a user