haml / haml Goto Github PK
View Code? Open in Web Editor NEWHTML Abstraction Markup Language - A Markup Haiku
Home Page: http://haml.info
License: MIT License
HTML Abstraction Markup Language - A Markup Haiku
Home Page: http://haml.info
License: MIT License
Haml breaks current edge rails with error;
undefined method `first' for #Pathname:/public/stylesheets/sass
This can be fixed by changing all the paths in sass/plugin/rails.rb from RAILS_ROOT + '/public/stylesheets/sass'
to "#{RAILS_ROOT}/public/stylesheets/sass"
or even "#{Rails.root}/public/stylesheets/sass"
since RAILS_ROOT
is getting deprecated.
This is something that got introduced in 2.1.0, because I didn't have this issue before:
SASS:
:color transparent //:image url(../images/menu_gray_arrow.png) :image url(../images/navigation/menu_arrows_supplier.png)
Outputs in browser:
TypeError: can't convert nil into String
...and in the containing CSS:
/* TypeError: can't convert nil into String Backtrace: /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/attr_node.rb:38:in `<<' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/attr_node.rb:38:in `to_s' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/attr_node.rb:37:in `each' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/attr_node.rb:37:in `to_s' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/rule_node.rb:77:in `to_s' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/rule_node.rb:77:in `map' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/rule_node.rb:77:in `to_s' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/rule_node.rb:88:in `to_s' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/rule_node.rb:87:in `each' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/rule_node.rb:87:in `to_s' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/rule_node.rb:88:in `to_s' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/rule_node.rb:87:in `each' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/rule_node.rb:87:in `to_s' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/rule_node.rb:88:in `to_s' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/rule_node.rb:87:in `each' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/rule_node.rb:87:in `to_s' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/rule_node.rb:88:in `to_s' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/rule_node.rb:87:in `each' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/rule_node.rb:87:in `to_s' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/node.rb:36:in `to_s' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/node.rb:32:in `each' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/tree/node.rb:32:in `to_s' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/engine.rb:104:in `render' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/plugin.rb:75:in `update_stylesheet' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/plugin.rb:60:in `update_stylesheets' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/plugin.rb:55:in `each' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/plugin.rb:55:in `update_stylesheets' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/plugin.rb:53:in `each' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/plugin.rb:53:in `update_stylesheets' /Library/Ruby/Gems/1.8/gems/haml-2.1.0/rails/../lib/sass/plugin/rails.rb:16:in `process' /Users/jonas/Development/m2m/jobbix/vendor/rails/actionpack/lib/action_controller/base.rb:391:in `process' /Users/jonas/Development/m2m/jobbix/vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call' /Users/jonas/Development/m2m/jobbix/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:433:in `call' /Users/jonas/Development/m2m/jobbix/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:88:in `dispatch_without_newrelic' /Users/jonas/.gem/ruby/1.8/gems/newrelic_rpm-2.8.9/lib/new_relic/agent/instrumentation/dispatcher_instrumentation.rb:44:in `dispatch' /Users/jonas/Development/m2m/jobbix/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:111:in `_call' /Users/jonas/Development/m2m/jobbix/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:82:in `initialize' /Users/jonas/.gem/ruby/1.8/gems/rack-1.0.0/lib/rack/head.rb:9:in `call' /Users/jonas/.gem/ruby/1.8/gems/rack-1.0.0/lib/rack/head.rb:9:in `call' /Users/jonas/.gem/ruby/1.8/gems/rack-1.0.0/lib/rack/methodoverride.rb:24:in `call' /Users/jonas/Development/m2m/jobbix/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in `call' /Users/jonas/Development/m2m/jobbix/vendor/rails/actionpack/lib/action_controller/rewindable_input.rb:25:in `call' /Users/jonas/Development/m2m/jobbix/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb:122:in `call' /Users/jonas/Development/m2m/jobbix/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call' /Users/jonas/Development/m2m/jobbix/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache' /Users/jonas/Development/m2m/jobbix/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in `cache' /Users/jonas/Development/m2m/jobbix/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in `call' /Users/jonas/Development/m2m/jobbix/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call' /Users/jonas/Development/m2m/jobbix/vendor/rails/actionpack/lib/action_controller/reloader.rb:9:in `call' /Users/jonas/Development/m2m/jobbix/vendor/rails/actionpack/lib/action_controller/failsafe.rb:11:in `call' /Users/jonas/.gem/ruby/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `call' /Users/jonas/.gem/ruby/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `synchronize' /Users/jonas/.gem/ruby/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `call' /Users/jonas/Development/m2m/jobbix/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:106:in `call' /Users/jonas/Development/m2m/jobbix/vendor/rails/railties/lib/rails/rack/static.rb:31:in `call' /Users/jonas/.gem/ruby/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:46:in `call' /Users/jonas/.gem/ruby/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:40:in `each' /Users/jonas/.gem/ruby/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:40:in `call' /Users/jonas/Development/m2m/jobbix/vendor/rails/railties/lib/rails/rack/log_tailer.rb:17:in `call' /Users/jonas/.gem/ruby/1.8/gems/rack-1.0.0/lib/rack/content_length.rb:13:in `call' /Users/jonas/.gem/ruby/1.8/gems/rack-1.0.0/lib/rack/chunked.rb:15:in `call' /Users/jonas/.gem/ruby/1.8/gems/rack-1.0.0/lib/rack/handler/mongrel.rb:61:in `process' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run' /Users/jonas/.gem/ruby/1.8/gems/rack-1.0.0/lib/rack/handler/mongrel.rb:34:in `run' /Users/jonas/Development/m2m/jobbix/vendor/rails/railties/lib/commands/server.rb:111 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' script/server:3 */ body:before { white-space: pre; font-family: monospace; content: "TypeError: can't convert nil into String"; }
Works:
SASS:
:color transparent :image url(../images/navigation/menu_arrows_supplier.png)
I don't see why this line is any different than any other commented lines, i.e. leading @//@?
on haml 2.0.9
```
require ‘haml/engine’
template_broken = ’
:javascript
– [1, 2, 3, 4].each do |item|
= “Hey #{item}”
’
puts Haml::Engine.new(template_broken).to_html
```
causes
```
(haml):3:in `to_html’: undefined local variable or method `item’ for # (NameError)
from c:/ruby/lib/ruby/gems/1.8/gems/haml-2.0.9/lib/haml/engine.rb:149:in `to_html’
from c:/ruby/lib/ruby/gems/1.8/gems/haml-2.0.9/lib/haml/engine.rb:149:in `instance_eval’
from c:/ruby/lib/ruby/gems/1.8/gems/haml-2.0.9/lib/haml/engine.rb:149:in `to_html’
from haml.rb:9
```
however, this works just fine. notice that I replaced :javascript filter with regular %script tag.
```
require ‘haml/engine’
template_broken = ’
%script
– [1, 2, 3, 4].each do |item|
= “Hey #{item}”
’
puts Haml::Engine.new(template_broken).to_html
```
=foo(!var)
color= !var
.foo
+foo(rgb(1,255,127))
raises a parse error:
Syntax error on line 5: Expected rparen token, was end of text.
Plugins are loaded after gems, so when haml (a gem) checks ActionView::Base.xss_safe?, it returns false (the rails 2.3.5 default value). After this, the rails_xss plugin is loaded and it modifies ActionView::Base.xss_safe? to return true, but it's too late.
I'm using haml 2.2.6, with the option html_escape activated.
I'm expecting that the two following lines are similar:
You & me
You & #{'me'}
But it's not the case. For the second line, the & is escaped, so the result is:
You &amp; me
The documentation seems to match my expectation (only the string inperpolation should be escaped), but maybe, it's the normal behaviour. In that case, can I suggest to make it clear in the doc?
The Haml reference says "Literal textarea and pre tags automatically preserve their content." by converting newlines "to the XHTML whitespace escape code, ". However, during some experiments of mine, this doesn't seem correct.
%outer
%pre
12345
12345
The above Haml outputs as:
<outer>
<pre>12345
12345</pre>
</outer>
(note: it appears Markdown isn't liking the pre tag up there. Would appreciate learning how to fix that.)
This is quite incorrect, both per the reference and per the display of the above code. The second line suffers from extra visible whitespace to the left.
This also applies to the textarea element, and likely whatever other elements Haml deems to be whitespace-sensitive. I am using the Poweful Penny release with Ruby on Rails.
This sass:
h2
display:none
font-weight:bold
Generates no error and no css.
Currently, Sass insists that all indentation in a file be completely consistent. However, this means that it's not possible to get rid of a line without re-indenting everything beneath it, which is annoying when debugging code.
We want to allow variable indentation as long as it's unambiguous. For example, the following:
foo
bar
baz
bang: bop
boom: bip
should be the same as
foo
bar
baz
bang: bop
boom: bip
However, wherever we currently would raise an error, a warning should be printed.
Ambiguous cases should still be marked as erroneous. For example, the following
foo
up: four spaces
down: two spaces
should raise an error on the "down: two spaces" line.
This is conceptually the same as issue #28, but since Sass and Haml don't share parser code, they're listed separately.
Guys, I wrote the following markup:
%a(href="#") All
But it is raising an error. I could fix that writing:
%a(href="#") All
I had to escape the "#" character. I think that it is an error and maybe it's about a bad parsing in the interpolation feature. Maybe the parser is thinking that I am trying to interpolate something just because i used the "#" character. You could interpolate something just if it is inside a #{...}, and not when you find a #.
What do you think?
Reported here:
http://groups.google.com/group/compass-users/msg/f6360f7669651271?hl=en
removing the sass cache caused the bug to go away. The problem is due to the cached file referencing an import that no longer exists.
Compare the following two snippets of code.
%one
%two
%three
%four{:attr => ""}
This renders as:
This seems to be correct. The second snippet of code only adds a single apostrophe to the attribute:
%one
%two
%three
%four{:attr => "'"}
However, this renders as:
There is extraneous spacing inside the 'four' tag, which seems to be equal to the indentation amount of the 'four' tag. Experimentation shows that the deeper into the nesting 'four' is, the more spaces crop up. This issue does not appear when using the parenthesized list () instead of the Ruby hash {}. I am using the Powerful Penny release with Ruby on Rails.
Colors printed by SassScript when the output format is :compressed
should be printed in the smallest possible format. This means the shortest of "#nnnnnn", "#nnn", and the HTML4 color name, depending on what's available.
Log:
Processing ApplicationController# (for ::1 at 2009-06-02 20:03:17) [GET]
Parameters: {"action"=>"index", "controller"=>"home"}
ActionView::TemplateError (undefined method `filename' for #ActionView::Template:0x3be5854) in /Users/jonas/Development/jobbix/app/views/home/index.html.haml:
haml (2.1.0) [v] lib/haml/template/plugin.rb:15:in `compile'
haml (2.1.0) [v] lib/sass/plugin/rails.rb:19:in `process'
/opt/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/opt/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/opt/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/opt/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
/opt/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/opt/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
/opt/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
/opt/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
/opt/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
/opt/local/lib/ruby/1.8/webrick/server.rb:82:in `start'
If you try to call a sass function as a mixin argument you get a syntax error.
Example:
=foo(!a)
div
:background-color = !a
+foo(rgb(255,255,0))
This should behave just like the :javascript
filter, except with <style>
tags instead of <script>
tags.
Assume the following source CSS:
div .warning {
color: #d21a19; }
span .debug {
cursor: crosshair;}
div .debug {
cursor: default; }
css2sass 2.1.0 results in:
div
.warning
:color #d21a19
.debug
:cursor default
span .debug
:cursor crosshair
Of course, this results in CSS like so:
div .warning {
color: #d21a19; }
div .debug {
cursor: default; }
span .debug {
cursor: crosshair; }
Since the selectors have the same specificity, order is important, and css2sass seems to prefer to nesting level over origin order. The sass produced should have been:
div
.warning
:color #d21a19
span
.debug
:cursor crosshair
div
.debug
:cursor default
This filter should be the same as :plain
, except that it should interpret #{}
within it as literal text, not interpolation. For example,
:no_interpolation
foo #{bar} baz
should compile to
foo #{bar} baz
The Rails XSS protection is applied twice (or more) when rendering a partial:
= render "my_partial"
The string returned by render is not marked as html_safe?, so when HAML escapes it again. When I was playing with haml and rails XSS protection, I fixed that by adding this line: http://github.com/nono/haml/blob/rails_xss/lib/haml/precompiler.rb#L102. I'm sure you'll find a cleaner way to do that.
With the universal interpolation implementation, I very often like to start the line with #{} in order to add stuff to the end.
For example
```
.contact_info
#{person.name}’s Address
Something else…
```
This currently fails.
Would be very nice if the precompiler could recognize #{ as a starting character and switch the line mode to normal interpolation (“==” style).
Not sure if this is an issue with HAML code or with the Rails code.
Rails: 2.3.4
Haml: 2.2.4
A gist containing more information
The evil line from my template:
- form_for @user, :html => {:id => 'reset-password-end-form', :method => :put}, :url => password_reset_path do |f|
The exact errors reported were:
/home/kojul/railsigti/app/views/password_resets/edit.haml:22: syntax error, unexpected kENSURE, expecting kEND
/home/kojul/railsigti/app/views/password_resets/edit.haml:24: syntax error, unexpected $end, expecting kEND
Note the error messages... my template is only 20 lines, so this occurs after some of it has been processed.
I knew I didn't mis-indent anything, so I went looking around and found nothing on the issue.
Figured it out though.
Look at the id tag declaration... there's a "-end" in it. Changing it to "reset-passwordend-form" worked as did anything that didn't have specifically an "-end" in it.
It doesn't matter if it's the id tag either... it could be any tag and it just requires a "-end" in it to mess everything up.
As I said at the top, I'm not sure if this is an issue with the form_for helper or with something within the HAML code itself.
Run rip install git://github.com/nex3/haml.git
.
Now, try and require Haml. It fails as the Version class tries to look for the VERSION file in the root directory of the Haml package. Uh oh. Rip doesn't keep anything around other than the lib directory of the gem so there is no VERSION file.
/ Work fine
%ul
- array.each do |x|
%li= x
/ Fails with a compile error
%ul
- array.each do | x |
%li= x
See chriseppstein/compass-colors. Only the Sass extensions (and corresponding HSL code) should be integrated - the color themes should be left there.
Most of the work for this will probably be in testing and documentation. The compass-colors tests aren't as complete as I'd like... it would be good to have tests for each of the new Sass functions. And the new functions should be documented in the YARD style of the rest of the Sass functions.
Hi,
I’m getting very strange issue under above configuration. [The similar issue](http://code.google.com/p/phusion-passenger/issues/detail?id=233) was reported on Passenger’s issue tracker but it was selected as invalid (I don’t know why).
I can’t locate where the issue is :(
ArgumentError in Home#index Showing app/views/home/index.html.haml where line # raised: invalid byte sequence in US-ASCII Extracted source (around line #): RAILS_ROOT: /mnt/hgfs/test Application Trace | Framework Trace | Full Trace /usr/local/lib/ruby/gems/1.9.1/gems/haml-2.0.9/lib/haml/engine.rb:88:in `initialize' /usr/local/lib/ruby/gems/1.9.1/gems/haml-2.0.9/lib/haml/template/plugin.rb:21:in `new' /usr/local/lib/ruby/gems/1.9.1/gems/haml-2.0.9/lib/haml/template/plugin.rb:21:in `compile' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_view/template_handler.rb:11:in `call' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_view/renderable.rb:19:in `compiled_source' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_view/renderable.rb:70:in `compile!' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_view/renderable.rb:61:in `compile' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_view/renderable.rb:28:in `render' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_view/template.rb:194:in `render_template' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_view/base.rb:260:in `render' /usr/local/lib/ruby/gems/1.9.1/gems/haml-2.0.9/lib/haml/helpers/action_view_mods.rb:14:in `render_with_haml' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/base.rb:1241:in `render_for_file' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/base.rb:937:in `render' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/benchmarking.rb:51:in `block in render_with_benchmark' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext/benchmark.rb:17:in `block in ms' /usr/local/lib/ruby/1.9.1/benchmark.rb:308:in `realtime' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext/benchmark.rb:17:in `ms' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/benchmarking.rb:51:in `render_with_benchmark' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/base.rb:1317:in `default_render' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/base.rb:1323:in `perform_action' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/filters.rb:617:in `call_filters' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/filters.rb:610:in `perform_action_with_filters' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/benchmarking.rb:68:in `block in perform_action_with_benchmark' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext/benchmark.rb:17:in `block in ms' /usr/local/lib/ruby/1.9.1/benchmark.rb:308:in `realtime' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext/benchmark.rb:17:in `ms' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/rescue.rb:160:in `perform_action_with_rescue' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/flash.rb:141:in `perform_action_with_flash' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/base.rb:523:in `process' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/filters.rb:606:in `process_with_filters' /usr/local/lib/ruby/gems/1.9.1/gems/haml-2.0.9/lib/sass/plugin/rails.rb:19:in `process' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/base.rb:391:in `process' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/base.rb:386:in `call' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/routing/route_set.rb:433:in `call'
Every file has utf-8 encoding.
When I run this website under the webrick it works fine.
currently only double quotes will highlight as a string, single quotes are just as valid and should be highlighted also.
Allow multiple filters to be composed in Haml - first apply the rightmost one, then work your way left. For example,
:preserve:escaped
<foo>
<bar />
</foo>
should produce
<foo>
 <bar />
