Archive for August, 2006

Published by Niels on 29 Aug 2006

Release of NanoBlogger Gallery plugin 0.6.0

There is a new release of the NanoBlogger Gallery plugin. The previous version had a problem when run in Bash versions below 3.1. There are some differences when initializing arrays from a ’string’ using $IFS.

In Bash 3.1 you can do this:

1
2
3
4
5
6
7
8
#!/bin/bash
 
a="1.2.3"
IFS='.'
declare -a arr=( $a )
echo "${#arr[@]}"
 
# Outputs 3 in version 3.1 and 1 in version 3.0

But if you instead do this then it works in both versions:

1
2
3
4
5
6
7
8
9
#!/bin/bash
 
a="1.2.3"
IFS='.'
declare -a arr
eval "arr=( $a )"
echo "${#arr[@]}"
 
# Outputs 3 in version 3.1 and 3.0

So hopefully the Gallery plug-in is better prepared for the real world :). Thanks to Chris Gratham for helping me out with this.

The new version can be downloaded here.

Published by Niels on 25 Aug 2006

New AScopy release 0.9.2

A new version of AScopy has been released: 0.9.2. This is a major bug fix release as the previous version did not remove directories in the correct order, i.e. deleting them before they were empty.

You can download the new version here.

Published by Niels on 25 Aug 2006

Release of Gallery plug-in 0.5.0

Version 0.5.0 of the NanoBlogger Gallery plug-in has just been released. It does not offer any extra features and is just a bug fix release to make the plug-in work with all versions of NanoBlogger from 3.0 and up.

It has been tested on the for the following releases:

  • 3.0
  • 3.1
  • 3.2
  • 3.2.3
  • 3.3 RC5

The major problem that needed to be fixed is that the plug-in uses standard NanoBlogger calls as often as possible. This means that the standard entry format can be used and even that (from version 3.3) the format field can be used to put markup into the entry.

Unfortunately the NanoBlogger API has changed a bit between versions. The call to read_metadata does not fill the same return variable in the versions mentioned above:

  • $NB_Metadata for version 3.0 and 3.1
  • $META_DATA for versions 3.2 and 3.2.3
  • $METADATA for version 3.3

There was already a function in the plug-in to determine for two given version numbers which was the newer one because the parameters to read_metadata also needed to have $METADATA_CLOSETAG specified from version 3.3 and up if the entry’s body is requested. So the plug-in already had to choose between two different calls based on the NanoBlogger version.

But everything seems to be fixed for now. The new plug-in can be downloaded here.

Published by Niels on 02 Aug 2006

NanoBlogger and ViM

NanoBlogger is a minimalistic approach to blogging as vi (or ViM) is a minimalistic approach to editing. Okay, not as minimalistic as ed or ex, but you get the idea.

Using ViM as the default editor for NanoBlogger is as simple as setting the variable $EDITOR in .bashrc, $BLOG_DIR/blog.conf or, if you want control of NanoBlogger settings for each machine that you work on, $HOME/.nb.conf.

But the default settings for editing entries or articles are not particularly nice. Fortunately ViM can have settings on a per-file basis using modelines (if you don’t know what they are just type :h auto-setting on the ViM command line). To make editing with ViM a bit nicer, just edit the following files:

  • $BLOG_DIR/templates/entry.metadata
  • $BLOG_DIR/templates/file.metadata

and add the following line at the end of the file:

vim: set ts=4 sw=4 ff=unix fo+=t et:

This should provide you with some decent ViM settings across all machines that you are working on.

WARNING:
NanoBlogger versions <=3.3-RC5 have a bug that will overwrite the template files with the default template files and undo your modeline setting. This can be fixed by either using a later version (not available at the time of this writing), using the CVS version or editing the file lib/tools.sh in the same directory where your NanoBlogger binary is. Search for a line that has the following:

$NB_TEMPLATE_DI/

and change that to:

$NB_TEMPLATE_DIR/