Skip to content

Commit b7f3d53

Browse files
committed
Fix mmeng-4362: re-sort the indexing page items
1 parent 23b1026 commit b7f3d53

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

charon/pkgs/indexing.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from jinja2 import Template
2424
import os
2525
import logging
26-
from typing import List, Set, Dict
26+
from typing import List, Dict
2727

2828
from charon.utils.strings import remove_prefix
2929

@@ -48,7 +48,7 @@ def __get_index_template(package_type: str) -> str:
4848

4949
class IndexedHTML(object):
5050
# object for holding index html file data
51-
def __init__(self, title: str, header: str, items: Set[str]):
51+
def __init__(self, title: str, header: str, items: List[str]):
5252
self.title = title
5353
self.header = header
5454
self.items = items
@@ -174,8 +174,8 @@ def __to_html_content(package_type: str, contents: List[str], folder: str) -> st
174174
items = temp_items
175175
else:
176176
items.extend(contents)
177-
items_set = set(__sort_index_items(items))
178-
index = IndexedHTML(title=folder, header=folder, items=items_set)
177+
items_result = list(filter(lambda c: c.strip(), __sort_index_items(set(items))))
178+
index = IndexedHTML(title=folder, header=folder, items=items_result)
179179
return index.generate_index_file_content(package_type)
180180

181181

@@ -303,8 +303,8 @@ def re_index(
303303
real_contents.append(c)
304304
else:
305305
real_contents = contents
306-
logger.debug(real_contents)
307306
index_content = __to_html_content(package_type, real_contents, path)
307+
logger.debug("The re-indexed page content: %s", index_content)
308308
if not dry_run:
309309
index_path = os.path.join(path, "index.html")
310310
if path == "/":

0 commit comments

Comments
 (0)