That might be a good long term solution. However, it seems to me that partials should work. Getting a compile error on what looks like a perfectly valid dryml file seems wrong.
Peter On Tue, Jan 18, 2011 at 8:05 AM, Bryan Larsen <[email protected]> wrote: > I don't think that's the only problem with using dryml partials. Given that > DRYML parts are so much nicer than Rails partials, this hasn't been a high > priority area to fix. I think yours is the first bug report. > > What's your use case for partials -- have you tried using parts? > > Bryan > > > On 11-01-17 11:00 PM, Peter Williams wrote: >> >> It appears that having a semi-colon in a dryml partial outside of a >> dryml tag causes serious problems in 1.0.2. To reproduce this i >> created a controller with a `#show` action that does nothing, a >> matching `show.dryml` template that contains >> >> <%= render :partial => 'tab_your_company' %> >> >> and a partial `_tab_your_company.dryml` that contains >> >> <p>test ;</p> >> >> When i request that action i get a compile error on line 1 of >> _tab_your_company.dryml.[1] >> >> A quick search on lighthouse did not turn up anything that seemed like >> my problem so i started investigating. I tracked the problem down to >> `Hobo::Dryml::DRYMLBuilder#erb_process`. On line 64 of >> `dryml_builder.rb` there is code that removes everything before first >> and after the last semi-colon from the erb output. This has the >> effect of making the remaining erb output syntactically illegal for >> partials whose last element contains a semi-colon that if that element >> is not a dryml tag. >> >> It does work just fine if the semi-colon is wrapped in a dryml tag. >> For example, if i change the `_tab_your_company.dryml` file to look >> like >> >> <do> >> <p>test ;</p> >> </do> >> >> everything works just fine. >> >> I have run across this as during an upgrade from a pre-1.0 version of >> hobo. Many of our partials seem to elicit this failure. I am hoping >> to fix this without having to add a do tag around every single partial >> in our large application. However, i am not sure exactly how to fix >> this issue because i am not sure why the code in `#erb_process` strips >> the beginning and end of the erb output. Anyone have any ideas about >> how i might solve this problem? Or at the very least, what that code >> achieves? >> >> Thanks in advance for the info. >> >> Peter >> >> >> [1]: Stack trace for semi-colon >> ActionView::TemplateError (compile error >> app/views/licenses/_tab_your_company.dryml:1: unterminated string >> meets end of file >> app/views/licenses/_tab_your_company.dryml:1: syntax error, unexpected >> $end, expecting kEND >> ...test ; output_buffer; end; end >> ^) on line #1 of app/views/licenses/ >> _tab_your_company.dryml: >> 1:<p> test ;</p> >> >> app/views/licenses/_tab_your_company.dryml:1:in `build' >> hobo (1.0.2) lib/hobo/dryml/dryml_builder.rb:78:in `each' >> hobo (1.0.2) lib/hobo/dryml/dryml_builder.rb:78:in `build' >> hobo (1.0.2) lib/hobo/dryml/template.rb:73:in `compile' >> hobo (1.0.2) lib/hobo/dryml.rb:173:in `compile_renderer_class' >> hobo (1.0.2) lib/hobo/dryml.rb:159:in `make_renderer_class' >> hobo (1.0.2) lib/hobo/dryml.rb:112:in `page_renderer' >> hobo (1.0.2) lib/hobo/dryml.rb:78:in `page_renderer_for_template' >> hobo (1.0.2) lib/hobo/dryml/template_handler.rb:19:in >> `render_for_rails22' >> hobo (1.0.2) lib/hobo/dryml/template_handler.rb:142:in >> `render_dryml' >> hobo (1.0.2) lib/hobo/dryml/template_handler.rb:138:in >> `render_dryml' >> hobo (1.0.2) lib/hobo/dryml/template_handler.rb:106:in `render' >> hobo (1.0.2) lib/hobo/dryml/template_environment.rb:605:in `send' >> hobo (1.0.2) lib/hobo/dryml/template_environment.rb:605:in >> `method_missing' >> app/views/licenses/show.dryml:1:in `render_page' >> hobo (1.0.2) lib/hobo/dryml/template_environment.rb:267:in >> `new_object_context' >> hobo (1.0.2) lib/hobo/dryml/template_environment.rb:248:in >> `new_context' >> hobo (1.0.2) lib/hobo/dryml/template_environment.rb:248:in >> `new_context' >> hobo (1.0.2) lib/hobo/dryml/template_environment.rb:255:in >> `new_object_context' >> app/views/licenses/show.dryml:1:in `render_page' >> hobo (1.0.2) lib/hobo/dryml/template_handler.rb:22:in >> `render_for_rails22' >> hobo (1.0.2) lib/hobo/dryml/template_handler.rb:142:in >> `render_dryml' >> hobo (1.0.2) lib/hobo/dryml/template_handler.rb:138:in >> `render_dryml' >> hobo (1.0.2) lib/hobo/dryml/template_handler.rb:106:in `render' >> hobo (1.0.2) lib/hobo/dryml/template_handler.rb:83:in >> `render_for_file' >> hobo (1.0.2) lib/hobo/model_controller.rb:818:in `render' >> hobo (1.0.2) lib/hobo/controller.rb:23:in `call' >> hobo (1.0.2) lib/hobo/controller.rb:23:in `included_in_class' >> extras/cache_helper.rb:205:in `olex_auto_cache' >> config/initializers/reconnect_before_every_request.rb:12:in >> `process' >> lib/current_corp_support.rb:45:in `process' >> extras/cache_helper.rb:453:in `process' >> > > -- > You received this message because you are subscribed to the Google Groups > "Hobo Users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/hobousers?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
