Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slim templates throwing syntax errors in rails 3 #61

Closed
buddhamagnet opened this issue Oct 26, 2010 · 10 comments
Closed

slim templates throwing syntax errors in rails 3 #61

buddhamagnet opened this issue Oct 26, 2010 · 10 comments
Labels

Comments

@buddhamagnet
Copy link

The template is here: http://gist.github.com/647523.

I have also tried using the syntax at http://slim-lang.com/docs.html where you specify:

== render :partial, 'user'

...no joy

The error:

/Users/buddha/Sites/jl/app/views/layouts/jpage.html.slim:1: syntax error, unexpected tLABEL, expecting keyword_do or '{' or '('
...s";_buf << render partial: 'layouts/nav';_buf << "</div...
... ^
/Users/buddha/Sites/jl/app/views/layouts/jpage.html.slim:1: syntax error, unexpected tLABEL, expecting keyword_do or '{' or '('
...(yield);_buf << render partial: 'layouts/footer';_buf << ren...
... ^
/Users/buddha/Sites/jl/app/views/layouts/jpage.html.slim:1: syntax error, unexpected tLABEL, expecting keyword_do or '{' or '('
...footer';_buf << render partial: 'layouts/madeby';_buf << "</...
...

and the stack trace:

actionpack (3.0.0) lib/action_view/template.rb:255:in module_eval' actionpack (3.0.0) lib/action_view/template.rb:255:incompile'
actionpack (3.0.0) lib/action_view/template.rb:134:in block in render' activesupport (3.0.0) lib/active_support/notifications.rb:54:ininstrument'
actionpack (3.0.0) lib/action_view/template.rb:127:in render' actionpack (3.0.0) lib/action_view/render/layouts.rb:80:in_render_layout'
actionpack (3.0.0) lib/action_view/render/rendering.rb:62:in block in _render_template' activesupport (3.0.0) lib/active_support/notifications.rb:52:inblock in instrument'
activesupport (3.0.0) lib/active_support/notifications/instrumenter.rb:21:in instrument' activesupport (3.0.0) lib/active_support/notifications.rb:52:ininstrument'
actionpack (3.0.0) lib/action_view/render/rendering.rb:56:in _render_template' actionpack (3.0.0) lib/action_view/render/rendering.rb:26:inrender'
actionpack (3.0.0) lib/abstract_controller/rendering.rb:114:in _render_template' actionpack (3.0.0) lib/abstract_controller/rendering.rb:108:inrender_to_body'
actionpack (3.0.0) lib/action_controller/metal/renderers.rb:47:in render_to_body' actionpack (3.0.0) lib/action_controller/metal/compatibility.rb:55:inrender_to_body'
actionpack (3.0.0) lib/abstract_controller/rendering.rb:101:in render_to_string' actionpack (3.0.0) lib/abstract_controller/rendering.rb:92:inrender'
actionpack (3.0.0) lib/action_controller/metal/rendering.rb:17:in render' actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:40:inblock (2 levels) in render'
activesupport (3.0.0) lib/active_support/core_ext/benchmark.rb:5:in block in ms' /Users/buddha/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/benchmark.rb:309:inrealtime'
activesupport (3.0.0) lib/active_support/core_ext/benchmark.rb:5:in ms' actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:40:inblock in render'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:78:in cleanup_view_runtime' activerecord (3.0.0) lib/active_record/railties/controller_runtime.rb:15:incleanup_view_runtime'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:39:in render' actionpack (3.0.0) lib/action_controller/metal/implicit_render.rb:10:indefault_render'
actionpack (3.0.0) lib/action_controller/metal/implicit_render.rb:5:in send_action' actionpack (3.0.0) lib/abstract_controller/base.rb:150:inprocess_action'
actionpack (3.0.0) lib/action_controller/metal/rendering.rb:11:in process_action' actionpack (3.0.0) lib/abstract_controller/callbacks.rb:18:inblock in process_action'
activesupport (3.0.0) lib/active_support/callbacks.rb:435:in _run__192140777088512817__process_action__2373947522437712861__callbacks' activesupport (3.0.0) lib/active_support/callbacks.rb:409:in_run_process_action_callbacks'
activesupport (3.0.0) lib/active_support/callbacks.rb:93:in run_callbacks' actionpack (3.0.0) lib/abstract_controller/callbacks.rb:17:inprocess_action'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:30:in block in process_action' activesupport (3.0.0) lib/active_support/notifications.rb:52:inblock in instrument'
activesupport (3.0.0) lib/active_support/notifications/instrumenter.rb:21:in instrument' activesupport (3.0.0) lib/active_support/notifications.rb:52:ininstrument'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:29:in process_action' actionpack (3.0.0) lib/action_controller/metal/rescue.rb:17:inprocess_action'
actionpack (3.0.0) lib/abstract_controller/base.rb:119:in process' actionpack (3.0.0) lib/abstract_controller/rendering.rb:40:inprocess'
actionpack (3.0.0) lib/action_controller/metal.rb:133:in dispatch' actionpack (3.0.0) lib/action_controller/metal/rack_delegation.rb:14:indispatch'
actionpack (3.0.0) lib/action_controller/metal.rb:173:in block in action' actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:62:incall'
actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:62:in dispatch' actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:27:incall'
rack-mount (0.6.13) lib/rack/mount/route_set.rb:148:in block in call' rack-mount (0.6.13) lib/rack/mount/code_generation.rb:93:inblock in recognize'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:68:in optimized_each' rack-mount (0.6.13) lib/rack/mount/code_generation.rb:92:inrecognize'
rack-mount (0.6.13) lib/rack/mount/route_set.rb:139:in call' actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:492:incall'
actionpack (3.0.0) lib/action_dispatch/middleware/best_standards_support.rb:17:in call' actionpack (3.0.0) lib/action_dispatch/middleware/head.rb:14:incall'
rack (1.2.1) lib/rack/methodoverride.rb:24:in call' actionpack (3.0.0) lib/action_dispatch/middleware/params_parser.rb:21:incall'
actionpack (3.0.0) lib/action_dispatch/middleware/flash.rb:182:in call' actionpack (3.0.0) lib/action_dispatch/middleware/session/abstract_store.rb:149:incall'
actionpack (3.0.0) lib/action_dispatch/middleware/cookies.rb:287:in call' activerecord (3.0.0) lib/active_record/query_cache.rb:32:inblock in call'
activerecord (3.0.0) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in cache' activerecord (3.0.0) lib/active_record/query_cache.rb:12:incache'
activerecord (3.0.0) lib/active_record/query_cache.rb:31:in call' activerecord (3.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:355:incall'
actionpack (3.0.0) lib/action_dispatch/middleware/callbacks.rb:46:in block in call' activesupport (3.0.0) lib/active_support/callbacks.rb:415:in_run_call_callbacks'
actionpack (3.0.0) lib/action_dispatch/middleware/callbacks.rb:44:in call' rack (1.2.1) lib/rack/sendfile.rb:107:incall'
actionpack (3.0.0) lib/action_dispatch/middleware/remote_ip.rb:48:in call' actionpack (3.0.0) lib/action_dispatch/middleware/show_exceptions.rb:46:incall'
railties (3.0.0) lib/rails/rack/logger.rb:13:in call' rack (1.2.1) lib/rack/runtime.rb:17:incall'
activesupport (3.0.0) lib/active_support/cache/strategy/local_cache.rb:72:in call' rack (1.2.1) lib/rack/lock.rb:11:inblock in call'
internal:prelude:10:in synchronize' rack (1.2.1) lib/rack/lock.rb:11:incall'
actionpack (3.0.0) lib/action_dispatch/middleware/static.rb:30:in call' railties (3.0.0) lib/rails/application.rb:168:incall'
railties (3.0.0) lib/rails/application.rb:77:in method_missing' railties (3.0.0) lib/rails/rack/log_tailer.rb:14:incall'
rack (1.2.1) lib/rack/content_length.rb:13:in call' rack (1.2.1) lib/rack/handler/webrick.rb:52:inservice'
/Users/buddha/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/httpserver.rb:111:in service' /Users/buddha/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/httpserver.rb:70:inrun'
/Users/buddha/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'

