[haml] Strange error with :javascript filter (For the last 5 hours :))

91 views
Skip to first unread message

drKreso

unread,
May 21, 2010, 8:03:08 PM5/21/10
to Haml
I get the error Filter "javascript" is not defined.

Ruby 1.9.1, Rails 2.3.5, Haml 3.0.4

Other filters are not working eather. (:plain for example). If I put
%script and "unindent" JQUERY, everything works fine.

Please help.



-content_for :titlebar do
Pregled učestalosti kvarova po rasvjetnim mjestima
-content_for :script do
=javascript_include_tag 'kvar_rasvjetno_mjesto.js'
:javascript
$(function() {
$("table.mainTable tr").click(function () {
id = $(this).attr("id");
prikaziRasvjetnoMjesto(id)
});
});
%span#view-izvjestaj
%table#ucestalostTable.mainTable
%thead
%tr.ui-widget-header
%th Broj kvarova
%th Oznaka
%th Tip stupa
%th Visina
%th Lokacija
%tbody
-@ucestalost_po_rasvjetnom_mjestu.each do |item|
%tr{:id => item.id}
%td= item.broj_kvarova
%td= item.oznaka
%td= item.tip_stupa_naziv
%td= item.visina
%td= item.ulica.lokacija
%br
%img{:src =>'/izvjestaji/
ucestalost_po_rasvjetnom_mjestu_graf' , :style =>'border:1px solid
#aabcca;'}

--
You received this message because you are subscribed to the Google Groups "Haml" group.
To post to this group, send email to ha...@googlegroups.com.
To unsubscribe from this group, send email to haml+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Nathan Weizenbaum

unread,
May 22, 2010, 6:55:08 PM5/22/10
to ha...@googlegroups.com
Can you reproduce this using Haml from the command line?

drKreso

unread,
May 22, 2010, 7:44:15 PM5/22/10
to Haml
Hey, thanks for response. How can I use it from the command line?

Best Regards,

Kreso
> > haml+uns...@googlegroups.com <haml%2Bunsu...@googlegroups.com>.
> > For more options, visit this group at
> >http://groups.google.com/group/haml?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "Haml" group.
> To post to this group, send email to ha...@googlegroups.com.
> To unsubscribe from this group, send email to haml+uns...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/haml?hl=en.

Nathan Weizenbaum

unread,
May 22, 2010, 7:49:26 PM5/22/10
to ha...@googlegroups.com
If you have the Haml gem installed, you'll also have a "haml" command-line utility. The simplest way to use it is to just run "haml", type in Haml code, and press Ctrl-D. Then it'll spit out the compiled HTML.

drKreso

unread,
May 22, 2010, 8:03:49 PM5/22/10
to Haml
kbojcic@kbojcic-laptop:~/gosjar$ haml
The program 'haml' is currently not installed. To run 'haml' please
ask your administrator to install the package 'libhaml-ruby1.8'

?
> > haml%2Bunsu...@googlegroups.com<haml%252Buns...@googlegroups.com>

Nathan Weizenbaum

unread,
May 22, 2010, 8:07:22 PM5/22/10
to ha...@googlegroups.com
How do you have Haml installed in your project?

drKreso

unread,
May 22, 2010, 8:09:30 PM5/22/10
to Haml
this 1.8 got me off the track, since I am using 1.9 ruby.
I've installed it via gem install. This is what I get (It works
perfectly I think)

kbojcic@kbojcic-laptop:~/gosjar$ haml
:javascript
$(function() {
$("table.mainTable tr").click(function () {
id = $(this).attr("id");
prikaziRasvjetnoMjesto(id)
});
});
<script type='text/javascript'>
//<![CDATA[
$(function() {
$("table.mainTable tr").click(function () {
id = $(this).attr("id");
prikaziRasvjetnoMjesto(id)
});
});
//]]>
</script>
kbojcic@kbojcic-laptop:~/gosjar$
> > > > haml%2Bunsu...@googlegroups.com<haml%252Buns...@googlegroups.com>
> > <haml%252Buns...@googlegroups.com<haml%25252Bun...@googlegroups.com>
>
> > > > >.
> > > > > > For more options, visit this group at
> > > > > >http://groups.google.com/group/haml?hl=en.
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Haml" group.
> > > > > To post to this group, send email to ha...@googlegroups.com.
> > > > > To unsubscribe from this group, send email to
> > > > haml+uns...@googlegroups.com<haml%2Bunsu...@googlegroups.com><
> > haml%2Bunsu...@googlegroups.com<haml%252Buns...@googlegroups.com>
> > >.

drKreso

