Fri Aug 16 20:27:21 PDT 2019

Fixing the Calendar in a Nanoblogger Blog

I use Nanoblogger (nb) to make this blog. Nanoblogger is very simple and it does not rely on a separate database. This minimizes the number of moving parts to know about and maintain.

Additionally, when things go wrong, as they sometimes do, it is normally straightforward to isolate the source of the problem and resolve it with Nanoblogger.

Recently I noticed, for example, that the calendar which shows up in various places in the blog had a mistake in it, whereby there were underscore characters around the current date.

Looking into what might have happened, I found that the 'cal' command on OS X has started to embolden (by default) today's date. What was happening was that the 'cal' output was then not being parsed correctly by Nanoblogger into the resulting page. The solution was simply to employ the '-h' option with 'cal' - which stops the highlighting function.

The 'cal' command is referenced in Nanoblogger's calendar.sh file. Change this string to 'cal -h' and the problem is solved...'

The ascii below shows the before and after effect for 'cal'. The error looks a little different in Nanoblogger - but this is the source of the problem - and its solution.

#cal
    August 2019       
Su Mo Tu We Th Fr Sa  
             1  2  3  
 4  5  6  7  8  9 10  
11 12 13 14 15 16 17  
18 19 20 21 22 23 24  
25 26 27 28 29 30 31  
                      
#cal -h
    August 2019       
Su Mo Tu We Th Fr Sa  
             1  2  3  
 4  5  6  7  8  9 10  
11 12 13 14 15 16 17  
18 19 20 21 22 23 24  
25 26 27 28 29 30 31

Posted by ZFS | Permanent link | File under: planner_update, bash