Change generation of clickable title links

This commit is contained in:
octospacc 2022-08-28 17:12:52 +02:00
parent 2fb21febe1
commit e44924eda6
2 changed files with 7 additions and 5 deletions

View File

@ -22,10 +22,11 @@ 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"><a href="#{DashTitle}">{Title[Index+1:]}</a></h{Index}>'
return f'<h{Index} class="SectionHeading"><span class="SectionLink"><a href="#{DashTitle}"><span>»</span></a> </span><span class="SectionTitle" id="{DashTitle}">{Title[Index+1:]}</span></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]}.SectionHeading #[span.SectionLink #[a(href='#{DashTitle}') #[span »]] ]#[span#{DashTitle}.SectionTitle {Line[Index+2:]}]"
def GetTitle(FileName, Meta, Titles, Prefer='MetaTitle', BlogName=None):
if Prefer == 'BodyTitle':

7
TODO
View File

@ -1,6 +1,7 @@
- Check if external tools are installed
- Specify input folder(s) and files (idea is Makefile compatibility too)
- Customize meta line source
- Check if external tools (pug-cli, html2gmi) are installed
- Fix and optimize differential building
- Specify input folder(s)
- Customize HTML source code for Meta lines / page lists
- Show page size/words/time in meta line
- Add feed support for diary-like pages
- Fix excess whitespace in some section/menu titles