diff --git a/App/Source/Modules/Elements.py b/App/Source/Modules/Elements.py
index f89caeb..5c1bc9b 100644
--- a/App/Source/Modules/Elements.py
+++ b/App/Source/Modules/Elements.py
@@ -57,12 +57,11 @@ def DashifyTitle(Title:str, Done:list=[]):
# :Item 4 //
Item 4
def GenHTMLTreeList(MetaList:str, Type:str='ul', Class:str=""):
HTML = ''
- Lines = MetaList.splitlines()
CurDepth, NextDepth, PrevDepth = 0, 0, 0
- for i,e in enumerate(Lines):
- CurDepth = e.find(':')
- NextDepth = Lines[i+1].find(':') if i+1 < len(Lines) else 0
- HTML += '\n' + e[CurDepth+1:]
+ for i,item in enumerate(MetaList):
+ CurDepth = item['text'].find(':')
+ NextDepth = MetaList[i+1]['text'].find(':') if i+1 < len(MetaList) else 0
+ HTML += f'\n' + item['text'][CurDepth+1:]
if NextDepth == CurDepth:
HTML += ''
elif NextDepth > CurDepth:
@@ -144,14 +143,14 @@ def MakeListTitle(File:str, Meta:dict, Titles:list, Prefer:str, BlogName:str, Pa
def FormatTitles(Titles:list, Flatten=False):
# TODO: Somehow titles written in Pug can end up here and don't work, they should be handled
- List, DashyTitles = '', []
+ List, DashyTitles = [], []
for t in Titles:
n = 0 if Flatten else t.split(' ')[0].count('#')
Level = '.' * (n-1) + ':'
Title = MkSoup(t.lstrip('#')).get_text()
DashyTitle = DashifyTitle(Title, DashyTitles)
DashyTitles += [DashyTitle]
- List += f'{Level}{html.escape(Title)}\n'
+ List += [{ 'text': f'{Level}{html.escape(Title)}\n' }]
return GenHTMLTreeList(List)
# Clean up a generic HTML tree such that it's compliant with the HTML Journal standard
diff --git a/App/Source/Modules/Meta.py b/App/Source/Modules/Meta.py
index 889a693..4757715 100644
--- a/App/Source/Modules/Meta.py
+++ b/App/Source/Modules/Meta.py
@@ -25,7 +25,7 @@ def GetHTMLPagesList(Flags:dict, Pages:list, PathPrefix:str, CallbackFile=None,
Flatten = True
elif MenuStyle == 'Line':
ShowPaths, SingleLine = False, True
- List, ToPop, LastParent = '', [], []
+ List, ToPop, LastParent = [], [], []
IndexPages = Pages.copy()
for e in IndexPages:
if e[3]['Index'].lower() in PageIndexStrNeg:
@@ -51,6 +51,7 @@ def GetHTMLPagesList(Flags:dict, Pages:list, PathPrefix:str, CallbackFile=None,
if (not Type or (Meta['Type'] == Type and CanIndex(Meta['Index'], For))) and (not Category or Category in Meta['Categories']) and File.startswith(TmpPathFilter) and File != CallbackFile and (not Limit or Limit > DoneCount):
Depth = (File.count('/') + 1) if Meta['Order'] != 'Unite' else 1
+
# Folder names are handled here
if Depth > 1 and Meta['Order'] != 'Unite':
CurParent = File.split('/')[:-1]
@@ -66,12 +67,13 @@ def GetHTMLPagesList(Flags:dict, Pages:list, PathPrefix:str, CallbackFile=None,
else:
Title = CurParent[Depth-2+i]
if SingleLine:
- List += f' {Title} '
+ List += [{ 'text': f' {Title} ' }]
else:
- List += f'{Levels}{Title}\n'
+ List += [{ 'text': f'{Levels}{Title}\n' }]
# Pages with any other path
if not (Depth > 1 and StripExt(File).split('/')[-1] == 'index'):
+ attrs = ('Image' in Meta and Meta['Image'] != '' and f'data-image="{html.escape(Meta["Image"])}"' or '')
Levels = '.' * ((Depth-1) if not Flatten else 0) + ':'
DoneCount += 1
if Meta['Order'] == 'Unite':
@@ -79,14 +81,17 @@ def GetHTMLPagesList(Flags:dict, Pages:list, PathPrefix:str, CallbackFile=None,
else:
Title = MakeListTitle(File, Meta, Titles, 'HTMLTitle', f.BlogName, PathPrefix)
if SingleLine:
- List += ' ' + Title + ' '
+ List += [{ "attrs": attrs, 'text': ' ' + Title + ' ' }]
else:
- List += Levels + Title + '\n'
+ List += [{ "attrs": attrs, 'text': Levels + Title + '\n' }]
if MenuStyle in ('Default', 'Flat'):
return GenHTMLTreeList(List, Class="staticoso-PagesList")
elif MenuStyle in ('Line', 'Excerpt', 'Image', 'Preview', 'Full'):
- return List
+ htmlList = ''
+ for item in List:
+ htmlList += item['text']
+ return htmlList
def CheckHTMLCommentLine(Line:str):
if Line.startswith('