Need to identify compilable strategy
Reported by Nicholas Faiz | May 20th, 2009 @ 03:25 PM
A good templating system needs to be compilable. The current prototype compiles the template live each time, it should be possible to improve this early on.
This is not so much the case as optimize later as make certain the basic framework will be production ready.
Comments and changes to this ticket
-
Nicholas Faiz May 20th, 2009 @ 03:34 PM
For example, a haml document
ok = @foo done - if @foo = Time.now - else there's no time like the present
compiles to this str, which is reflected as a method on the action_view object, and reused unless the template's timestamp is newer than the methods.
extend Haml::Helpers;_hamlout = @haml_buffer = Haml::Buffer.new(@haml_buffer, {:attr_wrapper=>"'", :format=>:xhtml, :autoclose=>["meta", "img", "link", "br", "hr", "input", "area", "param", "col", "base"], :preserve=>["textarea", "pre"], :ugly=>false});_erbout = _hamlout.buffer;__in_erb_template = true;; _hamlout.push_text("ok\n");haml_temp = @foo; haml_temp = _hamlout.push_script(haml_temp, false, false, false, false, false); _hamlout.push_text("done\n"); if @foo; haml_temp = Time.now; haml_temp = _hamlout.push_script(haml_temp, false, false, false, false, false); else; _hamlout.push_text("there's no time like the present\n");end; @haml_buffer = @haml_buffer.upper;_erbout;
So, presumably the renshi parser should do something similar.
-
Nicholas Faiz May 20th, 2009 @ 03:57 PM
The problem with doing this, though, is that it means writing the template parser specifically for the Rails platform. I wonder how haml handles Sinatra integration?
-
Nicholas Faiz June 2nd, 2009 @ 09:30 PM
- State changed from new to resolved
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Renshi is a templating language for Ruby which is unobtrusive in HTML and XHTML structures - http://github.com/biv/renshi/tree/master