unread,
May 22, 2010, 8:12:03 PM5/22/10
to Haml
But "same" thing over the firefox I get

Haml::Error in Izvjestaji#ucestalost_po_rasvjetnom_mjestu

Showing app/views/izvjestaji/ucestalost_po_rasvjetnom_mjestu.haml
where line #5 raised:

Filter "javascript" is not defined.

Extracted source (around line #5):

2: Pregled učestalosti kvarova po rasvjetnim mjestima
3: -content_for :script do
4: =javascript_include_tag 'kvar_rasvjetno_mjesto.js'
5: :javascript
6: $(function() {
7: $("table.mainTable tr").click(function () {
8: id = $(this).attr("id");
> > > > > > >  Pregled uèestalosti kvarova po rasvjetnim mjestima

Nathan Weizenbaum

unread,
May 22, 2010, 8:25:32 PM5/22/10
to ha...@googlegroups.com
I'm guessing that you have an old Haml installation in your Rails app. If you put "= h Haml.version.inspect" in your template, what do you get?

drKreso

unread,
May 22, 2010, 8:29:03 PM5/22/10
to Haml
{:major=>3, :minor=>0, :teeny=>4, :name=>"Classy
Cassidy", :number=>"3.0.4", :string=>"3.0.4 (Classy Cassidy)"}
> > > > > > > haml%2Bunsu...@googlegroups.com<haml%252Buns...@googlegroups.com>
> > <haml%252Buns...@googlegroups.com<haml%25252Bun...@googlegroups.com>
>
> > > > > <haml%252Buns...@googlegroups.com<haml%25252Bun...@googlegroups.com>
> > <haml%25252Bun...@googlegroups.com<haml%2525252Bu...@googlegroups.com>
>
> > > > > > > >.
> > > > > > > > > For more options, visit this group at
> > > > > > > > >http://groups.google.com/group/haml?hl=en.
>
> > > > > > > > --
> > > > > > > > You received this message because you are subscribed to the
> > Google
> > > > > Groups
> > > > > > > "Haml" group.
> > > > > > > > To post to this group, send email to ha...@googlegroups.com.
> > > > > > > > To unsubscribe from this group, send email to
> > > > > > > haml+uns...@googlegroups.com<haml%2Bunsu...@googlegroups.com>
> > <haml%2Bunsu...@googlegroups.com<haml%252Buns...@googlegroups.com>
> > ><
> > > > > haml%2Bunsu...@googlegroups.com<haml%252Buns...@googlegroups.com>
> > <haml%252Buns...@googlegroups.com<haml%25252Bun...@googlegroups.com>
>
> > > > > >.

Nathan Weizenbaum

unread,
May 22, 2010, 8:37:07 PM5/22/10
to ha...@googlegroups.com
Very strange. Do other filters work?

drKreso

unread,
May 22, 2010, 8:39:19 PM5/22/10
to Haml
Nope. I've tried :plain and :markdown - same result.

On May 23, 2:37 am, Nathan Weizenbaum <nex...@gmail.com> wrote:
> Very strange. Do other filters work?
>
> > > > > > > <haml%252Buns...@googlegroups.com<haml%25252Bun...@googlegroups.com>
> > <haml%25252Bun...@googlegroups.com<haml%2525252Bu...@googlegroups.com>
>
> > > > <haml%25252Bun...@googlegroups.com<haml%2525252Bu...@googlegroups.com>
> > <haml%2525252Bu...@googlegroups.com<haml%252525252B...@googlegroups.com>
>
> > > > > > > > > >.
> > > > > > > > > > > For more options, visit this group at
> > > > > > > > > > >http://groups.google.com/group/haml?hl=en.
>
> > > > > > > > > > --
> > > > > > > > > > You received this message because you are subscribed to the
> > > > Google
> > > > > > > Groups
> > > > > > > > > "Haml" group.
> > > > > > > > > > To post to this group, send email to ha...@googlegroups.com
> > .
> > > > > > > > > > To unsubscribe from this group, send email to
> > > > > > > > > haml+uns...@googlegroups.com<haml%2Bunsu...@googlegroups.com>
> > <haml%2Bunsu...@googlegroups.com<haml%252Buns...@googlegroups.com>
>
> > > > <haml%2Bunsu...@googlegroups.com<haml%252Buns...@googlegroups.com>
> > <haml%252Buns...@googlegroups.com<haml%25252Bun...@googlegroups.com>
>
> > > > ><
> > > > > > > haml%2Bunsu...@googlegroups.com<haml%252Buns...@googlegroups.com>
> > <haml%252Buns...@googlegroups.com<haml%25252Bun...@googlegroups.com>
>
> > > > <haml%252Buns...@googlegroups.com<haml%25252Bun...@googlegroups.com>
> > <haml%25252Bun...@googlegroups.com<haml%2525252Bu...@googlegroups.com>
>
> > > > > > > >.
> > > > > > > > > > For more options, visit this group athttp://
> > > > > > > > > groups.google.com/group/haml?hl=en.
>
> > > > > > > > > --
> > > > > > > > > You received this message because you are subscribed to the
> > > > Google
> > > > > > > Groups
> > > > > > > > > "Haml" group.
> > > > > > > > > To post to this group, send email to ha...@googlegroups.com.
> > > > > > > > > To unsubscribe from this group, send email to
> > > > > > > > > haml+uns...@googlegroups.com<haml%2Bunsu...@googlegroups.com>
> > <haml%2Bunsu...@googlegroups.com<haml%252Buns...@googlegroups.com>
>
> > > > <haml%2Bunsu...@googlegroups.com<haml%252Buns...@googlegroups.com>
> > <haml%252Buns...@googlegroups.com<haml%25252Bun...@googlegroups.com>
>
> > > > ><
> > > > > > > haml%2Bunsu...@googlegroups.com<haml%252Buns...@googlegroups.com>
> > <haml%252Buns...@googlegroups.com<haml%25252Bun...@googlegroups.com>
>
> > > > <haml%252Buns...@googlegroups.com<haml%25252Bun...@googlegroups.com>
> > <haml%25252Bun...@googlegroups.com<haml%2525252Bu...@googlegroups.com>
>
> > > > > > > >.
> > > > > > > > > For more options, visit this group at
> > > > > > > > >http://groups.google.com/group/haml?hl=en.
>
> > > > > > > > --
> > > > > > > > You received this message because you are subscribed to the
> > Google
> > > > Groups
> > > > > > > "Haml" group.
> > > > > > > > To post to this group, send email to ha...@googlegroups.com.
> > > > > > > > To unsubscribe from this group, send email to
> > > > > > > haml+uns...@googlegroups.com<haml%2Bunsu...@googlegroups.com>
> > <haml%2Bunsu...@googlegroups.com<haml%252Buns...@googlegroups.com>
> > ><
>
> ...
>
> read more »

Nathan Weizenbaum

unread,
May 23, 2010, 12:45:02 AM5/23/10
to ha...@googlegroups.com
Very weird. What happens if you add "= h Haml::Filters.defined.inspect"?
Message has been deleted

drKreso

unread,
May 23, 2010, 5:09:44 AM5/23/10
to Haml
I get this:

{"plain"=>Haml::Filters::Plain,
"javascript"=>Haml::Filters::Javascript, "css"=>Haml::Filters::Css,
"cdata"=>Haml::Filters::Cdata, "escaped"=>Haml::Filters::Escaped,
"ruby"=>Haml::Filters::Ruby, "preserve"=>Haml::Filters::Preserve,
"sass"=>Haml::Filters::Sass, "erb"=>Haml::Filters::ERB,
"textile"=>Haml::Filters::Textile, "redcloth"=>Haml::Filters::Textile,
"markdown"=>Haml::Filters::Markdown, "maruku"=>Haml::Filters::Maruku}

On May 23, 6:45 am, Nathan Weizenbaum <nex...@gmail.com> wrote:
> Very weird. What happens if you add "= h Haml::Filters.defined.inspect"?
>
> > > > > > <haml%25252Bun...@googlegroups.com<haml%2525252Bu...@googlegroups.com>
> > <haml%2525252Bu...@googlegroups.com<haml%252525252B...@googlegroups.com>
>
> > > > <haml%2525252Bu...@googlegroups.com<haml%252525252B...@googlegroups.com>
> > <haml%252525252B...@googlegroups.com<haml%25252525252...@googlegroups.com>
>
> > > > > > > > > > > >.
> > > > > > > > > > > > > For more options, visit this group at
> > > > > > > > > > > > >http://groups.google.com/group/haml?hl=en.
>
> > > > > > > > > > > > --
> > > > > > > > > > > > You received this message because you are subscribed to
> > the
> > > > > > Google
> > > > > > > > > Groups
> > > > > > > > > > > "Haml" group.
> > > > > > > > > > > > To post to this group, send email to
> > ha...@googlegroups.com
> > > > .
> > > > > > > > > > > > To unsubscribe from this group, send email to
>

Nathan Weizenbaum

unread,
May 23, 2010, 7:29:56 AM5/23/10
to ha...@googlegroups.com
This just keeps getting weirder and weirder. How about this: try adding '= h Haml::Engine.new(":javascript\n  test").render' to your template and see what you get.

drKreso

unread,
May 23, 2010, 4:08:48 PM5/23/10
to Haml
For that I get:

"Filter "javascript" is not defined."

On May 23, 1:29 pm, Nathan Weizenbaum <nex...@gmail.com> wrote:
> This just keeps getting weirder and weirder. How about this: try adding '= h
> Haml::Engine.new(":javascript\n  test").render' to your template and see
> what you get.
>

Nathan Weizenbaum

unread,
May 23, 2010, 11:16:14 PM5/23/10
to ha...@googlegroups.com
Very very strange. How about this: '= h Haml::Filters.defined["javascript"].inspect'

drKreso

unread,
May 24, 2010, 1:35:25 AM5/24/10
to Haml
Haml::Filters::Javascript

I've tried it on my production machine - I get same error. So I don't
think is't machine specific.

Kreso

On May 24, 5:16 am, Nathan Weizenbaum <nex...@gmail.com> wrote:
> Very very strange. How about this: '= h
> Haml::Filters.defined["javascript"].inspect'
>

Nathan Weizenbaum

unread,
May 24, 2010, 4:48:19 AM5/24/10
to ha...@googlegroups.com
All right, I think I'm going to need to go more in-depth. Can you send me a tarball of the smallest Rails app you can make that demonstrates the issue?

drKreso

unread,
Jun 3, 2010, 6:11:34 PM6/3/10
to Haml
In my enviroment I have

require "lib/string"


lib/string.rb is like this:

#encoding: utf-8
class String
def downcase
self.tr 'QWERTZUIOPASDFGHJKLYXCVBNMŠĐŽČĆ',
'qwertzuiopasdfghjklyxcvbnmšđžčć'
end
end

I need it to cast to lower case for special (Croatian characters).
That is causing the error. If I remove that require, it works as
expected.
Do you have any ideas why is this error ocurring?

Kresimir Bojcic


On May 24, 7:35 am, drKreso <kresimir.boj...@gmail.com> wrote:
> Haml::Filters::Javascript
>
> I've tried it on my production machine - I get sameerror. So I don't
> think is't machine specific.
>
> Kreso
>
> On May 24, 5:16 am, Nathan Weizenbaum <nex...@gmail.com> wrote:
>
> > Very verystrange. How about this: '= h
> > > > > > > > Verystrange. Do other filters work?
>
> > > > > > > > On Sat, May 22, 2010 at 5:29 PM, drKreso <
> > > kresimir.boj...@gmail.com>
> > > > > > > wrote:
> > > > > > > > > {:major=>3, :minor=>0, :teeny=>4, :name=>"Classy
> > > > > > > > > Cassidy", :number=>"3.0.4", :string=>"3.0.4 (Classy Cassidy)"}
>
> > > > > > > > > On May 23, 2:25 am, Nathan Weizenbaum <nex...@gmail.com>
> > > wrote:
> > > > > > > > > > I'm guessing that you have an old Haml installation in your
> > > Rails
> > > > > > > app. If
> > > > > > > > > > you put "= h Haml.version.inspect" in your template, what do
> > > you
> > > > > get?
>
> > > > > > > > > > On Sat, May 22, 2010 at 5:12 PM, drKreso <
> > > > > kresimir.boj...@gmail.com>
> > > > > > > > > wrote:
> > > > > > > > > > > But "same" thing over the firefox I get
>
> > > > > > > > > > >  Haml::Errorin Izvjestaji#ucestalost_po_rasvjetnom_mjestu
> > > > > > > > > > > > > > > > > > I get theerrorFilter "javascript" is not
> ...
>
> read more »

drKreso

unread,
Jun 3, 2010, 6:51:22 PM6/3/10
to Haml
I've got it figured out, there is Unicode gem. When I use it, it'a all
good

require 'unicode'

#encoding: utf-8
class String
def downcase
Unicode::downcase(self)
end
end


Thanks for help.

Kresimir

On Jun 4, 12:11 am, drKreso <kresimir.boj...@gmail.com> wrote:
> In my enviroment I have
>
>   require "lib/string"
>
> lib/string.rb is like this:
>
> #encoding: utf-8
> class String
>   def downcase
>     self.tr 'QWERTZUIOPASDFGHJKLYXCVBNMŠĐŽČĆ',
>             'qwertzuiopasdfghjklyxcvbnmšđžčć'
>   end
> end
>
> I need it to cast to lower case for special (Croatian characters).
> That is causing theerror. If I remove that require, it works as
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages