mirror of https://gitlab.com/octtspacc/staticoso
Page listing patches
This commit is contained in:
parent
14593545c7
commit
dd7f957460
|
@ -90,27 +90,9 @@ def Main(Args, FeedEntries):
|
|||
GemtextOut = StringBoolChoose(False, Args.GemtextOut, ReadConf(SiteConf, 'Site', 'GemtextOut'))
|
||||
SitemapOut = StringBoolChoose(False, Args.SitemapOut, ReadConf(SiteConf, 'Site', 'SitemapOut'))
|
||||
|
||||
#Minify = False
|
||||
#if Args.Minify != None:
|
||||
# if Args.Minify not in ('False', 'None'):
|
||||
# Minify = True
|
||||
#else:
|
||||
# if ReadConf(SiteConf, 'Site', 'Minify') != None:
|
||||
# if ReadConf(SiteConf, 'Site', 'Minify') not in ('False', 'None'):
|
||||
# Minify = True
|
||||
|
||||
#AutoCategories = False
|
||||
#if Args.AutoCategories != None:
|
||||
# if literal_eval(Args.AutoCategories) == True:
|
||||
# AutoCategories = True
|
||||
#else:
|
||||
# if ReadConf(SiteConf, 'Site', 'AutoCategories') != None:
|
||||
# if EvalOpt(ReadConf(SiteConf, 'Site', 'AutoCategories')) == True:
|
||||
# AutoCategories = True
|
||||
|
||||
Entries = ReadConf(SiteConf, 'Menu')
|
||||
if Entries:
|
||||
ConfMenu = GetConfMenu(Entries, MarkdownExts)
|
||||
MenuEntries = ReadConf(SiteConf, 'Menu')
|
||||
if MenuEntries:
|
||||
ConfMenu = GetConfMenu(MenuEntries, MarkdownExts)
|
||||
else:
|
||||
ConfMenu = []
|
||||
|
||||
|
|
|
@ -43,15 +43,4 @@ def StringBoolChoose(Default, Primary, Secondary):
|
|||
Var = True
|
||||
elif Check in ('False', 'None'):
|
||||
Var = False
|
||||
#if Primary != None:
|
||||
# if Primary in ('True', 'All', '*'):
|
||||
# Var = True
|
||||
# elif Primary in ('False', 'None'):
|
||||
# Var = False
|
||||
#else:
|
||||
# if Secondary != None:
|
||||
# if Secondary in ('True', 'All', '*'):
|
||||
# Var = True
|
||||
# elif Secondary in ('False', 'None'):
|
||||
# Var = False
|
||||
return Var
|
||||
|
|
|
@ -36,7 +36,7 @@ def GetTitle(Meta, Titles, Prefer='MetaTitle', BlogName=None):
|
|||
Title = Meta['Title'] if Meta['Title'] else Titles[0].lstrip('#') if Titles else 'Untitled'
|
||||
elif Prefer == 'HTMLTitle':
|
||||
Title = Meta['HTMLTitle'] if Meta['HTMLTitle'] else Meta['Title'] if Meta['Title'] else Titles[0].lstrip('#') if Titles else 'Untitled'
|
||||
if Meta['Type'] == 'Post' and BlogName:
|
||||
if BlogName and 'Blog' in Meta['Categories']:
|
||||
Title += ' - ' + BlogName
|
||||
return Title
|
||||
|
||||
|
@ -70,7 +70,7 @@ def MakeCategoryLine(File, Meta):
|
|||
Categories += '[{}]({}{}.html) '.format(i, GetPathLevels(File) + 'Categories/', i)
|
||||
return Categories
|
||||
|
||||
def GetHTMLPagesList(Pages, BlogName, SiteRoot, PathPrefix, Unite=[], Type='Page', Category=None, For='Menu', MarkdownExts=()):
|
||||
def GetHTMLPagesList(Pages, BlogName, SiteRoot, PathPrefix, Unite=[], Type='Page', Category=None, For='Menu', MarkdownExts=(), ShowPaths=True, Flatten=False):
|
||||
List, ToPop, LastParent = '', [], []
|
||||
IndexPages = Pages.copy()
|
||||
for e in IndexPages:
|
||||
|
@ -95,14 +95,14 @@ def GetHTMLPagesList(Pages, BlogName, SiteRoot, PathPrefix, Unite=[], Type='Page
|
|||
for i,s in enumerate(CurParent):
|
||||
if LastParent != CurParent:
|
||||
LastParent = CurParent
|
||||
Levels = '- ' * (Depth-1+i)
|
||||
Levels = '- ' * ((Depth-1+i) if not Flatten else 1)
|
||||
if StripExt(File).endswith('index'):
|
||||
Title = MakeListTitle(File, Meta, Titles, 'HTMLTitle', SiteRoot, BlogName, PathPrefix)
|
||||
else:
|
||||
Title = CurParent[Depth-2+i]
|
||||
List += Levels + Title + '\n'
|
||||
if not (Depth > 1 and StripExt(File).endswith('index')):
|
||||
Levels = '- ' * Depth
|
||||
if not (Depth > 1 and StripExt(File).split('/')[-1] == 'index'):
|
||||
Levels = '- ' * (Depth if not Flatten else 1)
|
||||
if Meta['Order'] == 'Unite':
|
||||
Title = File
|
||||
else:
|
||||
|
@ -195,12 +195,12 @@ def MakeListTitle(File, Meta, Titles, Prefer, SiteRoot, BlogName, PathPrefix='')
|
|||
Title = '[{}] {}'.format(CreatedOn, Title)
|
||||
return Title
|
||||
|
||||
def FormatTitles(Titles):
|
||||
def FormatTitles(Titles, Flatten=False):
|
||||
# TODO: Somehow titles written in Pug can end up here and don't work, they should be handled
|
||||
MDTitles, DashyTitles = '', []
|
||||
for t in Titles:
|
||||
n = t.split(' ')[0].count('#')
|
||||
Heading = '- ' * n
|
||||
Heading = '- ' * (n if not Flatten else 1)
|
||||
Title = t.lstrip('#')
|
||||
DashyTitle = DashifyTitle(Title, DashyTitles)
|
||||
DashyTitles += [DashyTitle]
|
||||
|
@ -354,7 +354,8 @@ def MakeSite(TemplatesText, PartsText, ContextParts, ContextPartsText, ConfMenu,
|
|||
Type=Type,
|
||||
Category=Cat,
|
||||
For='Categories',
|
||||
MarkdownExts=MarkdownExts)
|
||||
MarkdownExts=MarkdownExts,
|
||||
Flatten=True)
|
||||
|
||||
if AutoCategories:
|
||||
Dir = 'public/Categories'
|
||||
|
|
Loading…
Reference in New Issue