Hi everybody, first post here. Been using Nanoc for a while and
started to use HAML for the templates recently.

I'm rewriting some ERB templates that I used in a previous project
using HAML now. The templates are for a multilingual site where I'm
using
the helpers described in the "Creating multilingual sites" guide in
the Nanoc website. (http://nanoc.stoneship.org/docs/6-guides/
#creating-
multilingual-sites)

The code works flawlessly in the ERB version of the templates but it
crashes when translated to HAML. I don't know if its a HAML or Nanoc
issue so I've posted the same in the Nanoc Google group.

This code:

<%
  homepage_path = '/' + language_code_of(@item) + '/'
  home_page = @items.find { |i| i.reps[0].path == homepage_path }
%>

Translated to:

- homepage_path = '/' + language_code_of(@item) + '/'
- home_page = @items.find { |i| i.reps[0].path == homepage_path }

Brings me this error when trying to compile the site:

***********************************************************************************
TypeError at /es/
can't convert nil into String
Ruby    layout /partials/_header/: in +, line 16
Web     GET localhost/es/
Jump to:

    GET
    POST
    Cookies
    ENV

Traceback (innermost first)

    layout /partials/_header/: in +
    layout /partials/_header/: in render
    /Library/Ruby/Gems/1.8/gems/haml-3.1.2/lib/haml/engine.rb: in
render
        scope = scope_object.instance_eval{binding}

***********************************************************************************

Line 16 is:
- homepage_path = '/' + language_code_of(@item) + '/'

The same function used as in #{language_code_of(@item)} and is working
in
the same template.

Been fighting against this for a while so any help or suggestions will
be appreciated. Thanks in advance!

Xavi

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

Reply via email to