Please note: there is now one common configuration file .plog.rc. It is not part of the suite, but a template file progrc.template is included, which should be copied to .plog.rc during setup.
ToDo: There is still missing a nice example of a working setup!
Plog is a suite of some scripts to be run on a UNIX server for handling Markdown formatted blogs, glogs, and email newsletters with Git.
An example of the generated output can be found at my personal blog and glog sites.
This is describing version 2.2 of the suite.
Please note that most browsers are unfortunately incapable of displaying Gopher links!
There is a fine Public Gopher Proxy on Floodgap for those crippled browsers. Therefore, if the direct gopher link above does not work, you may try to access it via proxy.
If you are using Seamonkey or Firefox, you may try the "OverbiteFF" add-on for Gopher functionality. Overbite also is available for Android, via gopherproject.org or Floodgap.
The plog suite mainly consists of the (sh/bash) shell scripts pubnext.sh and allpub.sh, a configuration file, and a suitable directory structure. If you make use of character conversion (UTF8 or the like), also the script convchars.sh will be needed.
It makes use of the standard command line tools like grep and sed available on almost all Unix systems.
In addition, it needs perl (version 5.6) for Markdown-HTML conversion (and of course the corresponding script mrkdwn.pl included in the plog suite), and lynx for HTML-text conversion.
git is used to git mv the processed files to an archive directory; however, in case of failure, the scripts should gracefully switch to a simple mv.
The main scripts pubnext.sh, mrkdwn.pl, allpub.sh, convchars.sh should be installed in the same directory.
There is an additional bonus script poorkyll.sh which uses mrkdwn.pl and convchars.sh to convert all *.md files in the current directory into *.html files. It can be given the name of a CSS style file which then will be referred to as style file. This can be used as a simple static website generator.
The two shell scripts have some variables set at the beginning, which should be configured to your needs.
They can be used for processing several collections of postings through the run-time argument of the working directory (see below). In case you need very different configuration, you can simply copy the scripts and use different instances for different collections.
The scripts share a common configuration file .plog.rc, which has to be in the working directory. It is basically an additional shell script which is executed at the beginning of each of the other scripts, but after setting of the variables. This way, values set in the configuration file will override the defaults hardcoded in scripts.
In the plog suite, there is a plogrc.template file, which can be copied into .plog.rc, and modified according to your needs.
Here is a copy of the current template file, followed by a detailed description of all used variables.
## Please copy as .plog.rc and modify as needed!
htmlfoot="</BODY><!-- generated by $myself --></HTML>"
fprefix is a string with the beginning of filenames to be considered as texts to be processed (e.g 'text', 'post', whatever) — but make sure it does not match other files in the working directory, like the archive directory, address files, or log and temporary files!
.plog.rc is read as a shell script, therefore you have to honour shell script syntax; be especially careful about closing all strings opened with ' and to escape " with \ inside "..." strings!
In any case, you need a directory (the "working directory"), where the source texts (Markdown formatted) are stored. Typically, this would be inside of a directory which is version controlled by Git, but plog should still work without that. In this directory, as well as its subdirectories, and additional directories needed for publication, the plog scripts (either launched manually by you or by some automatic process like a cron job) in principal need complete access permission (read, write, and execute).
As a subdirectory, you should set up the archive directory, and you have to accordingly set the variable arch in pubnext.sh.
In the working directory, you have to set up the configuration script .plog.rc; you can use plogrc.template as a starting point.
Next, you have to choose how to name your source files: they all need a common prefix, so that plog knows what to look for. Please make sure not to use a prefix that would match any of the additional files or directories residing in the working directory, or the scripts may crash or even destroy necessary files or get into an infinite loop! Good choices might be simply t, or text, or post, or any letter combination not including the address file; don't use any punctuation, except for - or _ after at least one letter.
pubnext.sh will generate the list of all files matching the prefix pattern, and then process the first file in that list which does not bear the "draft pattern" as defined by its draft variable. If you want to have your files processed in a certain order, you should therefore name them in such a way that the lexical order of their names corresponds to the desired processing order. An example would be naming them as pYYMMDDI, where YYMMDD is indicating year, month, and day of writing, with a possible additional index letter I, or text_NNN.md with a numerical index NNN.
If you want to send an e-mail newsletter, you have to list the recipient addresses in a file whose name needs to be set in the adds variables of the scripts.
This file should be a simple text file with one recipient address per line. Lines beginning with # are ignored and can be used for comments. However, never use # after an address: it would be part of the latter!
If you do not need the newsletter functionality, you still have to have an address file! It can be empty (or only contain comment lines), but it must be present and readable.
Both allpub.sh and pubnext.sh can of course be executed manually. However, in most cases, it might be more useful to launch them automatically, e.g from a daily or weekly cron job.
pubnext.sh processes just the next available (non-draft) post, and send it in processed (HTML and pure text) form to all e-mail recipients, and save the processed forms in the appropriate directories for later use (blog/glog publication).
allpub.sh will call pubnext.sh repeatedly, until the latter cannot find any available post, and then generate index files in HTML and pure text version for publication as blog and glog.
As it might not be desirable to publish the generated HTML and pure text files (together with their respective index files) as the same user who launched the plog scripts, a copying step for the final publication may be necessary.
A possible solution is given in the script allsync.sh. It simply uses rsync to pull the files from a "remote" directory (which of course may be on the same machine) to a "local" directory, and make all of them world readable. Also a simple cp could of course be used, but rsync only copies files which are not yet present in the target ("local") directory.
If you want to make use of allsync.sh, please set its variables according to your working and publication directories! You should understand how rsync is working before doing so, though.
# This file is part of plog.
# along with plog.  If not, see <http://www.gnu.org/licenses/>.