Ruby_box
For some time I wondered what to do with Ruby::Box. It wasn’t what I expected.
Keeping things in namespace.. how boring. And we already have this.
Then I realized.. you could reverse it! You could use it to SHARE namespace.
So I wrote a new version of an old templating-engine.
- database has ’template’ and ‘snippet’
- template can import ‘snippet’.. that can import ‘snippet’ (recursively).
- a page can be built from a ’template’ but not from a ‘snippet’.
So.. the ’template’ instantiates the Box; the ‘snippet’(s) use it.
A snippet is made into a Proc.. so it could take arguments.
The ’template’ or ‘snippet’ can ENTER them: {{group:name arg1, arg2, named: arg}}
Now I can use normal Ruby and just return the result (the String).
Add to this:
- aggregated variables (processed last)
- vanishing comments (#- will not appear in produced output)