From 64453af5e770c62561550d1d557890e6f8b9668f Mon Sep 17 00:00:00 2001 From: octospacc Date: Tue, 25 Oct 2022 12:04:17 +0200 Subject: [PATCH] Complete DirectoryList feature --- README.md | 4 +++- Source/Modules/Site.py | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 768438f..1cca060 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,9 @@ Needed for Gemtext output support: ## Features roadmap -- [ ] Page redirects / Alt URLs (+ ActivityPub URL overrides) +- [ ] HTML feeds (pages with list of N most recent posts) +- [x] Lists of all pages in a site directory +- [x] Page redirects / Alt URLs (+ ActivityPub URL overrides) - [x] Progress bars for the build process! - [x] Multithreading - [x] Differential building diff --git a/Source/Modules/Site.py b/Source/Modules/Site.py index ac0760f..3c58de4 100644 --- a/Source/Modules/Site.py +++ b/Source/Modules/Site.py @@ -18,7 +18,7 @@ from Modules.Markdown import * from Modules.Pug import * from Modules.Utils import * -def GetHTMLPagesList(Pages, BlogName, SiteRoot, PathPrefix, Unite=[], Type=None, PathFilter='', Category=None, For='Menu', MarkdownExts=(), MenuStyle='Default'): +def GetHTMLPagesList(Pages, BlogName, SiteRoot, PathPrefix, CallbackFile=None, Unite=[], Type=None, PathFilter='', Category=None, For='Menu', MarkdownExts=(), MenuStyle='Default'): ShowPaths, Flatten, SingleLine = True, False, False if MenuStyle == 'Flat': Flatten = True @@ -41,7 +41,12 @@ def GetHTMLPagesList(Pages, BlogName, SiteRoot, PathPrefix, Unite=[], Type=None, if e: IndexPages.insert(i,[e,None,None,{'Type':Type,'Index':'True','Order':'Unite'}]) for File, Content, Titles, Meta in IndexPages: - if (not Type or (Meta['Type'] == Type and CanIndex(Meta['Index'], For))) and (not Category or Category in Meta['Categories']) and File.startswith(PathFilter): + TmpPathFilter = PathFilter + if TmpPathFilter.startswith('Pages/'): + TmpPathFilter = TmpPathFilter[len('Pages/'):] + if File.startswith('Posts/'): + continue + 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: Depth = (File.count('/') + 1) if Meta['Order'] != 'Unite' else 1 if Depth > 1 and Meta['Order'] != 'Unite': # Folder names are handled here CurParent = File.split('/')[:-1] @@ -429,6 +434,7 @@ def HandlePage(Flags, Page, Pages, Categories, LimitFiles, Snippets, ConfMenu, L if Line.startswith(''): Path = Line[len('