mirror of
https://gitlab.com/octtspacc/staticoso
synced 2025-06-05 22:09:23 +02:00
Generate HTML search with template; More Refactoring of the main workflows
This commit is contained in:
@ -8,6 +8,7 @@
|
||||
| ================================== """
|
||||
|
||||
from Modules.Config import *
|
||||
from Modules.Globals import *
|
||||
from Modules.Elements import *
|
||||
from Modules.HTML import *
|
||||
from Modules.Markdown import *
|
||||
@ -124,32 +125,15 @@ def FindPreprocLine(Line:str, Meta, Macros):
|
||||
# IgnoreBlocksStart += [l]
|
||||
return (Meta, Macros, Changed)
|
||||
|
||||
def PagePreprocessor(Flags:dict, Page:list, SiteTemplate, GlobalMacros, LightRun:bool=False):
|
||||
CategoryUncategorized = Flags['CategoriesUncategorized']
|
||||
def PagePreprocessor(Flags:dict, Page:list, GlobalMacros:dict, LightRun:bool=False):
|
||||
f = NameSpace(Flags)
|
||||
Path, TempPath, Type, Content = Page
|
||||
|
||||
File = ReadFile(Path) if not Content else Content
|
||||
Path = Path.lower()
|
||||
Content, Titles, DashyTitles, HTMLTitlesFound, Macros, Meta, MetaDefault = '', [], [], False, '', '', {
|
||||
'Template': SiteTemplate,
|
||||
'Head': '',
|
||||
'Style': '',
|
||||
'Type': Type,
|
||||
'Index': 'Unspecified',
|
||||
'Feed': 'True',
|
||||
'Title': '',
|
||||
'HTMLTitle': '',
|
||||
'Description': '',
|
||||
'Image': '',
|
||||
'Macros': {},
|
||||
'Categories': [],
|
||||
'URLs': [],
|
||||
'CreatedOn': '',
|
||||
'UpdatedOn': '',
|
||||
'EditedOn': '',
|
||||
'Order': None,
|
||||
'Language': None,
|
||||
'Downsync': None}
|
||||
Content, Titles, DashyTitles, HTMLTitlesFound, Macros, Meta = '', [], [], False, '', ''
|
||||
MetaDefault = PageMetaDefault.copy()
|
||||
MetaDefault.update({"Template": f.SiteTemplate, "Type": Type})
|
||||
# Find all positions of '<!--', '-->', add them in a list=[[pos0,pos1,line0,line1],...]
|
||||
for l in File.splitlines():
|
||||
ll = l.lstrip().rstrip()
|
||||
@ -252,7 +236,7 @@ def PagePreprocessor(Flags:dict, Page:list, SiteTemplate, GlobalMacros, LightRun
|
||||
Meta['EditedOn'] = Meta['UpdatedOn']
|
||||
if Meta['Index'].lower() in ('default', 'unspecified', 'categories'):
|
||||
if not Meta['Categories']:
|
||||
Meta['Categories'] = [CategoryUncategorized]
|
||||
Meta['Categories'] = [f.CategoriesUncategorized]
|
||||
if Meta['Type'].lower() == 'page':
|
||||
Meta['Index'] = 'Categories'
|
||||
elif Meta['Type'].lower() == 'post':
|
||||
|
Reference in New Issue
Block a user