in pelican/plugins/asfindex.py [0:0]
def get_index(site_index, scope):
current_folder = None
started = False
site_listing = ''
if not scope:
return
scoped = False
if scope != '**':
scoped = True
for p in site_index:
_path, page = os.path.split(p[0])
folder = page.capitalize()
if not scoped or (scoped and p[0].startswith(scope)):
if folder != current_folder:
if started:
site_listing += '</ol>\n'
started = True
site_listing += f'<h3><a href="{p[1]}">{p[2]}</a></h3>\n'
site_listing += '<ol>\n'
current_folder = folder
else:
# menu item for page
site_listing += f'<li><a href="{p[1]}">{p[2]}</a></li>\n'
if started:
site_listing += '</ol>\n'
return site_listing