Templating

I Wrote a templating system. A main template calls in sub-templates. The sub-templates can call in their templates.

@@_head_@@
@req>@

@@_class_init_@@

The head template could look like this..

@@_shbang_@@
@@_frozen_string_@@
@@_rubocop_disable_@@

So.. head.template calls in shbang.template, frozen_string.template and rubocop_disable.template. The result is positioned at the @@_head_@@ in the main template (recursive.. with a max-depth bail-out to prevent infinite recursion).

The @@req>@@ is a placeholder for a collection.
A collection is built like this: @@req < require 'slop'@@

Basically.. it’s a Hash. The key is the left part of the < and the value is the right part. You could have multiple keys and multiple insert points.. and - of course - use it for other things then the requests.

Usage: btemp -f main_temp.layout -o output.rb