mirror of
https://gitlab.com/octtspacc/staticoso
synced 2025-06-05 22:09:23 +02:00
Menu list base generation changes, minor changes
This commit is contained in:
@ -101,6 +101,21 @@ def GetModifiedFiles(OutDir):
|
|||||||
Mod += [File['Tmp']]
|
Mod += [File['Tmp']]
|
||||||
return Mod
|
return Mod
|
||||||
|
|
||||||
|
def WriteRedirects(Flags, Pages, FinalPaths, Locale):
|
||||||
|
OutDir, SiteName, SiteDomain = Flags['OutDir'], Flags['SiteName'], Flags['SiteDomain']
|
||||||
|
for File, Content, Titles, Meta, ContentHTML, SlimHTML, Description, Image in Pages:
|
||||||
|
for URL in Meta['URLs']:
|
||||||
|
DestFile = f"{OutDir}/{URL}"
|
||||||
|
if DestFile not in FinalPaths:
|
||||||
|
DestURL = f"{GetPathLevels(URL)}{StripExt(File)}.html"
|
||||||
|
mkdirps(os.path.dirname(DestFile))
|
||||||
|
WriteFile(DestFile, RedirectPageTemplate.format(
|
||||||
|
SiteDomain=SiteDomain,
|
||||||
|
DestURL=DestURL,
|
||||||
|
TitlePrefix=f"{SiteName} - " if SiteName else '',
|
||||||
|
StrClick=Locale['ClickHere'],
|
||||||
|
StrRedirect=Locale['IfNotRedirected']))
|
||||||
|
|
||||||
def Main(Args, FeedEntries):
|
def Main(Args, FeedEntries):
|
||||||
Flags, Snippets, FinalPaths = {}, {}, []
|
Flags, Snippets, FinalPaths = {}, {}, []
|
||||||
HavePages, HavePosts = False, False
|
HavePages, HavePosts = False, False
|
||||||
@ -238,21 +253,8 @@ def Main(Args, FeedEntries):
|
|||||||
WriteFile(File, Content)
|
WriteFile(File, Content)
|
||||||
FinalPaths += [File]
|
FinalPaths += [File]
|
||||||
|
|
||||||
logging.info("Creating Redirects")
|
logging.debug("Creating Redirects")
|
||||||
for File, Content, Titles, Meta, ContentHTML, SlimHTML, Description, Image in Pages:
|
WriteRedirects(Flags, Pages, FinalPaths, Locale)
|
||||||
for URL in Meta['URLs']:
|
|
||||||
DestFile = f"{OutDir}/{URL}"
|
|
||||||
if DestFile not in FinalPaths:
|
|
||||||
DestURL = f"{GetPathLevels(URL)}{StripExt(File)}.html"
|
|
||||||
mkdirps(os.path.dirname(DestFile))
|
|
||||||
WriteFile(
|
|
||||||
DestFile,
|
|
||||||
RedirectPageTemplate.format(
|
|
||||||
SiteDomain=SiteDomain,
|
|
||||||
DestURL=DestURL,
|
|
||||||
TitlePrefix=f"{SiteName} - " if SiteName else '',
|
|
||||||
StrClick=Locale['ClickHere'],
|
|
||||||
StrRedirect=Locale['IfNotRedirected']))
|
|
||||||
|
|
||||||
if Flags['GemtextOutput']:
|
if Flags['GemtextOutput']:
|
||||||
logging.info("Generating Gemtext")
|
logging.info("Generating Gemtext")
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
from Modules.HTML import *
|
from Modules.HTML import *
|
||||||
from Modules.Utils import *
|
from Modules.Utils import *
|
||||||
|
|
||||||
HTMLSectionTitleLine = '<h{Index} class="SectionHeading"><span class="SectionLink"><a href="#{DashTitle}"><span>»</span></a> </span><span class="SectionTitle" id="{DashTitle}">{Title}</span></h{Index}>'
|
HTMLSectionTitleLine = '<h{Index} class="SectionHeading staticoso-SectionHeading"><span class="SectionLink staticoso-SectionLink"><a href="#{DashTitle}"><span>»</span></a> </span><span class="SectionTitle staticoso-SectionTitle" id="{DashTitle}">{Title}</span></h{Index}>'
|
||||||
#PugSectionTitleLine = "{Line[:Index]}{Line[Index:Index+2]}.SectionHeading #[span.SectionLink #[a(href='#{DashTitle}') #[span »]] ]#[span#{DashTitle}.SectionTitle {Line[Index+2:]}]"
|
PugSectionTitleLine = "{Start}{Heading}.SectionHeading.staticoso-SectionHeading #[span.SectionLink.staticoso-SectionLink #[a(href='#{DashTitle}') #[span »]] ]#[span#{DashTitle}.SectionTitle.staticoso-SectionTitle {Rest}]"
|
||||||
CategoryPageTemplate = """\
|
CategoryPageTemplate = """\
|
||||||
// Title: {Name}
|
// Title: {Name}
|
||||||
// Type: Page
|
// Type: Page
|
||||||
@ -48,7 +48,11 @@ def MakeLinkableTitle(Line, Title, DashTitle, Type):
|
|||||||
Title=Title[Index+1:])
|
Title=Title[Index+1:])
|
||||||
elif Type == 'pug':
|
elif Type == 'pug':
|
||||||
Index = Line.find('h')
|
Index = Line.find('h')
|
||||||
return f"{Line[:Index]}{Line[Index:Index+2]}.SectionHeading #[span.SectionLink #[a(href='#{DashTitle}') #[span »]] ]#[span#{DashTitle}.SectionTitle {Line[Index+2:]}]"
|
return PugSectionTitleLine.format(
|
||||||
|
Start=Line[:Index],
|
||||||
|
Heading=Line[Index:Index+2],
|
||||||
|
Rest=Line[Index+2:],
|
||||||
|
DashTitle=DashTitle)
|
||||||
|
|
||||||
def GetTitle(FileName, Meta, Titles, Prefer='MetaTitle', BlogName=None):
|
def GetTitle(FileName, Meta, Titles, Prefer='MetaTitle', BlogName=None):
|
||||||
if Prefer == 'BodyTitle':
|
if Prefer == 'BodyTitle':
|
||||||
@ -86,18 +90,16 @@ def MakeContentHeader(Meta, Locale, Categories=''):
|
|||||||
|
|
||||||
def MakeCategoryLine(File, Meta):
|
def MakeCategoryLine(File, Meta):
|
||||||
Categories = ''
|
Categories = ''
|
||||||
if Meta['Categories']:
|
for Cat in Meta['Categories']:
|
||||||
for Cat in Meta['Categories']:
|
Categories += f' <a href="{GetPathLevels(File)}Categories/{Cat}.html">{html.escape(Cat)}</a> '
|
||||||
Categories += f' <a href="{GetPathLevels(File)}Categories/{Cat}.html">{html.escape(Cat)}</a> '
|
|
||||||
return Categories
|
return Categories
|
||||||
|
|
||||||
def MakeListTitle(File, Meta, Titles, Prefer, SiteRoot, BlogName, PathPrefix=''):
|
def MakeListTitle(File, Meta, Titles, Prefer, SiteRoot, BlogName, PathPrefix=''):
|
||||||
Title = GetTitle(File.split('/')[-1], Meta, Titles, Prefer, BlogName).lstrip().rstrip()
|
Title = GetTitle(File.split('/')[-1], Meta, Titles, Prefer, BlogName).lstrip().rstrip()
|
||||||
Link = False if Meta['Index'] == 'Unlinked' else True
|
Link = False if Meta['Index'] == 'Unlinked' else True
|
||||||
if Link:
|
if Link:
|
||||||
Title = '[{}]({})'.format(
|
Href = f'{PathPrefix}{StripExt(File)}.html'
|
||||||
Title,
|
Title = f'<a href="{Href}">{Title}</a>'
|
||||||
'{}{}.html'.format(PathPrefix, StripExt(File)))
|
|
||||||
if Meta['Type'] == 'Post':
|
if Meta['Type'] == 'Post':
|
||||||
CreatedOn = Meta['CreatedOn'] if Meta['CreatedOn'] else '?'
|
CreatedOn = Meta['CreatedOn'] if Meta['CreatedOn'] else '?'
|
||||||
Title = f"[{CreatedOn}] {Title}"
|
Title = f"[{CreatedOn}] {Title}"
|
||||||
|
@ -18,8 +18,33 @@ from Modules.Markdown import *
|
|||||||
from Modules.Pug import *
|
from Modules.Pug import *
|
||||||
from Modules.Utils import *
|
from Modules.Utils import *
|
||||||
|
|
||||||
|
# Generate HTML tree/nested list from our internal metaformat, such as:
|
||||||
|
# :Item 1 \\ <li>Item 1<ul>
|
||||||
|
# .:Item 2 ============\\ <li>Item 2<ul>
|
||||||
|
# ..:Item 3 ============// <li>Item 3</li></ul></li></ul></li>
|
||||||
|
# :Item 4 // <li>Item 4</li>
|
||||||
|
def GenHTMLTreeList(MetaList:str, Type:str='ul'):
|
||||||
|
HTML = ''
|
||||||
|
Lines = MetaList.splitlines()
|
||||||
|
CurDepth, NextDepth, PrevDepth = 0, 0, 0
|
||||||
|
for i,e in enumerate(Lines):
|
||||||
|
CurDepth = e.find(':')
|
||||||
|
NextDepth = Lines[i+1].find(':') if i+1 < len(Lines) else 0
|
||||||
|
HTML += '\n<li>' + e[CurDepth+1:]
|
||||||
|
if NextDepth == CurDepth:
|
||||||
|
HTML += '</li>'
|
||||||
|
elif NextDepth > CurDepth:
|
||||||
|
HTML += f'\n<{Type}>' * (NextDepth - CurDepth)
|
||||||
|
elif NextDepth < CurDepth:
|
||||||
|
HTML += f'</li>\n</{Type}>' * (CurDepth - NextDepth) + '</li>'
|
||||||
|
PrevDepth = CurDepth
|
||||||
|
return f'<{Type}>{HTML}\n</{Type}>'
|
||||||
|
|
||||||
|
# Menu styles:
|
||||||
|
# - Simple: Default, Flat, Line
|
||||||
|
# - Others: Excerpt, Image, Preview (Excerpt + Image), Full
|
||||||
def GetHTMLPagesList(Pages, BlogName, SiteRoot, PathPrefix, CallbackFile=None, Unite=[], Type=None, Limit=None, PathFilter='', Category=None, For='Menu', MarkdownExts=(), MenuStyle='Default', ShowPaths=True):
|
def GetHTMLPagesList(Pages, BlogName, SiteRoot, PathPrefix, CallbackFile=None, Unite=[], Type=None, Limit=None, PathFilter='', Category=None, For='Menu', MarkdownExts=(), MenuStyle='Default', ShowPaths=True):
|
||||||
Flatten, SingleLine, DoneCount = False, False, 0
|
Flatten, SingleLine, DoneCount, PrevDepth = False, False, 0, 0
|
||||||
if MenuStyle == 'Flat':
|
if MenuStyle == 'Flat':
|
||||||
Flatten = True
|
Flatten = True
|
||||||
elif MenuStyle == 'Line':
|
elif MenuStyle == 'Line':
|
||||||
@ -50,12 +75,13 @@ def GetHTMLPagesList(Pages, BlogName, SiteRoot, PathPrefix, CallbackFile=None, U
|
|||||||
|
|
||||||
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 and (not Limit or Limit > DoneCount):
|
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 and (not Limit or Limit > DoneCount):
|
||||||
Depth = (File.count('/') + 1) if Meta['Order'] != 'Unite' else 1
|
Depth = (File.count('/') + 1) if Meta['Order'] != 'Unite' else 1
|
||||||
if Depth > 1 and Meta['Order'] != 'Unite': # Folder names are handled here
|
# Folder names are handled here
|
||||||
|
if Depth > 1 and Meta['Order'] != 'Unite':
|
||||||
CurParent = File.split('/')[:-1]
|
CurParent = File.split('/')[:-1]
|
||||||
for i,s in enumerate(CurParent):
|
for i,s in enumerate(CurParent):
|
||||||
if LastParent != CurParent and ShowPaths:
|
if LastParent != CurParent and ShowPaths:
|
||||||
LastParent = CurParent
|
LastParent = CurParent
|
||||||
Levels = '- ' * ((Depth-1+i) if not Flatten else 1)
|
Levels = '.' * ((Depth-2+i) if not Flatten else 0) + ':'
|
||||||
# If search node endswith index, it's a page; else, it's a folder
|
# If search node endswith index, it's a page; else, it's a folder
|
||||||
if StripExt(File).endswith('index'):
|
if StripExt(File).endswith('index'):
|
||||||
Title = MakeListTitle(File, Meta, Titles, 'HTMLTitle', SiteRoot, BlogName, PathPrefix)
|
Title = MakeListTitle(File, Meta, Titles, 'HTMLTitle', SiteRoot, BlogName, PathPrefix)
|
||||||
@ -69,10 +95,10 @@ def GetHTMLPagesList(Pages, BlogName, SiteRoot, PathPrefix, CallbackFile=None, U
|
|||||||
|
|
||||||
# Pages with any other path
|
# Pages with any other path
|
||||||
if not (Depth > 1 and StripExt(File).split('/')[-1] == 'index'):
|
if not (Depth > 1 and StripExt(File).split('/')[-1] == 'index'):
|
||||||
Levels = '- ' * (Depth if not Flatten else 1)
|
Levels = '.' * ((Depth-1) if not Flatten else 0) + ':'
|
||||||
DoneCount += 1
|
DoneCount += 1
|
||||||
if Meta['Order'] == 'Unite':
|
if Meta['Order'] == 'Unite':
|
||||||
Title = File
|
Title = markdown(MarkdownHTMLEscape(File, MarkdownExts), extensions=MarkdownExts).removeprefix('<p>').removesuffix('<p>')
|
||||||
else:
|
else:
|
||||||
Title = MakeListTitle(File, Meta, Titles, 'HTMLTitle', SiteRoot, BlogName, PathPrefix)
|
Title = MakeListTitle(File, Meta, Titles, 'HTMLTitle', SiteRoot, BlogName, PathPrefix)
|
||||||
if SingleLine:
|
if SingleLine:
|
||||||
@ -80,7 +106,10 @@ def GetHTMLPagesList(Pages, BlogName, SiteRoot, PathPrefix, CallbackFile=None, U
|
|||||||
else:
|
else:
|
||||||
List += Levels + Title + '\n'
|
List += Levels + Title + '\n'
|
||||||
|
|
||||||
return markdown(MarkdownHTMLEscape(List, MarkdownExts), extensions=MarkdownExts)
|
if MenuStyle in ('Default', 'Flat'):
|
||||||
|
return GenHTMLTreeList(List)
|
||||||
|
elif MenuStyle in ('Line', 'Excerpt', 'Image', 'Preview', 'Full'):
|
||||||
|
return List
|
||||||
|
|
||||||
def CheckHTMLCommentLine(Line):
|
def CheckHTMLCommentLine(Line):
|
||||||
if Line.startswith('<!--'):
|
if Line.startswith('<!--'):
|
||||||
@ -284,6 +313,7 @@ def PatchHTML(File, HTML, StaticPartsText, DynamicParts, DynamicPartsText, HTMLP
|
|||||||
Image = GetImage(Meta, BodyImage, 'MetaImage')
|
Image = GetImage(Meta, BodyImage, 'MetaImage')
|
||||||
ContentHeader = MakeContentHeader(Meta, Locale, MakeCategoryLine(File, Meta))
|
ContentHeader = MakeContentHeader(Meta, Locale, MakeCategoryLine(File, Meta))
|
||||||
TimeNow = datetime.now().strftime('%Y-%m-%d %H:%M')
|
TimeNow = datetime.now().strftime('%Y-%m-%d %H:%M')
|
||||||
|
RelativeRoot = GetPathLevels(PagePath)
|
||||||
|
|
||||||
if 'staticoso:DynamicPart:' in HTML: # Reduce risk of unnecessary cycles
|
if 'staticoso:DynamicPart:' in HTML: # Reduce risk of unnecessary cycles
|
||||||
for Line in HTML.splitlines():
|
for Line in HTML.splitlines():
|
||||||
@ -311,76 +341,80 @@ def PatchHTML(File, HTML, StaticPartsText, DynamicParts, DynamicPartsText, HTMLP
|
|||||||
if LightRun:
|
if LightRun:
|
||||||
HTML = None
|
HTML = None
|
||||||
else:
|
else:
|
||||||
HTML = DictReplWithEsc(
|
HTML = DictReplWithEsc(HTML, {
|
||||||
HTML, {
|
'[staticoso:Site:Menu]': HTMLPagesList,
|
||||||
'[staticoso:Site:Menu]': HTMLPagesList,
|
'<staticoso:SiteMenu>': HTMLPagesList,
|
||||||
'<staticoso:SiteMenu>': HTMLPagesList,
|
'[staticoso:Page:Lang]': SiteLang,
|
||||||
'[staticoso:Page:Lang]': SiteLang,
|
'<staticoso:PageLang>': SiteLang,
|
||||||
'<staticoso:PageLang>': SiteLang,
|
'[staticoso:Page:Chapters]': HTMLTitles,
|
||||||
'[staticoso:Page:Chapters]': HTMLTitles,
|
'<staticoso:PageSections>': HTMLTitles,
|
||||||
'<staticoso:PageSections>': HTMLTitles,
|
|
||||||
'[staticoso:Page:Title]': Title,
|
|
||||||
'<staticoso:PageTitle>': Title,
|
|
||||||
'[staticoso:Page:Description]': Description,
|
|
||||||
'<staticoso:PageDescription>': Description,
|
|
||||||
'[staticoso:Page:Image]': Image,
|
|
||||||
'<staticoso:PageImage>': Image,
|
|
||||||
'[staticoso:Page:Path]': PagePath,
|
|
||||||
'<staticoso:PagePath>': PagePath,
|
|
||||||
'[staticoso:Page:Style]': Meta['Style'],
|
|
||||||
'<staticoso:PageStyle>': Meta['Style'],
|
|
||||||
# NOTE: Content is injected in page only at this point! Keep in mind for other substitutions
|
|
||||||
'[staticoso:Page:Content]': Content,
|
|
||||||
'<staticoso:PageContent>': Content,
|
|
||||||
'[staticoso:Page:ContentInfo]': ContentHeader,
|
|
||||||
'<staticoso:PageContentInfo>': ContentHeader,
|
|
||||||
'[staticoso:BuildTime]': TimeNow,
|
|
||||||
'<staticoso:BuildTime>': TimeNow,
|
|
||||||
'<staticoso:SiteDomain>': SiteDomain,
|
|
||||||
'[staticoso:Site:Name]': SiteName,
|
|
||||||
'<staticoso:SiteName>': SiteName,
|
|
||||||
'[staticoso:Site:AbsoluteRoot]': SiteRoot,
|
|
||||||
'<staticoso:SiteAbsoluteRoot>': SiteRoot,
|
|
||||||
'[staticoso:Site:RelativeRoot]': GetPathLevels(PagePath),
|
|
||||||
'<staticoso:SiteRelativeRoot>': GetPathLevels(PagePath)
|
|
||||||
})
|
|
||||||
for e in Meta['Macros']:
|
|
||||||
HTML = ReplWithEsc(HTML, f"[:{e}:]", Meta['Macros'][e])
|
|
||||||
for e in FolderRoots:
|
|
||||||
HTML = ReplWithEsc(HTML, f"<staticoso:CustomPath:{e}>", FolderRoots[e])
|
|
||||||
HTML = ReplWithEsc(HTML, f"[staticoso:Folder:{e}:AbsoluteRoot]", FolderRoots[e])
|
|
||||||
HTML = ReplWithEsc(HTML, f"<staticoso:Folder:{e}:AbsoluteRoot>", FolderRoots[e])
|
|
||||||
for e in Categories:
|
|
||||||
HTML = ReplWithEsc(HTML, f"<span>[staticoso:Category:{e}]</span>", Categories[e])
|
|
||||||
HTML = ReplWithEsc(HTML, f"[staticoso:Category:{e}]", Categories[e])
|
|
||||||
HTML = ReplWithEsc(HTML, f"<staticoso:Category:{e}>", Categories[e])
|
|
||||||
|
|
||||||
# TODO: Clean this doubling?
|
|
||||||
ContentHTML = Content
|
|
||||||
ContentHTML = DictReplWithEsc(
|
|
||||||
ContentHTML, {
|
|
||||||
'[staticoso:Page:Title]': Title,
|
'[staticoso:Page:Title]': Title,
|
||||||
'<staticoso:PageTitle>': Title,
|
'<staticoso:PageTitle>': Title,
|
||||||
'[staticoso:Page:Description]': Description,
|
'[staticoso:Page:Description]': Description,
|
||||||
'<staticoso:PageDescription>': Description,
|
'<staticoso:PageDescription>': Description,
|
||||||
|
'[staticoso:Page:Image]': Image,
|
||||||
|
'<staticoso:PageImage>': Image,
|
||||||
|
'[staticoso:Page:Path]': PagePath,
|
||||||
|
'<staticoso:PagePath>': PagePath,
|
||||||
|
'[staticoso:Page:Style]': Meta['Style'],
|
||||||
|
'<staticoso:PageStyle>': Meta['Style'],
|
||||||
|
# NOTE: Content is injected in page only at this point! Keep in mind for other substitutions
|
||||||
|
'[staticoso:Page:Content]': Content,
|
||||||
|
'<staticoso:PageContent>': Content,
|
||||||
|
'[staticoso:Page:ContentInfo]': ContentHeader,
|
||||||
|
'<staticoso:PageContentInfo>': ContentHeader,
|
||||||
|
'[staticoso:BuildTime]': TimeNow,
|
||||||
|
'<staticoso:BuildTime>': TimeNow,
|
||||||
'<staticoso:SiteDomain>': SiteDomain,
|
'<staticoso:SiteDomain>': SiteDomain,
|
||||||
'[staticoso:Site:Name]': SiteName,
|
'[staticoso:Site:Name]': SiteName,
|
||||||
'<staticoso:SiteName>': SiteName,
|
'<staticoso:SiteName>': SiteName,
|
||||||
'[staticoso:Site:AbsoluteRoot]': SiteRoot,
|
'[staticoso:Site:AbsoluteRoot]': SiteRoot,
|
||||||
'<staticoso:SiteAbsoluteRoot>': SiteRoot,
|
'<staticoso:SiteAbsoluteRoot>': SiteRoot,
|
||||||
'[staticoso:Site:RelativeRoot]': GetPathLevels(PagePath),
|
'[staticoso:Site:RelativeRoot]': RelativeRoot,
|
||||||
'<staticoso:SiteRelativeRoot>': GetPathLevels(PagePath)
|
'<staticoso:SiteRelativeRoot>': RelativeRoot})
|
||||||
})
|
for e in Meta['Macros']:
|
||||||
|
HTML = ReplWithEsc(HTML, f"[:{e}:]", Meta['Macros'][e])
|
||||||
|
for e in FolderRoots:
|
||||||
|
HTML = DictReplWithEsc(HTML, {
|
||||||
|
f"[staticoso:CustomPath:{e}]": FolderRoots[e],
|
||||||
|
f"<staticoso:CustomPath:{e}>": FolderRoots[e],
|
||||||
|
f"[staticoso:Folder:{e}:AbsoluteRoot]": FolderRoots[e],
|
||||||
|
f"<staticoso:Folder:{e}:AbsoluteRoot>": FolderRoots[e]})
|
||||||
|
for e in Categories:
|
||||||
|
HTML = DictReplWithEsc(HTML, {
|
||||||
|
f"<span>[staticoso:Category:{e}]</span>": Categories[e],
|
||||||
|
f"[staticoso:Category:{e}]": Categories[e],
|
||||||
|
f"<staticoso:Category:{e}>": Categories[e],
|
||||||
|
f"<staticoso:CategoryList:{e}>": Categories[e]})
|
||||||
|
|
||||||
|
# TODO: Clean this doubling?
|
||||||
|
ContentHTML = Content
|
||||||
|
ContentHTML = DictReplWithEsc(ContentHTML, {
|
||||||
|
'[staticoso:Page:Title]': Title,
|
||||||
|
'<staticoso:PageTitle>': Title,
|
||||||
|
'[staticoso:Page:Description]': Description,
|
||||||
|
'<staticoso:PageDescription>': Description,
|
||||||
|
'<staticoso:SiteDomain>': SiteDomain,
|
||||||
|
'[staticoso:Site:Name]': SiteName,
|
||||||
|
'<staticoso:SiteName>': SiteName,
|
||||||
|
'[staticoso:Site:AbsoluteRoot]': SiteRoot,
|
||||||
|
'<staticoso:SiteAbsoluteRoot>': SiteRoot,
|
||||||
|
'[staticoso:Site:RelativeRoot]': RelativeRoot,
|
||||||
|
'<staticoso:SiteRelativeRoot>': RelativeRoot})
|
||||||
for e in Meta['Macros']:
|
for e in Meta['Macros']:
|
||||||
ContentHTML = ReplWithEsc(ContentHTML, f"[:{e}:]", Meta['Macros'][e])
|
ContentHTML = ReplWithEsc(ContentHTML, f"[:{e}:]", Meta['Macros'][e])
|
||||||
for e in FolderRoots:
|
for e in FolderRoots:
|
||||||
ContentHTML = ReplWithEsc(ContentHTML, f"<staticoso:CustomPath:{e}>", FolderRoots[e])
|
ContentHTML = DictReplWithEsc(ContentHTML, {
|
||||||
ContentHTML = ReplWithEsc(ContentHTML, f"[staticoso:Folder:{e}:AbsoluteRoot]", FolderRoots[e])
|
f"[staticoso:CustomPath:{e}]": FolderRoots[e],
|
||||||
ContentHTML = ReplWithEsc(ContentHTML, f"<staticoso:Folder:{e}:AbsoluteRoot>", FolderRoots[e])
|
f"<staticoso:CustomPath:{e}>": FolderRoots[e],
|
||||||
|
f"[staticoso:Folder:{e}:AbsoluteRoot]": FolderRoots[e],
|
||||||
|
f"<staticoso:Folder:{e}:AbsoluteRoot>": FolderRoots[e]})
|
||||||
for e in Categories:
|
for e in Categories:
|
||||||
ContentHTML = ReplWithEsc(ContentHTML, f"<span>[staticoso:Category:{e}]</span>", Categories[e])
|
ContentHTML = DictReplWithEsc(ContentHTML, {
|
||||||
ContentHTML = ReplWithEsc(ContentHTML, f"[staticoso:Category:{e}]", Categories[e])
|
f"<span>[staticoso:Category:{e}]</span>": Categories[e],
|
||||||
ContentHTML = ReplWithEsc(ContentHTML, f"<staticoso:Category:{e}>", Categories[e])
|
f"[staticoso:Category:{e}]": Categories[e],
|
||||||
|
f"<staticoso:Category:{e}>": Categories[e],
|
||||||
|
f"<staticoso:CategoryList:{e}>": Categories[e]})
|
||||||
|
|
||||||
return HTML, ContentHTML, Description, Image
|
return HTML, ContentHTML, Description, Image
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user