mirror of
https://gitlab.com/octtspacc/staticoso
synced 2025-06-05 22:09:23 +02:00
Fix included Python-Markdown; Fix replacements with escape char
This commit is contained in:
@ -177,10 +177,6 @@ def Main(Args, FeedEntries):
|
||||
FullSite=FeedType,
|
||||
Minify=Minify)
|
||||
|
||||
if SitemapOut:
|
||||
print("[I] Generating Sitemap")
|
||||
MakeSitemap(OutputDir, Pages, SiteDomain)
|
||||
|
||||
if ActivityPub and MastodonURL and MastodonToken and SiteDomain:
|
||||
print("[I] Mastodon Stuff")
|
||||
MastodonPosts = MastodonShare(
|
||||
@ -217,6 +213,10 @@ def Main(Args, FeedEntries):
|
||||
print("[I] Cleaning Temporary Files")
|
||||
DelTmp(OutputDir)
|
||||
|
||||
if SitemapOut:
|
||||
print("[I] Generating Sitemap")
|
||||
MakeSitemap(OutputDir, Pages, SiteDomain)
|
||||
|
||||
print("[I] Copying Assets")
|
||||
os.system(f"cp -R Assets/* {OutputDir}/")
|
||||
|
||||
|
@ -133,21 +133,15 @@ class Markdown:
|
||||
"""
|
||||
Build extension from a string name, then return an instance.
|
||||
|
||||
First attempt to load an entry point. The string name must be registered as an entry point in the
|
||||
`markdown.extensions` group which points to a subclass of the `markdown.extensions.Extension` class.
|
||||
If multiple distributions have registered the same name, the first one found is returned.
|
||||
|
||||
If no entry point is found, assume dot notation (`path.to.module:ClassName`). Load the specified class and
|
||||
return an instance. If no class is specified, import the module and call a `makeExtension` function and return
|
||||
the Extension instance returned by that function.
|
||||
Don't attempt to load any entrypoint,
|
||||
as it conflicts with an already installed Python-Markdown.
|
||||
Assume dot notation (`path.to.module:ClassName`).
|
||||
Load the specified class and return an instance. If no class is specified,
|
||||
import the module and call a `makeExtension` function
|
||||
and return the Extension instance returned by that function.
|
||||
"""
|
||||
configs = dict(configs)
|
||||
|
||||
entry_points = [ep for ep in util.INSTALLED_EXTENSIONS if ep.name == ext_name]
|
||||
if entry_points:
|
||||
ext = entry_points[0].load()
|
||||
return ext(**configs)
|
||||
|
||||
# Get class name (if provided): `path.to.module:ClassName`
|
||||
ext_name, class_name = ext_name.split(':', 1) if ':' in ext_name else (ext_name, '')
|
||||
|
||||
|
@ -7,11 +7,7 @@
|
||||
| Copyright (C) 2022, OctoSpacc |
|
||||
| ================================= """
|
||||
|
||||
# Our local Markdown patches conflict if the module is installed on the system, so first try to import from system
|
||||
try:
|
||||
from markdown import markdown
|
||||
except ModuleNotFoundError:
|
||||
from Libs.markdown import markdown
|
||||
from Libs.markdown import markdown
|
||||
|
||||
MarkdownExtsDefault = ('attr_list', 'def_list', 'footnotes', 'md_in_html', 'tables')
|
||||
|
||||
|
@ -22,10 +22,10 @@ def DashifyTitle(Title, Done=[]):
|
||||
def MakeLinkableTitle(Line, Title, DashTitle, Type):
|
||||
if Type == 'md':
|
||||
Index = Title.split(' ')[0].count('#')
|
||||
return f'<h{Index} id="{DashTitle}" class="SectionTitle"><span class="SectionLink"><a href="#{DashTitle}"><span>>></span></a> </span>{Title[Index+1:]}</h{Index}>'
|
||||
return f'<h{Index} id="{DashTitle}" class="SectionTitle"><span class="SectionLink"><a href="#{DashTitle}"><span>»</span></a> </span>{Title[Index+1:]}</h{Index}>'
|
||||
elif Type == 'pug':
|
||||
Index = Line.find('h')
|
||||
return f"{Line[:Index]}{Line[Index:Index+2]}(id='{DashTitle}' class='SectionTitle') #[span(class='SectionLink') #[a(href='#{DashTitle}') #[span >>]] ]{Line[Index+2:]}"
|
||||
return f"{Line[:Index]}{Line[Index:Index+2]}(id='{DashTitle}' class='SectionTitle') #[span(class='SectionLink') #[a(href='#{DashTitle}') #[span »]] ]{Line[Index+2:]}"
|
||||
|
||||
def GetTitle(FileName, Meta, Titles, Prefer='MetaTitle', BlogName=None):
|
||||
if Prefer == 'BodyTitle':
|
||||
|
@ -95,6 +95,7 @@ def ReplWithEsc(Str, Find, Repl, Esc='\\'):
|
||||
New = New[:-1]
|
||||
New += Repl + e
|
||||
elif Sects[i-1].endswith(Esc):
|
||||
New = New[:-1]
|
||||
New += Find + e
|
||||
else:
|
||||
New += Repl + e
|
||||
|
7
TODO
7
TODO
@ -1,3 +1,6 @@
|
||||
- Specify input folder(s) and files (idea is Makefile compatibility too)
|
||||
- Show page size/words/time in meta line
|
||||
- Add feed support for diary-like pages
|
||||
- Fix excess whitespace in some section/menu titles
|
||||
- Change staticoso service tag enclosure from [] to <>
|
||||
- Investigate a strange bug with Macros
|
||||
@ -7,7 +10,6 @@
|
||||
- Accept Macros as CLI arguments
|
||||
- Deprecate FolderRoots (Macros make it redundant)
|
||||
- Fix ordering menu in Site.ini (not working for inner pages)
|
||||
- Fix Python-Markdown is installed problem (to load our modules)
|
||||
- Feed generation without native libraries
|
||||
- JSON feeds
|
||||
- Full XML sitemap
|
||||
@ -20,4 +22,5 @@
|
||||
- Automatic guessing of .htm/.html extension for declarations of templates and stuff
|
||||
- Exporting sites to different formats (?) (single-page HTML, PDF, EPUB, ...)
|
||||
- Disable only ActivityPub feed for a page
|
||||
- Override ActivityPub URL
|
||||
- Automatic redirects/symlinks for making pages work without .html suffix
|
||||
- Override URL for a page / Add custom redirects for it
|
||||
|
Reference in New Issue
Block a user