Lyte's Blog

Bad code, bad humour and bad hair.

Export All Tomboy Notes

Recently I’ve been trying Tomboy, but I’m giving up.

I haven’t found a good method of exporting all notes at once either built in or via a readily available plugin. You can import linked notes and even follow them recursively, but some of my notes don’t have direct links as they are intentionally only locatable via search.

To make the export work better I ended up creating a note that created a single link to every other note using xpath under bash.

First, move to the notes directory:

cd ~/.local/share/tomboy

Then, for every note grab the title using xpath:

for i in *.note; do
    xpath -q -e '/note/title' $i;
done \
| sed -r 's%^<title>(.*)</title>%\1%g'

Note: The sed command is horrible hack because I couldn’t find a graceful way to make xpath give me the value of the node without printing the actual tags that are matched. I was on the edge of writing a full blow script, but sed was good enough.

Copying the output of that in to a new note automatically created the links and exporting that note gave me HTML output that was much easier to move around.