Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions charon/pkgs/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from jinja2 import Template
import os
import logging
from typing import List, Set, Dict
from typing import List, Dict

from charon.utils.strings import remove_prefix

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

class IndexedHTML(object):
# object for holding index html file data
def __init__(self, title: str, header: str, items: Set[str]):
def __init__(self, title: str, header: str, items: List[str]):
self.title = title
self.header = header
self.items = items
Expand Down Expand Up @@ -174,8 +174,8 @@ def __to_html_content(package_type: str, contents: List[str], folder: str) -> st
items = temp_items
else:
items.extend(contents)
items_set = set(__sort_index_items(items))
index = IndexedHTML(title=folder, header=folder, items=items_set)
items_result = list(filter(lambda c: c.strip(), __sort_index_items(set(items))))
index = IndexedHTML(title=folder, header=folder, items=items_result)
return index.generate_index_file_content(package_type)


Expand Down Expand Up @@ -303,8 +303,8 @@ def re_index(
real_contents.append(c)
else:
real_contents = contents
logger.debug(real_contents)
index_content = __to_html_content(package_type, real_contents, path)
logger.debug("The re-indexed page content: %s", index_content)
if not dry_run:
index_path = os.path.join(path, "index.html")
if path == "/":
Expand Down