@minad
Copy link
Member

minad commented Oct 26, 2010

One problem in your gist template: It is not allowed to indent the html tag below the directive.

Can you please post the template code generated by slim? You get it by executing the slim binary

  bin/slim --compile file.slim

@buddhamagnet
Copy link
Author

Hi minad. Where's the bin folder? The gem only has lib?

@minad
Copy link
Member

minad commented Oct 26, 2010

you don't have the newest version

@buddhamagnet
Copy link
Author

ah - 0.7.0 - ok getting it now...

@buddhamagnet
Copy link
Author

got it. here's the output:

slim jpage.html.slim --trace
jpage.html.slim:14:in evaluate_source': undefined methodrender' for #Object:0x0000010129aa20 (NoMethodError)
from /Users/buddha/.rvm/gems/ruby-1.9.2-p0/gems/tilt-1.1/lib/tilt.rb:254:in instance_eval' from /Users/buddha/.rvm/gems/ruby-1.9.2-p0/gems/tilt-1.1/lib/tilt.rb:254:inevaluate_source'
from /Users/buddha/.rvm/gems/ruby-1.9.2-p0/gems/tilt-1.1/lib/tilt.rb:195:in evaluate' from /Users/buddha/.rvm/gems/ruby-1.9.2-p0/gems/slim-0.7.0/lib/slim/template.rb:25:inevaluate'
from /Users/buddha/.rvm/gems/ruby-1.9.2-p0/gems/tilt-1.1/lib/tilt.rb:128:in render' from /Users/buddha/.rvm/gems/ruby-1.9.2-p0/gems/slim-0.7.0/lib/slim/command.rb:76:inprocess'
from /Users/buddha/.rvm/gems/ruby-1.9.2-p0/gems/slim-0.7.0/lib/slim/command.rb:17:in run' from /Users/buddha/.rvm/gems/ruby-1.9.2-p0/gems/slim-0.7.0/bin/slim:7:in<top (required)>'
from /Users/buddha/.rvm/gems/ruby-1.9.2-p0/bin/slim:19:in load' from /Users/buddha/.rvm/gems/ruby-1.9.2-p0/bin/slim:19:in

'

@minad
Copy link
Member

minad commented Oct 26, 2010

you have to use --compile
does the problem still exist with 0.7.0?

@buddhamagnet
Copy link
Author

Magic. 0.7.0 nailed it. Sorry for the disturbance, so many gems, so little time!

@stonean
Copy link
Contributor

stonean commented Oct 26, 2010

Great to hear! I can continue on the vim syntax file. :)

@buddhamagnet
Copy link
Author

Thanks guys. Sorry, my bad, should have upgraded to 0.7.0 in the first place.

@stonean
Copy link
Contributor

stonean commented Oct 26, 2010

No worries at all. :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants