Wednesday, December 7, 2011

New NanoBlogger Command-Line


My hope is that I can write this entry in GNU Emacs' Org Mode and have it auto-published into this blog. If you are reading this, then I have succeeded.

This is a static blog. That is, the server side is all HTML. It can be served by virtually any web server. This makes it incredibly convenient for testing and deploying. When I am writing blog entries, I'm just typing in Emacs. I then save the entries and use Org Mode plus some personalized tweaks to publish them to a local directory as something close to HTML.

These HTMLish files are then fed into NanoBlogger. NanoBlogger is the magic tool that turns a few HTMLish files into a fully functional website. NanoBlogger accepts HTML for the text af entries but wants some simply formatted metadata added to the file.

The Metadata is needed to help NanoBlogger out because, as its name implies, is a teeny-tiny blog engine. As a comparison, my installation of NanoBlogger is 768K (yes, that's "K"). I also have installations of Drupal at (14M) and Joomla (107M).

The .txt source for each NanoBlogger posting is a file with the body of the entry in HTML embedded but all the cruft that tends to come before and after the body of a web page is simply not there. The easiest way to get an understanding of it is to view the metadata source for this sample posting.

So you're saying "Big deal." or "Who needs yet another file format?" But it is a big deal. What most younglings have never learned is that WYSIWYG is a distraction from actual content production. Content production is not the same as formatting and editing and, at least in my experience, uses very different parts of the brain. So the less formatting you do while producing content, the better your content will be (at least if you have my brain :-).

While it has largely been lost with the popularization of the Wikipedia, initially, Wiki markup was intended to simplify editing but also served to separate the content production from formatting. While NanoBlogger expects these HTMLish files as input, it is designed to generate them from any number of simpler input formats.

These simpler input formats are quite unlike HTML as they are, well they're simpler. The default input format is the rather famous Markdown though many other formats are supported by NanoBlogger or the community. This article seems to do a good job explaining the benefits of simple languages such as Markdown.

It took me but a few hours to create a converter for GNU Emacs' Org Mode to NanoBlogger.

While not nearly as cool as what I've discussed above NanoBlogger has yet another advantage: it produces a static site. On my local machine (17" MacBook Pro), I can view the entire site without running a web server. I simply go to Firefox (actually Firefox Aurora) and visit the URL, specifically, the file URL of my blog. For me, I visit file://Users/neil/www-nb, and then I can see my entire blog through the magic of a static websites, file URLs, and relative URLs.