mirror of https://gitlab.com/octtspacc/staticoso
HTML files as page inputs
This commit is contained in:
parent
0c56516f89
commit
70bf67586e
|
@ -42,5 +42,5 @@ Feel free to experiment with all of this stuff!
|
||||||
- [x] Generation of titles in right sidebar with clickable links
|
- [x] Generation of titles in right sidebar with clickable links
|
||||||
- [x] Detections of titles in a page
|
- [x] Detections of titles in a page
|
||||||
- [x] Custom static page parts by template
|
- [x] Custom static page parts by template
|
||||||
- [x] Extended Markdown + Pug support for pages
|
- [x] _HTML_, _Extended Markdown_, and _Pug_ supported for input page files
|
||||||
- [x] Ready for use
|
- [x] Ready for use
|
||||||
|
|
|
@ -20,4 +20,5 @@ def PugCompileList(Pages):
|
||||||
Path = 'public/{}'.format(File)
|
Path = 'public/{}'.format(File)
|
||||||
WriteFile(Path, Content)
|
WriteFile(Path, Content)
|
||||||
Paths += '"{}" '.format(Path)
|
Paths += '"{}" '.format(Path)
|
||||||
os.system('pug -P {} > /dev/null'.format(Paths))
|
if Paths:
|
||||||
|
os.system('pug -P {} > /dev/null'.format(Paths))
|
||||||
|
|
|
@ -117,6 +117,7 @@ def Preprocessor(Path, SiteRoot):
|
||||||
'Style': '',
|
'Style': '',
|
||||||
'Type': '',
|
'Type': '',
|
||||||
'Index': 'True',
|
'Index': 'True',
|
||||||
|
'Feed': 'True',
|
||||||
'Title': '',
|
'Title': '',
|
||||||
'HTMLTitle': '',
|
'HTMLTitle': '',
|
||||||
'Description': '',
|
'Description': '',
|
||||||
|
@ -129,7 +130,7 @@ def Preprocessor(Path, SiteRoot):
|
||||||
ls = l.lstrip()
|
ls = l.lstrip()
|
||||||
if ls.startswith('// '):
|
if ls.startswith('// '):
|
||||||
lss = ls[3:]
|
lss = ls[3:]
|
||||||
for Item in ('Template', 'Type', 'Index', 'Title', 'HTMLTitle', 'Description', 'Image', 'CreatedOn', 'EditedOn'):
|
for Item in ('Template', 'Type', 'Index', 'Feed', 'Title', 'HTMLTitle', 'Description', 'Image', 'CreatedOn', 'EditedOn'):
|
||||||
ItemText = '{}: '.format(Item)
|
ItemText = '{}: '.format(Item)
|
||||||
if lss.startswith(ItemText):
|
if lss.startswith(ItemText):
|
||||||
Meta[Item] = lss[len(ItemText):]
|
Meta[Item] = lss[len(ItemText):]
|
||||||
|
@ -147,7 +148,6 @@ def Preprocessor(Path, SiteRoot):
|
||||||
if Path.endswith('.html') and not HTMLTitlesFound:
|
if Path.endswith('.html') and not HTMLTitlesFound:
|
||||||
Soup = BeautifulSoup(File, 'html.parser')
|
Soup = BeautifulSoup(File, 'html.parser')
|
||||||
Tags = Soup.find_all()
|
Tags = Soup.find_all()
|
||||||
#for t in Soup.find_all(Headings):
|
|
||||||
for t in Tags:
|
for t in Tags:
|
||||||
if t.name in Headings:
|
if t.name in Headings:
|
||||||
Title = '#'*int(t.name[1]) + ' ' + str(t.text)
|
Title = '#'*int(t.name[1]) + ' ' + str(t.text)
|
||||||
|
@ -155,9 +155,7 @@ def Preprocessor(Path, SiteRoot):
|
||||||
DashyTitles += [DashTitle]
|
DashyTitles += [DashTitle]
|
||||||
Titles += [Title]
|
Titles += [Title]
|
||||||
t.replace_with(MakeLinkableTitle(None, Title, DashTitle, 'md'))
|
t.replace_with(MakeLinkableTitle(None, Title, DashTitle, 'md'))
|
||||||
print(Titles)
|
Content = str(Soup.prettify(formatter=None))
|
||||||
Content = str(Soup)
|
|
||||||
print(Content)
|
|
||||||
HTMLTitlesFound = True
|
HTMLTitlesFound = True
|
||||||
elif Path.endswith('.md'):
|
elif Path.endswith('.md'):
|
||||||
if ls.startswith('#'):
|
if ls.startswith('#'):
|
||||||
|
@ -399,7 +397,7 @@ def MakeSite(TemplatesText, PartsText, ContextParts, ContextPartsText, ConfMenu,
|
||||||
PagePath = 'public/{}.html'.format(StripExt(File))
|
PagePath = 'public/{}.html'.format(StripExt(File))
|
||||||
if File.endswith('.md'):
|
if File.endswith('.md'):
|
||||||
Content = markdown(Content, extensions=MarkdownExts)
|
Content = markdown(Content, extensions=MarkdownExts)
|
||||||
elif File.endswith(('.html','.pug')):
|
elif File.endswith(('.pug')):
|
||||||
Content = ReadFile(PagePath)
|
Content = ReadFile(PagePath)
|
||||||
HTML, ContentHTML, SlimHTML, Description, Image = PatchHTML(
|
HTML, ContentHTML, SlimHTML, Description, Image = PatchHTML(
|
||||||
File=File,
|
File=File,
|
||||||
|
|
1
TODO
1
TODO
|
@ -1,3 +1,2 @@
|
||||||
- Fix arguments - some are only callable from CLI and not Site.ini
|
- Fix arguments - some are only callable from CLI and not Site.ini
|
||||||
- Accept HTML files as input pages
|
|
||||||
- Optionally disabling nesting and folder listing for page lists
|
- Optionally disabling nesting and folder listing for page lists
|
||||||
|
|
Loading…
Reference in New Issue