Small improvements

This commit is contained in:
octospacc 2022-08-14 18:26:18 +02:00
parent be37e2d845
commit 6aa5fe8eb1
4 changed files with 25 additions and 14 deletions

View File

@ -1,19 +1,21 @@
# staticoso # staticoso
**staticoso** (_from Italian statico [static] + coso [thingy]_) is an unpretentious static site generator. **staticoso** (_from Italian statico [static] + coso [thingy]_) is an unpretentious **static site generator**.
I'm making this because I need a simple and kind-of-minimal program to serve me as a static site generator with (limited) CMS features. Just the features I need. I'm making this because I need a simple and kind-of-minimal program to serve me as a static site generator with (limited) CMS features. Just the features I need.
This won't replace any of the big projects out there that do the same thing but, as all of my projects, I'm releasing it as free libre software, in the hope that someone would find it useful. This won't replace any of the big projects out there that do the same thing but, as all of my projects, I'm releasing it as free libre software, in the hope that someone would find it useful.
Also, this software is needed for someone to edit and compile my personal sub-website [sitoctt](https://gitlab.com/octtspacc/sitoctt) from its source. Being that site too released under a libre license that allows modifications, I have to also release the tools I use to build it. Also, this software is needed for someone to edit and compile my personal sub-website [sitoctt](https://gitlab.com/octtspacc/sitoctt) from its source. Being that site too released under a libre license that allows modifications, I have to also release the tools I use to build it.
Everything is still an heavy WIP, and features might break across commits, but feel free to experiment with all of this stuff! **Everything is still an heavy WIP**, and features might break across commits, but feel free to experiment with all of this stuff!
## Documentation ## Documentation
Documentation, can be found at [staticoso-docs.gitlab.io](https://staticoso-docs.gitlab.io). Documentation can be found at [octtspacc.gitlab.io/staticoso-docs](https://octtspacc.gitlab.io/staticoso-docs).
Obviously, it's built with staticoso itself 😁️. Its source repo can be found at [gitlab.com/octtspacc/staticoso-docs](https://gitlab.com/octtspacc/staticoso-docs). Obviously, it's built with staticoso itself 😁️. Its source repo can be found at [gitlab.com/octtspacc/staticoso-docs](https://gitlab.com/octtspacc/staticoso-docs).
Keep in mind that, currently, it's still very incomplete. **Any help**, from writing the documentation to creating a decent HTML+CSS template for its site, **is more than welcome**.
## Dependencies ## Dependencies
- [Python == 3.10.4](https://python.org) - [Python == 3.10.4](https://python.org)
- (Included) [Python Markdown == 3.3.7](https://pypi.org/project/Markdown) - (Included) [Python Markdown == 3.3.7](https://pypi.org/project/Markdown)
@ -21,12 +23,24 @@ Obviously, it's built with staticoso itself 😁️. Its source repo can be foun
- (Included) [Beautiful Soup == 4.11.1](https://pypi.org/project/beautifulsoup4) - (Included) [Beautiful Soup == 4.11.1](https://pypi.org/project/beautifulsoup4)
- (Included) [feedgen == 0.9.0](https://pypi.org/project/feedgen) - (Included) [feedgen == 0.9.0](https://pypi.org/project/feedgen)
- (Included) [htmlmin == 0.1.12](https://pypi.org/project/htmlmin) - (Included) [htmlmin == 0.1.12](https://pypi.org/project/htmlmin)
### Optional dependencies
Needed for Pug input support:
- [node == 12.22.5](https://nodejs.org) - [npm == 7.5.2](https://www.npmjs.com) - [node == 12.22.5](https://nodejs.org) - [npm == 7.5.2](https://www.npmjs.com)
- (Included) [pug-cli == 1.0.0-alpha6](https://npmjs.com/package/pug-cli) - (Included) [pug-cli == 1.0.0-alpha6](https://npmjs.com/package/pug-cli)
Needed for Gemtext output support:
- [Go](https://go.dev) - [Go](https://go.dev)
- [html2gmi](https://github.com/LukeEmmet/html2gmi) - [html2gmi](https://github.com/LukeEmmet/html2gmi)
## Features roadmap ## Features roadmap
- [x] File name used as a title for pages without one
- [ ] Custom category names in header links
- [ ] Choosing custom name for Blog and Uncategorized categories
- [ ] Choosing to use a template for all pages in a folder
- [ ] Configuration with both INI files and CLI arguments - [ ] Configuration with both INI files and CLI arguments
- [ ] Category-based feeds - [ ] Category-based feeds
- [ ] Support for multi-language sites - [ ] Support for multi-language sites
@ -39,7 +53,7 @@ Obviously, it's built with staticoso itself 😁️. Its source repo can be foun
- [x] HTML minification - [x] HTML minification
- [x] Full Open Graph support - [x] Full Open Graph support
- [x] Custom categories for posts - [x] Custom categories for posts
- [x] Custom static page parts programmable by context - [x] Custom static and dynamic page parts
- [x] Showing creation and modified date for posts - [x] Showing creation and modified date for posts
- [x] Generation of category pages (ex. page with list of blog posts) - [x] Generation of category pages (ex. page with list of blog posts)
- [x] Custom and automatic page sorting - [x] Custom and automatic page sorting
@ -49,9 +63,8 @@ Obviously, it's built with staticoso itself 😁️. Its source repo can be foun
- [ ] Hot-recompile (for website development) - [ ] Hot-recompile (for website development)
- [x] TXT sitemap generation - [x] TXT sitemap generation
- [x] Atom + RSS feed generation - [x] Atom + RSS feed generation
- [x] Generation of website page tree in left sidebar - [x] Generation of global website menu as a tree or as a line
- [x] Generation of titles in right sidebar with clickable links - [x] Generation of page (titles) menu as a tree
- [x] Detections of titles in a page - [x] Auto-detection of titles in a page
- [x] Custom static page parts by template
- [x] _HTML_, TXT, _Extended Markdown_, and _Pug_ supported for input page files - [x] _HTML_, TXT, _Extended Markdown_, and _Pug_ supported for input page files
- [x] Ready for use - [ ] Out of heavy-WIP state

View File

@ -63,7 +63,7 @@ def GetConfMenu(Entries, MarkdownExts):
for i in Entries: for i in Entries:
e = Entries[i] e = Entries[i]
if not ((e.startswith('<') or e.startswith('[') or e.startswith('- ')) and (e.endswith('>') or e.endswith(')') or e.endswith('}'))): if not ((e.startswith('<') or e.startswith('[') or e.startswith('- ')) and (e.endswith('>') or e.endswith(')') or e.endswith('}'))):
if not (e.lower().endswith('.html') or e.lower().endswith('.htm')): if not e.lower().endswith(FileExtensions['HTML']):
e += '.html' e += '.html'
Menu[int(i)] = e Menu[int(i)] = e
return Menu return Menu

View File

@ -443,13 +443,13 @@ def MakeSite(TemplatesText, StaticPartsText, DynamicParts, DynamicPartsText, Con
print("[I] Writing Pages") print("[I] Writing Pages")
for File, Content, Titles, Meta in Pages: for File, Content, Titles, Meta in Pages:
PagePath = 'public/{}.html'.format(StripExt(File)) PagePath = 'public/{}.html'.format(StripExt(File))
if File.lower().endswith(('.markdown', '.md')): if File.lower().endswith(FileExtensions['Markdown']):
Content = markdown(PagePostprocessor('md', Content, Meta), extensions=MarkdownExts) Content = markdown(PagePostprocessor('md', Content, Meta), extensions=MarkdownExts)
elif File.lower().endswith(('.pug')): elif File.lower().endswith(('.pug')):
Content = PagePostprocessor('pug', ReadFile(PagePath), Meta) Content = PagePostprocessor('pug', ReadFile(PagePath), Meta)
elif File.lower().endswith(('.txt')): elif File.lower().endswith(('.txt')):
Content = '<pre>' + Content + '</pre>' Content = '<pre>' + Content + '</pre>'
elif File.lower().endswith(('.htm', '.html')): elif File.lower().endswith(FileExtensions['HTML']):
Content = ReadFile(PagePath) Content = ReadFile(PagePath)
TemplateMeta = TemplatePreprocessor(TemplatesText[Meta['Template']]) TemplateMeta = TemplatePreprocessor(TemplatesText[Meta['Template']])

2
TODO
View File

@ -1,6 +1,5 @@
- Handle file extensions with any case sensitivity, not just lowercase; currently the bulk of the issue is finding the files on disk - Handle file extensions with any case sensitivity, not just lowercase; currently the bulk of the issue is finding the files on disk
- Test sorting by date for files not starting with date, and dated folders - Test sorting by date for files not starting with date, and dated folders
- Custom category names showing in header links
- Fix arguments - some are only callable from CLI and not Site.ini - Fix arguments - some are only callable from CLI and not Site.ini
- Fix ordering menu in Site.ini (not working for inner pages) - Fix ordering menu in Site.ini (not working for inner pages)
- Fix Python-Markdown is installed problem (to load our modules) - Fix Python-Markdown is installed problem (to load our modules)
@ -13,7 +12,6 @@
- Fix feed titles and page title ids - Fix feed titles and page title ids
- Hybrid global+page menu (like on documentation generators) - Hybrid global+page menu (like on documentation generators)
- Highlight of currently selected menu item - Highlight of currently selected menu item
- Choosing templates for all pages in a folder
- Exporting the entire site text as JSON for full-text search tools - Exporting the entire site text as JSON for full-text search tools
- Automatic guessing of .htm/.html extension for declarations of templates and stuff - Automatic guessing of .htm/.html extension for declarations of templates and stuff
- Exporting sites to different formats (?) (single-page HTML, PDF, EPUB, ...) - Exporting sites to different formats (?) (single-page HTML, PDF, EPUB, ...)