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:
@@ -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
|
||||
|
Reference in New Issue
Block a user