#905 ✓wontfix
Peter Williams

Semi-colons in partials cause compile error

Reported by Peter Williams | January 18th, 2011 @ 05:52 PM

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]

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.

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'

Comments and changes to this ticket

  • Peter Williams

    Peter Williams January 18th, 2011 @ 05:57 PM

    I tracked the problem down toHobo::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.

    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?

  • Domizio Demichelis

    Domizio Demichelis January 18th, 2011 @ 07:11 PM

    When I was refactorying hobo for rails 3, I had to change this method. While in the process I tried to remove that lines that look like a quick hack, but it didn't work for some reason that I can't remember, so I didn't touch that part.

    Bottom line we still have it in 1.3

  • Bryan Larsen

    Bryan Larsen January 18th, 2011 @ 09:50 PM

    I'm having trouble reproducing. Could you look at my attempt here and let me know if you see anything different?

  • Peter Williams

    Peter Williams January 19th, 2011 @ 04:37 PM

    Hmm... When i try this in a clean project i cannot reproduce it either. Maybe there is something in our taglib that puts dryml in to a weird state. We'll investigate a bit more.

  • Bryan Larsen

    Bryan Larsen January 20th, 2011 @ 02:48 AM

    did lighthouse eat the URL in my message? It's https://github.com/Hobo/hte2/commit/87cdd81cbeb85b22be0b33a00ee44a0...

    It looks like I did have a carriage return at the end of the partial. I tried adding another one and it still succeeds. I tried using a CRLF instead of LF.

  • Domizio Demichelis

    Domizio Demichelis March 27th, 2011 @ 08:20 PM

    • State changed from “new” to “wontfix”

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Pages