mirror of
https://gitlab.com/octtspacc/staticoso
synced 2025-06-05 22:09:23 +02:00
Add stripping scripts
This commit is contained in:
@ -293,7 +293,7 @@ def DoMinifyHTML(HTML):
|
||||
convert_charrefs=True,
|
||||
keep_pre=True)
|
||||
|
||||
def MakeSite(TemplatesText, PartsText, ContextParts, ContextPartsText, ConfMenu, SiteName, BlogName, SiteTagline, SiteDomain, SiteRoot, FolderRoots, SiteLang, Locale, Minify, Sorting, MarkdownExts, AutoCategories):
|
||||
def MakeSite(TemplatesText, PartsText, ContextParts, ContextPartsText, ConfMenu, SiteName, BlogName, SiteTagline, SiteDomain, SiteRoot, FolderRoots, SiteLang, Locale, Minify, NoScripts, Sorting, MarkdownExts, AutoCategories):
|
||||
PagesPaths, PostsPaths, Pages, MadePages, Categories = [], [], [], [], {}
|
||||
for Ext in FileExtensions['Pages']:
|
||||
for File in Path('Pages').rglob('*.{}'.format(Ext)):
|
||||
@ -363,13 +363,10 @@ def MakeSite(TemplatesText, PartsText, ContextParts, ContextPartsText, ConfMenu,
|
||||
Pages += [[File, Content, Titles, Meta]]
|
||||
|
||||
for i,e in enumerate(ConfMenu):
|
||||
#print(e,i)
|
||||
for File, Content, Titles, Meta in Pages:
|
||||
File = StripExt(File)+'.html'
|
||||
if e == File:
|
||||
ConfMenu[i] = None
|
||||
#print(File)
|
||||
#print(ConfMenu)
|
||||
|
||||
print("[I] Writing Pages")
|
||||
for File, Content, Titles, Meta in Pages:
|
||||
@ -405,6 +402,11 @@ def MakeSite(TemplatesText, PartsText, ContextParts, ContextPartsText, ConfMenu,
|
||||
Categories=Categories,
|
||||
SiteLang=SiteLang,
|
||||
Locale=Locale)
|
||||
if NoScripts:
|
||||
HTML = (HTML
|
||||
).replace('<script>', '<!-- script >'
|
||||
).replace('<script ', '<!-- script '
|
||||
).replace('</script>', '</ script -->')
|
||||
if Minify:
|
||||
HTML = DoMinifyHTML(HTML)
|
||||
WriteFile(PagePath, HTML)
|
||||
|
@ -7,7 +7,7 @@
|
||||
| Copyright (C) 2022, OctoSpacc |
|
||||
| ================================= """
|
||||
|
||||
import urllib
|
||||
from urllib.parse import quote as URLEncode
|
||||
from Modules.Utils import *
|
||||
|
||||
def MakeSitemap(Pages, SiteDomain=''):
|
||||
@ -15,5 +15,5 @@ def MakeSitemap(Pages, SiteDomain=''):
|
||||
for File, Content, Titles, Meta, ContentHTML, SlimHTML, Description, Image in Pages:
|
||||
File = '{}.html'.format(StripExt(File))
|
||||
Domain = SiteDomain + '/' if SiteDomain else ' '
|
||||
Map += Domain + urllib.parse.quote(File) + '\n'
|
||||
Map += Domain + URLEncode(File) + '\n'
|
||||
WriteFile('public/sitemap.txt', Map)
|
||||
|
Reference in New Issue
Block a user