EXPRESSION CODE

Post #5, New design has arrived

March 14, 2009

As promised!

Once again, the design was inspired by MiruKim.com's Naked City Spleen combined with the idea I happened to be blogging about that day, beta posts. Here is an overview of each:

The original:

And the new:

The vertical space in between the post index and the post body will be used display post version numbers for posts which started life as a beta post. Clicking one of the version numbers will show that particular version of the post. I'm thinking to also make a view of the differences available by dragging one version onto another. Before I can do any of that, however, I still need to add support for beta posts into the engine.

Speaking of the engine, let me share that with you too. Thus far I've implemented only the barest amount necessary to quickly add posts to EXPRESSION CODE. Here is my process:

  1. Write the post in Markdown format, and place it into a special directory that contains the markdown formatted sources for all the posts. The files are named according to the post number (e.g. the source for this post is titled 5.markdown).
  2. Update the template to include the newest post on the post index.

  3. Update the site index to point to the new post (The site index includes the post by way of server side includes).

  4. Run the generate script, which converts each post source file to html and combines them with the template.

  5. Upload the content to the server on which EXPRESSION CODE is hosted.

The generate script is written in Ruby:

header = File.read('template/header.html')
footer = File.read('template/footer.html')

Dir['posts/*.markdown'].each { |markdown_file|
  post_number = markdown_file.scan(/^posts\/(\d+).markdown$/)[0]
  post_html = header + `perl Markdown.pl --html4tags #{markdown_file}` + footer
  post = File.open("htdocs/#{post_number}.html", 'w')
  post << post_html
}

There is a lot left undone, but the entire blogging engine is only 8 lines! It's just enough to do exactly what I need for right this moment, and nothing more. This has an advantage later on: I don't waste time doing work now that I can probably do better later (because I will have a better idea of what the requirements are). Overall it's a great, lightweight start.

Anyway hope you enjoy the design, come back soon to check up on the progress!