<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML v4.4//EN" "/usr/share/xml/docbook/schema/dtd/4.4/docbookx.dtd">
<title>Installing and Using Gourmet Recipe Manger</title>
This document explains at a high level some of the quirks about Gourmet, an open source recipe manager. This document is currently a stub with very basic information primarily focused on a script to reformat the HTML output into a more sane format.
Under Ubuntu, simply run <command>sudo apt-get install gourmet</command>. You can also download the latest (non-repository) version or versions for other operating systems <ulink url="http://sourceforge.net/projects/grecipe-manager/files/">here</ulink>.
<title>Exporting to HTML</title>
Gourmet has a very nice method of exporting the entire cookbook to HTML format. It generates individual files and a master recipe list. It would be nice if it broke the list into sections or organized things better, but honestly there are much worse decisions that could have been made.
What I found difficult, however, is that the recipe filenames are essentially randomly generated. They contain spaces (yuck!) and are appended with what appears to be a recipe number. The problem is this number can change, so when you post a link to the world's best haggis recipe and then make a change to said recipe, you need to do work to make sure the link is updated.
To handle this, I've created a script which should run under most BASH-oriented operating systems (it's designed for Ubuntu Linux, but may work under OSX or under Windows with <ulink url="http://www.cygwin.com/">Cygwin</ulink> installed). It does two primary things. First, it strips out any whitespace in the name and removes the sequence number. I also add some META tags, this helps search engines know what they're looking at. I also do things like delete any old renamed recipes first (to start with a clean slate), skip processing the <filename>index.htm</filename> file (which is the list of recipes), and skip processing anything that's not an HTML file (like the CSS definition). I then go to the <filename>index.htm</filename> file and replace the old URL with the new one. Below is a listing of the code, including my comments, but you can also download the file <ulink url="recipe-process.sh">here</ulink>. Simply go to wherever you exported the files to and run <command>recipe-process.sh</command> and it will automatically update things.
<programlisting><inlinemediaobject><imageobject><imagedata fileref="recipe-process.sh" format="linespecific"/></imageobject></inlinemediaobject></programlisting>