chris blogs

September 2004

13sep2004 · Tangerine

Since there are more Ruby packages for templating than there are real users of them (:-P), I’ve decided it can’t hurt to make one myself.

It’s called Tangerine, and is the first library I’ve developed using TDD. (Thanks, dragonkh :-)).

Of course it’s hard to design (and not only implement) something new, therefore I did two spikes before, dubbed AllOfMyLove which was a 20 lines gsub for experimentation, and DeepBlueTea, a lot longer code that used a “real” parser (as needed for nested parentheses). (I guess I’m a grand-master in inventing silly project names :-P).

Tangerine finally implements a compiler which creates a Proc out of the template for good performance. In benchmarks I did myself (never trust a benchmark…), Tangerine turned out to be 2 times faster than a comparable ERB template. (ERB evals all the time.)

Finally, I’ll show a short sample to show how it feels like:


,,# overview
<ul id="toc">

<hr />


<p>,,title -- ,,tagline. ,,("%d%b%Y").downcase)</p>

This is a very primitive template for a simple weblog, and will result in something like this:

<h1>chris blogs</h1>
<h2>a blog by christian neukirchen</h2>
<p>Mon Sep 13 19:29:04 CEST 2004</p>

<ul id="toc">

  <p>some &lt;content&gt;</p>
<hr />

<hr />

<p>chris blogs -- a blog by christian neukirchen. 13sep2004</p>

A few issues still need to be handled better, I’ll do a release soon.

Name für eine jüdische Kneipe: Bar Mitzwah.

Zustand des Religionsbuches bei Erhalt: lächerlich. :-)

NP: Led Zeppelin—Tangerine

Copyright © 2004–2016