Commits

Ben Bangert committed 9eb8996

Prune empty/bad categories

Comments (0)

Files changed (1)

tinkerer/ext/metadata.py

             tags[tag[1]] += 1
         for cat in p.filing["categories"]:
             categories[cat[1]] += 1
+
+    # Prune empty/bad categories
+    for cat in categories.keys():
+        if categories[cat] < 1:
+            categories.pop(cat)
+        if not cat:
+            categories.pop(cat)
+
     context["tags"] = tags
     context["taglinks"] = taglinks
     context["categories"] = categories