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
allpub.sh, a configuration file, and a suitable directory structure.
If you make use of character conversion (UTF8 or the like), also the
convchars.sh will be needed.
It makes use of the standard command line tools like
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
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
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
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
.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.
## Template file for plog configuration ## Please copy as .plog.rc and modify as needed! # list of e-mail addresses adds='ad.txt' # directory to save text files for publication pubtext='' # number of text files to be included in the index lentext=24 # name of index file for text indtext='gophermap' # header for text index file indtexthead='most recent entries in reverse chronological order' # directory to save HTML files for publication pubhtml='' # number of HTML files to be included in the index lenhtml=12 # name of index file for HTML/blog indhtml='list.html' # title in index file for HTML/blog indhtmltitle='blog title' # name of RSS file (to be saved in $pubhtml): rsshtml='rss.xml' # title in RSS file rsstitle='blog feed' # description in RSS file rssdesc='blog description' # base name of HTML/blog directory (from outside): baselink='http://www.example.com/blog' # prefix for mail subject subject='[newsletter]' # prefix for text file names fprefix='t' # mark for draft texts (must be at beginning of one line) draft='DRAFT' # archive directory for processed texts arch='Archiv' htmlhead='<HTML><BODY>' htmlfoot="</BODY><!-- generated by $myself --></HTML>" logfile='_pubnext.log' # special character converter convert0='cat' # markdown to HTML converter convert1='mrkdwn.pl' # HTML to text converter convert2='lynx -display_charset=US-ASCII -force-html -dump' # e-mail transmission program mailer=mailx # mailer="logit ::" # test dummy # temporary file for saving HTML file tmpf1='_pubnext.html' # temporary file for saving text file tmpf2='_pubnext.txt' # lockfile lockf='.pubnext.lock'
addsis a string with the name of the address file of the e-mail recipients
pubtextis a directory, where pure text versions and (by
allpub.sh) an index file suitable for a gopher server will be saved; if empty, no saving will happen (but
allpub.shwill report errors, so you should set up dummy directories
pubhtmlif you want to make use of
allpub.shjust for sending e-mail newsletters)
lentextis the maximum number of text version posts that will be indexed
indtextis the name of the index file for pure text version; if you are planning to use it as gopher index, it probably should be called
indtextheadis inserted at the beginning of the index file, as description
indhtmlare parameters analogous to their text counterparts, but for the HTML files and index
rsshtmlis the filename for an RSS feed; in most cases
rssdescare title and description inserted in the RSS file
baselinkis the basename of the blog directory as accessible from outside (i.e, not the possibly different name for accessing it from your shell)
subjectis a string prepended to e-mail subjects, and could serve as a flag for the recipients
fprefixis 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!
draftcontains the string that should mark draft texts which are not (yet) to be published; it is used as a
greppattern, so be careful with punctuation
archdenotes a directory (must be writable of course) where postings (input text/Markdown files) are moved, after being processed and published
htmlheaddefines the string prepended to the files resulting from Markdown-HTML conversion
htmlfootis the analogue for the ending of these files
logfileis the file logging all activity by
convert0is the script for UTF8-HTML character conversion
convert1is the script for Markdown-HTML conversion
convert2is the script for HTML-text conversion
maileris the program for transmitting e-mail
tmpf2are temporary files
lockfis the lockfile used to control execution of
pubtextcan be given to
pubnext.shon the command line, overriding the settings in the script or the configuration file
.plog.rcis local to any working directory, so you have to add it to any directory containing posts (source texts)
.plog.rcis 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
allpub.sh, indicating the working directory where the source (Markdown formatted) files are stored; it will be passed on to
pubnext.sh, and if empty, the current directory is used
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
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
post, or any letter combination
not including the address file; don't use any punctuation, except for
_ after at least one letter.
Set this prefix as a pattern in the configuration variable
(The file suffix is irrelevant: They will all be treated as text files.)
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
YYMMDD is indicating year, month, and day of
writing, with a possible additional index letter
with a numerical index
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
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.
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
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
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
rsync is working before doing so, though.
# Copyright 2015 Yargo Bonetti # # This file is part of plog. # # plog is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # plog is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with plog. If not, see <http://www.gnu.org/licenses/>.