Saturday, December 10, 2011

Seems It Really Works


Well, it appears this actually does work. I seem to be having a few
issues integrating with NanoBlogger but I'm sure I'll work those out.
The problems that I've seen are:

  1. It seems that adding or even updating a new entry is as costly
    as rebuilding the entire blog from scratch. Right now, that's
    OK. But what am I going to do when I have 10, or 100 postings?
    I hope NanoBlogger can handle this.
  2. NB seems to assume that its input files are hand-written in
    some legacy text editor called Vim or something :-). While my
    strategy of using GNU Emacs' Org Mode keeps the flavor of NB in
    that it is written in a simple markup language, it doesn't seem
    to fit the NB model perfectly. There is nothing wrong with NB's
    markup, it is just that Org Mode's markup can easily be
    exported to virtually every other markup on the planet. So I
    just need to learn Org Mode markup, write my content in Org
    Mode, and then publish that data into whatever format I choose.
    Seems a better solution but NB isn't quite prepared for it.
  3. I would still like better integration with Org Mode and NB. The
    steps I've used to produce this entry are:
    • Ran a little shell script I wrote to create a new NB
      entry. All I do is give the shell script the title of the
      Org Mode file I want to store the new entry in and it
      does its magic, leaving me with an Org Mode skeleton for
      NB.
    • Edit the Org Mode file just created.
    • Use Org Mode to publish the entry. This just stores it in
      my local NB folder.
    • Run nb update to have my changes put into the local
      copy of the blog.
    • Run nb preview to view the changes before publishing.
    • Run nb publish to update my blog.



So, while they're are still some problems, I have to say I love it.
The advantages of using Org Mode and the simple NB blogging engine on
both my local and production server is way cool.

Org Mode is actually way cool. I've only started using it in the past
year and will likely spend years learning it as it supports so many
features. But, like all well-designed pieces of software, you don't
need to learn it all at once. I'll yabber about Org Mode another day.
In any case, I'm real happy with my blog and the ease with which I can
add postings to it.

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.