@@ -101,22 +101,23 @@ def invert_order(node):
101
101
flat_hierarchy = utils .flatten_tree_structure (root_list )
102
102
else :
103
103
flat_hierarchy = self .site .flat_hierarchy_per_classification [taxonomy_name ][lang ]
104
- # Build flattened hierarchy list
105
- hierarchy = [(taxonomy .get_classification_friendly_name (node .classification_name , lang , only_last_component = False ),
106
- node .classification_name , node .classification_path ,
107
- self .site .link (taxonomy_name , node .classification_name , lang ),
108
- node .indent_levels , node .indent_change_before ,
109
- node .indent_change_after ,
110
- len (node .children ),
111
- len ([post for post in posts_per_tag [node .classification_name ] if acceptor (post )]))
112
- for node in flat_hierarchy ]
113
104
else :
114
- # Fake hierarchy
115
- hierarchy = [(classification_name , classification , taxonomy .extract_hierarchy (classification ),
116
- self .site .link (taxonomy_name , classification , lang ),
117
- (i , len (result )), 1 if i == 0 else 0 , - 1 if i == len (result ) - 1 else 0 , 0 ,
118
- count )
119
- for i , ((_ , count , link ), (classification_name , classification )) in enumerate (zip (result , classifications ))]
105
+ root_list = []
106
+ for classification_name , classification in classifications :
107
+ node = utils .TreeNode ('' )
108
+ node .classification_name = classification_name
109
+ node .classification_path = taxonomy .extract_hierarchy (classification )
110
+ root_list .append (node )
111
+ flat_hierarchy = utils .flatten_tree_structure (root_list )
112
+ # Build flattened hierarchy list
113
+ hierarchy = [(taxonomy .get_classification_friendly_name (node .classification_name , lang , only_last_component = False ),
114
+ node .classification_name , node .classification_path ,
115
+ self .site .link (taxonomy_name , node .classification_name , lang ),
116
+ node .indent_levels , node .indent_change_before ,
117
+ node .indent_change_after ,
118
+ len (node .children ),
119
+ len ([post for post in posts_per_tag [node .classification_name ] if acceptor (post )]))
120
+ for node in flat_hierarchy ]
120
121
return result , hierarchy
121
122
else :
122
123
return None , None
0 commit comments