- Python 92%
- CSS 4.9%
- Smarty 2.5%
- Makefile 0.6%
|
|
||
|---|---|---|
| src/likhoblog | ||
| .gitignore | ||
| LICENSE | ||
| README.md | ||
| requirements.txt | ||
| setup.py | ||
likhoblog
Simple and stylish text-to-html microblog generator. (Formerly microblog.py)
Development
Set up for development by
git clone https://git.32bit.cafe/likho2/likhoblog
cd likhoblog
pip install -e .
Requirements
toml tomlkit python_dateutil pycurl feedgenerator
Some Gnu core utilities are expected to be present but can be substituted for other means.
make(optional), to invoke the script using Makefilesdate(optional), to generate timestamps when writing posts
Everything past this point is for users.
Usage
Go to the directory where you'll author your microblog.
Install the package with pip.
If your python packages are externally managed, set up a virtual environment; otherwise, skip and run pip install directly.
python -m venv ./venv
source ./venv/bin/activate
pip install likhoblog-1.0.0-py3-none-any.whl
(The virtual environment can be exited with deactivate.)
Initialize.
likhoblog-init
The following files are created: default.tpl, timeline.css, content.txt, Makefile.
Generate a microblog.
likhoblog default.tpl content.txt > index.html
Above does the same thing as make (default) if you have Gnu Make.
If you are hosting your microblog on NeoCities, upload your files. Otherwise, updated files are listed in updatedfiles.txt upon generation.
likhoblog-upload your_username
Writing Content
See src/likhoblog/defaults/content.txt.
The content file is a plain text file of posts. Each post has two types of information: timestamp and message. For example:
Thu Mar 17 11:11:11 PM EDT 2022
Today I ate ice cream.
It was strawberry flavored.
#TouchingGrass
Thu Mar 16 2:22:22 PM EDT 2022
I took these pictures.
/images/1.jpg /images/2.jpg /images/3.jpg
- the first line of the file must be empty (newline character only).
- the two last lines of the file must be empty
- html can be placed in the message for embedded videos and rich text
Configuration
Settings are read from settings.toml. See src/likhoblog/defaults/settings.toml.
Configuration options as understood by the script may change in the future.
A key may be missing from your settings file (KeyError)
I'm getting KeyError when I run the program
This script is throwing KeyError after I ran git pull
In most cases, this means I added new configuration options.
The following command can check for missing keys and update if needed.
likhoblog-check
Missing keys if any are initialized to default values from src/likhoblog/defaults/settings.toml.
Anything else
This is a script I wrote for personal use. The output can be seen on https://likho.neocities.org/microblog. I figure someone else may want to use it for their own personal websites, so it is published.
It works for me and my workflow; therefore, it is simple and involves little lines of code. But I am still open to comments, questions, or suggestions.