From 1faf0014bed3a70c16e02fd0401229465780e095 Mon Sep 17 00:00:00 2001 From: octospacc Date: Sun, 14 Aug 2022 00:35:45 +0200 Subject: [PATCH] Some fixes --- Source/Build.py | 9 +++++---- Source/Modules/Site.py | 14 ++++++++------ TODO | 2 ++ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Source/Build.py b/Source/Build.py index 482bd4b..9e47654 100755 --- a/Source/Build.py +++ b/Source/Build.py @@ -88,7 +88,8 @@ def Main(Args, FeedEntries): AutoCategories = StringBoolChoose(False, Args.AutoCategories, ReadConf(SiteConf, 'Site', 'AutoCategories')) NoScripts = StringBoolChoose(False, Args.NoScripts, ReadConf(SiteConf, 'Site', 'NoScripts')) GemtextOut = StringBoolChoose(False, Args.GemtextOut, ReadConf(SiteConf, 'Site', 'GemtextOut')) - SitemapOut = StringBoolChoose(False, Args.SitemapOut, ReadConf(SiteConf, 'Site', 'SitemapOut')) + SitemapOut = StringBoolChoose(True, Args.SitemapOut, ReadConf(SiteConf, 'Site', 'SitemapOut')) + FeedEntries = int(FeedEntries) if FeedEntries and FeedEntries != 'Default' else int(ReadConf(SiteConf, 'Site', 'FeedEntries')) if ReadConf(SiteConf, 'Site', 'FeedEntries') else 10 MenuEntries = ReadConf(SiteConf, 'Menu') if MenuEntries: @@ -111,7 +112,7 @@ def Main(Args, FeedEntries): if not HavePages and not HavePosts: print("[E] No Pages or posts found. Nothing to do, exiting!") - exit() + exit(1) print("[I] Generating HTML") Pages = MakeSite( @@ -210,7 +211,7 @@ if __name__ == '__main__': Parser.add_argument('--GemtextHeader', type=str) Parser.add_argument('--SiteTagline', type=str) Parser.add_argument('--SitemapOut', type=str) - Parser.add_argument('--FeedEntries', type=int) + Parser.add_argument('--FeedEntries', type=str) Parser.add_argument('--FolderRoots', type=str) Parser.add_argument('--DynamicParts', type=str) Parser.add_argument('--MarkdownExts', type=str) @@ -225,7 +226,7 @@ if __name__ == '__main__': try: import lxml from Modules.Feed import * - FeedEntries = Args.FeedEntries if Args.FeedEntries or Args.FeedEntries == 0 else 10 + FeedEntries = Args.FeedEntries if Args.FeedEntries else 'Default' except: print("[E] Can't load the XML libraries. XML Feeds Generation is Disabled. Make sure the 'lxml' library is installed.") FeedEntries = 0 diff --git a/Source/Modules/Site.py b/Source/Modules/Site.py index 28a7bf7..e46fe8c 100644 --- a/Source/Modules/Site.py +++ b/Source/Modules/Site.py @@ -369,12 +369,14 @@ def MakeSite(TemplatesText, StaticPartsText, DynamicParts, DynamicPartsText, Con for File in Path('Posts').rglob(f"*.{Ext}"): PostsPaths += [FileToStr(File, 'Posts/')] - PagesPaths = FileNameDateSort(PagesPaths) - if Sorting['Pages'] == 'Inverse': - PagesPaths.reverse() - PostsPaths = FileNameDateSort(PostsPaths) - if Sorting['Posts'] == 'Inverse': - PostsPaths.reverse() + if PagesPaths: + PagesPaths = FileNameDateSort(PagesPaths) + if Sorting['Pages'] == 'Inverse': + PagesPaths.reverse() + if PostsPaths: + PostsPaths = FileNameDateSort(PostsPaths) + if Sorting['Posts'] == 'Inverse': + PostsPaths.reverse() print("[I] Preprocessing Source Pages") for Type in ['Page', 'Post']: diff --git a/TODO b/TODO index 17d2039..0484b6d 100644 --- a/TODO +++ b/TODO @@ -20,3 +20,5 @@ - Category-based feeds - Automatic guessing of .htm/.html extension for declarations of templates and stuff - Handle file extensions without case-sensitivity +- Proper multi-language support +- Exporting sites to different formats (?) (single-page HTML, PDF, EPUB, ...)