||9 months ago|
|LICENSE||11 months ago|
|README.md||9 months ago|
|shatom||9 months ago|
an Atom feed generator in (mostly) POSIX shell
Because of this post in the Gemini mailing list,
which bemoans the inability to generate Atom feeds using bare-bones computers,
shatom, a shell program that purports to do just that.
It has minimal dependencies (see DEPENDENCIES, below), and is completely modifiable by the user with the config file (see CONFIG, below).
And it's licensed permissively. What more could you want!?
- POSIX shell
- POSIX awk (I'm 99% sure) - optional
- GNU find - optional
- stat - optional
Technically, a shell is the only optional dependency -- if you're removing shell from the dependencies list, you're writing another script.
All of the functions and variables defined in
can be overwritten by a config file, by default
shatom.conf.sh in the current directory.
As may be obvious from the file's extension, it's a shell script,
so you can redefine (and in fact, should redefine)
all the variables and functions in
shatom to suit your needs.
Here's a convenient list:
- FEED_TITLE - the title of your feed
- FEED_AUTHOR - the author of your feed (you!)
- FEED_SUBTITLE - the subtitle of your feed
- FEED_URL - the URL where your feed can be accessed
- SITE_URL - the base URL of your site
- FEED_ID - the Atom ID of the feed (default: SITE_URL)
- FEED_COPYRIGHT - the copyright information of your feed
- FEED_UPDATED - the date your feed was last updated (default: the current time)
- recent_files - sort files recursively, in reverse
These operate on entries themselves, in the inner
for loop of
They're all passed the path of the entry.
See the source for their default implementations.
- skip_entry - whether to skip an entry (default: don't). Return 0 to skip an entry.
- entry_url - pull the URL out of an entry
- entry_title - pull the title from an entry
- entry_summary - pull the summary from an entry
- entry_author - pull the author from an entry
- entry_content - pull the content from an entry
- entry_updated - pull the modification time from an entry
These generate the actual atom bits. Should be pretty self-explanatory.
This script should be 95% POSIX compliant.
The only bits that aren't strictly so are the functions
recent_files, which requires GNU
find for the
entry_updated, which uses
I've included commentary toward POSIX-ifying these if need be,
but since this is a quick-and-dirty proof-of-concept,
I leave actually doing so as an exercise to the reader.
(C) 2020 Case Duckworth. Licensed under the MIT license. See LICENSE for details.
Feel free to send patches, complaints, and praise to my public inbox.