[Bug] 0.15.2 upgrade - padrino tags rendering to html entiries in templates
wakatara opened this issue · comments
Do you want to request a feature or report a bug?
A bug! (but so happy we've upgraded padrino to 0.15.2 and upgrade looking good so far. =] ).
What is the current behavior?
In padrino with haml/sass as rendering engine, padrino tags such as = form_tag url
and = favicon_tag
etc and all nested haml code below render as thei html entiries (eg. lt&
rather than <
).
What is the expected behavior?
Expected behaviour is to have them render as <
or similar.
Example
!!! 5
%html{:lang => 'en'}
%head
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
%meta{:content => 'text/html; charset=utf-8', 'http-equiv' => 'Content-Type'}
%meta{:name => :viewport, :content => 'width=device-width,initial-scale=1'}
%title= @title.present? ? "#{@title} | AArk Admin" : "#{pat('login.title')} | AArk Admin"
=favicon_tag "favicon.ico"
%link{:href => 'http://fonts.googleapis.com/css?family=Varela', :rel => :stylesheet}
%link{:href => "https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css", :rel => :stylesheet}
%link{:href => "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css", :rel => :stylesheet}
%link{:href => "https://cdn.datatables.net/1.10.13/css/dataTables.bootstrap.min.css", :rel => :stylesheet}
=stylesheet_link_tag 'app'
%body
.modal.fade
= form_tag url(:sessions, :create), :class=>'login form-horizontal' do
.modal-header
renders as:
<!DOCTYPE html>
<html lang='en'>
<head>
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<meta content='width=device-width,initial-scale=1' name='viewport'>
<title>Login | AArk Admin</title>
<link href="/admin/images/favicon.ico?1672408286" rel="icon" type="image/ico" />
<link href='[http://fonts.googleapis.com/css?family=Varela](view-source:http://fonts.googleapis.com/css?family=Varela)' rel='stylesheet'>
<link href='[https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css](view-source:https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css)' rel='stylesheet'>
<link href='[https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css](view-source:https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css)' rel='stylesheet'>
<link href='[https://cdn.datatables.net/1.10.13/css/dataTables.bootstrap.min.css](view-source:https://cdn.datatables.net/1.10.13/css/dataTables.bootstrap.min.css)' rel='stylesheet'>
<link href="/admin/stylesheets/app.css?1672408286" rel="stylesheet" type="text/css" />
</head>
<body>
<div class='modal fade'></div>
<form action="/admin/sessions/create" accept-charset="UTF-8" class="login form-horizontal" method="post">&lt;div class=&#39;modal-header&#39;&gt;
&lt;div class=&#39;login-logo&#39;&gt;&amp;lt;img src=&amp;quot;/admin/images/logo_text.png?1672408286&amp;quot; alt=&amp;quot;Amphibian Ark&amp;quot; height=&amp;quot;118&amp;quot; width=&amp;quot;200&amp;quot; /&amp;gt;&lt;/div&gt;
&lt;div class=&#39;base-text&#39; id=&#39;login-text&#39;&gt;
&lt;h3&gt;
&lt;em&gt;Ex Situ&lt;/em&gt;
Program progress login
&lt;/h3&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#39;modal-body&#39;&gt;
&lt;/div&gt;
Which versions of Ruby, Padrino, Sinatra, Rack, OS are you using? Did this work in previous versions?
Ruby 3.1.3
Padrino 0.15.2
Sinatra 3.0.5
Rack 2.2.5
Haml 6.1.1 (in case it's relevant).
(and worked like a charm in previous versions)
y viva padrino!
Thanks for reporting! Unfortunately that seems like a pretty critical bug, unfortunately that was able to sneak past our test coverage.
If @jkowens or any contributor has the time to investigate and submit a patch, I am happy to rush out a fix. Would be great if we could also add a regression test
Apologies gentlemen... you are indeed correct. The issue seems to be haml 6 (though disbaling html safety with a set and trying the !=
trick did not seem to work to fix the problem in haml code with a do
loop at the end - still getting entities).
I've deprecated to 5.2.2 for now and the system seems to be working as expected so, seriously... super impressed that 0.15.2 is rocking things and seems to be working for a pretty complex app. I'll try to update things to haml 6 over the next little while as I upgrade other things in the app from 4 years back. 8-// I'll repoen the ticket if anything in haml 6 is causing issues with tags.
Will kick the tires some more over the next few days... but, really... well done. Padrino does indeed ride again... =]
Excellent news, thanks again for testing, and glad that it was a known issue with HAML 6 with a straightforward workaround
Thanks again to you two for working on and nudging along this latest release
@wakatara thanks for testing all of this out 😄 I don't really have clear in mind what the Haml 6 changes mean for Sinatra/Padrino use. I was hopeful just using !=
was the answer. I wonder if you possibly found a Haml bug? Might be worth creating an issue over there.