|View: HTML | Text | PS | PDF | RTF | Wiki | DocBook | DocBook Inline | changelog | about this header||
Circle Jeff Boweron
Under Ubuntu, simply run sudo apt-get install gourmet. You can also download the latest (non-repository) version or versions for other operating systems here.
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 Cygwin 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 index.htm 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 index.htm 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 here. Simply go to wherever you exported the files to and run recipe-process.sh and it will automatically update things.
Example 1. recipe-process.sh