Parents journal

For over 20 years I've kept a journal, noting all the gems our kids come up with, and in more recent years the antics of our dogs. I started it when I was struck by how well our then two year old handled the arrival of her baby sister.

I would highly recommend this practice to any new parent. Kids say the funniest things, and you cannot remember them all if you don't write them down. Some of what they say may be highly embarrasing, but so what - only you and your kids are likely to ever read the journal.

New parents are of course generally overwhelmed with the task at hand, so the trick is to minimize the effort required to make journal entries.

The tools/scripts I describe here will be of no use to anyone using Windows, but Mac's and any flavor of UNIX will do just fine, if you want to replicate.

logit.sh

This is a script I wrote long before we had kids. Its purpose is to minimize the effort required to create time-stamped log entries - useful for all sorts of purposes, including research notes.

It can be invoked with many names eg. logit, blogit, sailing, journal and can tailor its behavior based on the name it is invoked as.

An entry might look like:

2022-04-02 14:14 (sjg)

Write up an article on how to turn 20 years of journal entries
into a readable set of web pages.

You can feed it an already prepared file, but its most common usage is to just read lines interactively and append to a log file.

It takes a few simple/standard tidle commands like:

~e invoke ${EDITOR:-emacs} on the input gathered so far.
Actually if you enabled server mode in emacs this will invoke emacsclient, just kill the buffer when done.

~v invoke ${VISUAL:-vi} on the input gathered so far.

~q quit and discard input.

. quit and save input.

Any unrecognized tilde commands are passed to a function Tidle which an rc script can provide.

I typically use one file per month, kept in a subdirectory per year. For example; journal creates:

~/journal/2022/j202204sjg

while logit creates:

~/logs/2022/202204

and blogit creates:

~/public/blog/sjg-202204.txt

log2rst.sh

So it is easy to collect the entries, but how is anyone to read it?

Our kids are now in their 20's, and I figured I need to allow them to read of their adventures when they were little.

I decided that an HTML page per year would work well, so I wrote a script to concatenate all the entries for a year into a single rst (reStructuredText) file.

Initially all it did was turn each time-stamp into an rst section heading.

Then I decided it would be nice to include some pictures occasionally so the reader can see what the characters looked like at the time. So I added support for turning a simple syntax like pic=20220303001 into an rst image directive. This worked really well (I might split it out to a separate script).

/Pic/20140822263/thm

Thus input like:

pic=20140822263 right target=/sjg/blog/napa.htm

2014-08-26 (sjg)

Our friends Steve & Heidi from Melbourne came to visit.
We took them to Napa so they could experience an earthquake!

becomes the rst below, which produces the image at right:

.. image:: /Pic/20140822263/thm
   :align: right
   :height: 126
   :target: /sjg/blog/napa.htm
   :width: 168


2014-08-26 (sjg)
----------------

Our friends Steve & Heidi from Melbourne came to visit.
We took them to Napa so they could experience an earthquake!

The handling of the url /Pic/20140822263/thm is done by pic.wsgi (inspired by Photo.net many years ago). It allows the location of that image to change over time without breaking any references.

Makefile

As I mentioned, you really want a UNIX system for this setup to work. The hard work of converting rst to html is done by some tools that come with docutils and bmake includes my rst2htm.mk to hide all the gory details.

The rest is a simple makefile that leverages the above to turn those rst files into html and generate a index page.

The end result is that simply running make in ~/journal prepares an index.htm along side all the year based html files in ~/journal/obj (one of the neat benefits of bmake), I then just need a symlink to that in a private section of my website and anyone who has a login and knows the url can read the journal.

My youngest at least, enjoyed reading the result.

If any one is interested in a copy of the setup - send me mail.


Author:sjg@crufty.net /* imagine something very witty here */