</foo>
If I have a comment node that looks like:
/**
This the first line. There is an empty line below me.
This is the third line
And I do call .value on that CommentNode, I get this:
"This the first line. There is an empty line below me.\nThis is the third line"
instead of
"This the first line. There is an empty line below me.\n\nThis is the third line"
At the beginning of the file, // encoding: name
should have an effect as close as possible to that of Ruby's # encoding: name
declarations.
Note that this is currently not applicable to Haml because Haml templates are usually loaded externally to Haml. See #38.
Raising an issue to open discussion. I don't know either Haml or Mustache codebase well enough to start work on this straight away.
Chris Wanstrath (aka defunkt) has just released a great template engine 'Mustache' based on Google's CTemplate.
As a templating solution Mustache is great, but I don't think anybody can deny the cleanness and readability of HAML code.
I don't think it would be too difficult to modify HAML to support Mustache-like generation. This could even be an option on HAML which could be turned on an off.
I'm thinking something like:
a) no ruby code evalution, so (-, =) no longer evaluate.
b) new syntax {{#boolean}}
, {{helper}}
, {{{non_interpreted_helper}}}
can be used anywhere in the code(ie as nodes and inside text nodes) and will be evaluated as expected.
c) integration into rails could be very simple. All template logic now goes into the helpers files.
If you write a similar construction:
-# Metatags -# Charset %meta{:charset => 'utf-8'} -# Keywords %meta{:name => 'keyword', :content => 'words'}
get this html
<meta charset="utf-8"></meta> <meta name="keywords" content="words"></meta>
Meta should not have a closing tag
Something like the following should work:
/**
* Stuff
* More stuff
*/
This is something to think about when implementing CSS-style syntax.
Impl'd in halorgium/haml@1e49eb1
This should be legal:
http://gist.github.com/129758
But results in the following error:
Syntax error on line 5: The line was indented 6 levels deeper than the previous line.
Currently, Haml insists that all indentation in a file be completely consistent. However, this means that it's not possible to get rid of a line without re-indenting everything beneath it, which is annoying when debugging code.
We want to allow variable indentation as long as it's unambiguous. For example, the following:
%foo
%bar
%baz
bang
boom
should be the same as
%foo
%bar
%baz
bang
boom
However, wherever we currently would raise an error, a warning should be printed.
Ambiguous cases should still be marked as erroneous. For example, the following
%foo
up four spaces
down two spaces
should raise an error on the "down two spaces" line.
This is conceptually the same as issue #29, but since Sass and Haml don't share parser code, they're listed separately.
Breaks:
+ .description :color #000
Works:
+ .description :color #000
But this works:
> .description :color #000
and
> .description :color #000
Should maybe be more consistent?
When running with :ugly => true
and :format => :html4
or :format => :html5
, don't output closing tags that aren't required. A list of closing tags that aren't required is given here. Note that sometimes these closing tags should be printed. In particular, if the closing tag isn't followed immediately by an opening or tag - one generated by Haml - output it. For example, in all of the following situations:
%p foo
<strong>bar</strong>
%p foo
= "<strong>bar</strong>"
%p foo
:plain
<strong>bar</strong>
the closing tag should be preserved.
Warning: it's likely to be very difficult to figure out exactly when you may and may not output a closing tag.
This is probably an issue in all sorts of Sass frameworks... we might want to make the solution more general-purpose.
Color objects need an alpha layer and we need to build corresponding support for rgba() and hsla() functions.
Color objects that have 100% opacity shouldn't output as rgba(), of course.
%p This is a test of the multi-line |
system. |
%p This should be part of a separate p |
element. |
outputs:
This is a test of the multi-line system.
%p This should be part of a separate p element.
While
%p This is a test of the multi-line |
system. |
%p This should be part of a separate p element.
works correctly
HAML template files should be able to set the encoding for the file on the first line, similar to normal ruby. (or at least have some way of specifying the encoding per file.)
-# encoding: utf-8
%p
Éat thís!
For example,
=box-shadow(!value)
-moz-box-shadow= !value
-webkit-box-shadow= !value
+box-shadow(0 1px 3px rgba(0, 0, 0, 0.5))
should list both line 2 and line 5 in the backtrace. This should integrate with the existing import backtrace.
Would be nice if html2haml reported line numbers when failing on bad encodings, so that problems can be tracked down quicker.
Currently,
$ html2haml my_utf8_file.html my_utf8_file.haml
=> invalid byte sequence in UTF-8
When running with :ugly => true
and :format => :html4
or :format => :html5
, don't put quotes around attributes that don't require them. See the HTML4 spec for a precise definition of when they're not required.
This Sass file
// Working comment
@media screen, projection
// Not working comment
body
color: green
causes this error:
/*
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.+
Backtrace:
/Library/Ruby/Gems/1.8/gems/haml-2.1.0/lib/sass/tree/directive_node.rb:39:in `to_s'
/Library/Ruby/Gems/1.8/gems/haml-2.1.0/lib/sass/tree/directive_node.rb:21:in `each'
/Library/Ruby/Gems/1.8/gems/haml-2.1.0/lib/sass/tree/directive_node.rb:21:in `to_s'
/Library/Ruby/Gems/1.8/gems/haml-2.1.0/lib/sass/tree/node.rb:36:in `to_s'
/Library/Ruby/Gems/1.8/gems/haml-2.1.0/lib/sass/tree/node.rb:32:in `each'
/Library/Ruby/Gems/1.8/gems/haml-2.1.0/lib/sass/tree/node.rb:32:in `to_s'
/Library/Ruby/Gems/1.8/gems/haml-2.1.0/lib/sass/engine.rb:104:in `render'
/Library/Ruby/Gems/1.8/gems/haml-2.1.0/lib/sass/plugin.rb:75:in `update_stylesheet'
/Library/Ruby/Gems/1.8/gems/haml-2.1.0/lib/sass/plugin.rb:60:in `update_stylesheets'
/Library/Ruby/Gems/1.8/gems/haml-2.1.0/lib/sass/plugin.rb:55:in `each'
/Library/Ruby/Gems/1.8/gems/haml-2.1.0/lib/sass/plugin.rb:55:in `update_stylesheets'
/Library/Ruby/Gems/1.8/gems/haml-2.1.0/lib/sass/plugin.rb:53:in `each'
/Library/Ruby/Gems/1.8/gems/haml-2.1.0/lib/sass/plugin.rb:53:in `update_stylesheets'
/Library/Ruby/Gems/1.8/gems/haml-2.1.0/lib/sass/plugin/rails.rb:16:in `process'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/base.rb:391:in `process'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/base.rb:386:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/routing/route_set.rb:433:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:88:in `dispatch'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:111:in `_call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:82:in `initialize'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/query_cache.rb:29:in `call'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/query_cache.rb:29:in `call'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/query_cache.rb:9:in `cache'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/query_cache.rb:28:in `call'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/head.rb:9:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/methodoverride.rb:24:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/params_parser.rb:15:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/rewindable_input.rb:25:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/session/cookie_store.rb:93:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/reloader.rb:9:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/failsafe.rb:11:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/lock.rb:11:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/lock.rb:11:in `synchronize'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/lock.rb:11:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:106:in `call'
/Library/Ruby/Gems/1.8/gems/rails-2.3.2/lib/rails/rack/static.rb:31:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/urlmap.rb:46:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/urlmap.rb:40:in `each'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/urlmap.rb:40:in `call'
/Library/Ruby/Gems/1.8/gems/rails-2.3.2/lib/rails/rack/log_tailer.rb:17:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/content_length.rb:13:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/chunked.rb:15:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/handler/mongrel.rb:61:in `process'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/handler/mongrel.rb:34:in `run'
/Library/Ruby/Gems/1.8/gems/rails-2.3.2/lib/commands/server.rb:111
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
./script/server:3
*/
If the "Not working comment" is removed everything works fine and as expected.
I've submitted a pull request, but I'm opening this because my work mates also have the same problem and so it may be helpful to have more info on it out there.
My patch: http://github.com/kjvarga/haml/commit/5ef9b00176d97d9030200b4410f65087552067ae
When converting text in TextMate to Haml, you get an exception from vendor.rb (30) about not being able to find the VERSION file:
haml/version.rb:30:in `read': No such file or directory
The reason is because FILE as used in lib.rb in the scope() method is reported as:
/Users/karl/.gem/ruby/1.8/gems/haml-2.2.5/lib/haml/../haml.rb
Which is a relative path, so the File.dirname() calls don't end up at the Haml gem root as they should. I've created a simple patch to call File.expand_path(FILE) to make it absolute first.
Regards,
Karl
When there's empty line within mixin sass generates output code outside mixin instead of include it. Gem version haml-edge-2.1.33
Example:
=example_mixin
:width 200px
:height 200px
.example_class
:float left
Output:
.example_class {
float: left; }
#example_id {
width: 200px;
height: 200px; }
Instead of:
#example_id {
width: 200px;
height: 200px; }
#example_id .example_class {
float: left; }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.