mirror of
https://gitlab.com/octtspacc/staticoso
synced 2025-03-12 17:20:22 +01:00
Change handling of page indexing, added Uncategorized autocategory
This commit is contained in:
parent
fb02893d21
commit
5c63a05ed2
@ -111,13 +111,13 @@ def GetHTMLPagesList(Pages, BlogName, SiteRoot, PathPrefix, Unite=[], Type='Page
|
|||||||
List += Levels + Title + '\n'
|
List += Levels + Title + '\n'
|
||||||
return markdown(MarkdownHTMLEscape(List, MarkdownExts), extensions=MarkdownExts)
|
return markdown(MarkdownHTMLEscape(List, MarkdownExts), extensions=MarkdownExts)
|
||||||
|
|
||||||
def Preprocessor(Path, SiteRoot, GlobalMacros):
|
def Preprocessor(Path, Type, SiteRoot, GlobalMacros):
|
||||||
File = ReadFile(Path)
|
File = ReadFile(Path)
|
||||||
Content, Titles, DashyTitles, HTMLTitlesFound, Macros, Meta = '', [], [], False, '', {
|
Content, Titles, DashyTitles, HTMLTitlesFound, Macros, Meta = '', [], [], False, '', {
|
||||||
'Template': 'Standard.html',
|
'Template': 'Standard.html',
|
||||||
'Style': '',
|
'Style': '',
|
||||||
'Type': '',
|
'Type': Type,
|
||||||
'Index': 'True',
|
'Index': 'Unspecified',
|
||||||
'Feed': 'True',
|
'Feed': 'True',
|
||||||
'Title': '',
|
'Title': '',
|
||||||
'HTMLTitle': '',
|
'HTMLTitle': '',
|
||||||
@ -185,6 +185,13 @@ def Preprocessor(Path, SiteRoot, GlobalMacros):
|
|||||||
Content += MakeLinkableTitle(l, Title, DashTitle, 'pug') + '\n'
|
Content += MakeLinkableTitle(l, Title, DashTitle, 'pug') + '\n'
|
||||||
else:
|
else:
|
||||||
Content += l + '\n'
|
Content += l + '\n'
|
||||||
|
if Meta['Index'] in ('Default', 'Unspecified'):
|
||||||
|
if not Meta['Categories']:
|
||||||
|
Meta['Categories'] = ['Uncategorized']
|
||||||
|
if Meta['Type'] == 'Page':
|
||||||
|
Meta['Index'] = 'False'
|
||||||
|
elif Meta['Type'] == 'Post':
|
||||||
|
Meta['Index'] = 'True'
|
||||||
if GlobalMacros:
|
if GlobalMacros:
|
||||||
Meta['Macros'].update(GlobalMacros)
|
Meta['Macros'].update(GlobalMacros)
|
||||||
Meta['Macros'].update(ReadConf(LoadConfStr('[Macros]\n' + Macros), 'Macros'))
|
Meta['Macros'].update(ReadConf(LoadConfStr('[Macros]\n' + Macros), 'Macros'))
|
||||||
@ -353,11 +360,9 @@ def MakeSite(TemplatesText, PartsText, ContextParts, ContextPartsText, ConfMenu,
|
|||||||
elif Type == 'Post':
|
elif Type == 'Post':
|
||||||
Files = PostsPaths
|
Files = PostsPaths
|
||||||
for File in Files:
|
for File in Files:
|
||||||
Content, Titles, Meta = Preprocessor(f"{Type}s/{File}", SiteRoot, GlobalMacros)
|
Content, Titles, Meta = Preprocessor(f"{Type}s/{File}", Type, SiteRoot, GlobalMacros)
|
||||||
if Type != 'Page':
|
if Type != 'Page':
|
||||||
File = f"{Type}s/{File}"
|
File = f"{Type}s/{File}"
|
||||||
if not Meta['Type']:
|
|
||||||
Meta['Type'] = Type
|
|
||||||
Pages += [[File, Content, Titles, Meta]]
|
Pages += [[File, Content, Titles, Meta]]
|
||||||
for Cat in Meta['Categories']:
|
for Cat in Meta['Categories']:
|
||||||
Categories.update({Cat:''})
|
Categories.update({Cat:''})
|
||||||
@ -388,14 +393,15 @@ def MakeSite(TemplatesText, PartsText, ContextParts, ContextPartsText, ConfMenu,
|
|||||||
if not Exists:
|
if not Exists:
|
||||||
File = f"Categories/{Cat}.md"
|
File = f"Categories/{Cat}.md"
|
||||||
FilePath = f"public/{File}"
|
FilePath = f"public/{File}"
|
||||||
WriteFile(FilePath, """\
|
WriteFile(FilePath, f"""\
|
||||||
// Title: {Category}
|
// Title: {Cat}
|
||||||
// Type: Page
|
// Type: Page
|
||||||
|
// Index: True
|
||||||
|
|
||||||
# {Category}
|
# {Cat}
|
||||||
|
|
||||||
<div><span>[HTML:Category:{Category}]</span></div>
|
<div><span>[HTML:Category:{Cat}]</span></div>
|
||||||
""".format(Category=Cat))
|
""")
|
||||||
Content, Titles, Meta = Preprocessor(FilePath, SiteRoot)
|
Content, Titles, Meta = Preprocessor(FilePath, SiteRoot)
|
||||||
Pages += [[File, Content, Titles, Meta]]
|
Pages += [[File, Content, Titles, Meta]]
|
||||||
|
|
||||||
|
5
TODO
5
TODO
@ -1,6 +1,8 @@
|
|||||||
|
- Make alt text for images also be title text
|
||||||
|
- Custom category names showing in header links
|
||||||
- Fix arguments - some are only callable from CLI and not Site.ini
|
- Fix arguments - some are only callable from CLI and not Site.ini
|
||||||
|
- Fix ordering menu in Site.ini (not working for inner pages)
|
||||||
- Fix Python-Markdown is installed problem (to load our modules)
|
- Fix Python-Markdown is installed problem (to load our modules)
|
||||||
- Postprocessing markdown footnotes to add brackets
|
|
||||||
- Hot-recompile
|
- Hot-recompile
|
||||||
- Differential recompile
|
- Differential recompile
|
||||||
- Feed generation without native libraries
|
- Feed generation without native libraries
|
||||||
@ -8,4 +10,3 @@
|
|||||||
- Full XML sitemap
|
- Full XML sitemap
|
||||||
- SCSS support
|
- SCSS support
|
||||||
- Images in post listings
|
- Images in post listings
|
||||||
- "Uncategorized" category for posts without specified ones
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user