Hi there.  Thanks for the reply.

OK I see what you mean about {} vs ().  But I’ve taken out the link for now to 
see what I can accomplish with the Time.now.year.  It’s still throwing the join 
error with:

%strong= © #{Time.now.year} Alpha Company

and

%strong= © '#{Time.now.year}’ Alpha Company

What I’ve done is this:

%strong= ["©", Time.now.year, “Alpha Company"].join(" “)

As for inline HTML, can I embed that into HAML to get around the restrictions?  
How HAML doesn’t handle inline links is a bit strange considering it’s meant to 
save time and remain flexible.  

Cheers





> On Jan 16, 2015, at 2:08 PM, Matt Wildig <m...@mattwildig.co.uk> wrote:
> 
>> 
>> OK, this is where I’m having problems:
>> 
>> %footer
>>      %strong
>>              ©
>>              {Time.now.year}
> 
> I think you want `#{Time.now.year}` here (i.e. you need the hash). You could 
> probably put this on the same line as the one above, like this:
> 
>    © #{Time.now.year}
> 
>>              %a{href="http://sample.com";, target="_blank"} Sample.com
> 
> Your syntax for the `a` tag there is wrong. You need either to make it look 
> like a valid Ruby hash:
> 
>    %a{:href=>"http://sample.com";, :target=>"_blank"} Sample.com
> 
> (i.e. replace = with => and make the keys symbols (or strings))
> 
> or use the HTML style syntax 
> (<http://haml.info/docs/yardoc/file.REFERENCE.html#htmlstyle_attributes_>):
> 
>    %a(href="http://sample.com";, target="_blank") Sample.com
> 
> (i.e. use () instead of {})
> 
>> It’s throwing an ISE on a join.
> 
> Is this using Sinatra? There’s an issue using Sinatra with the latest Rack 
> (1.6) where the development exception handler throws an exception trying to 
> call `join` on a string. If that is the case try pinning Rack to the latest 
> 1.5 version for now (until a new Sinatra version is released). This won’t fix 
> your actual issue, but will prevent it from being obscured by the 
> Sinatra/Rack bug.
> 
> More generally, Haml isn’t very good at inline tags like this. This example 
> should probably work okay, but it involves breaking up your code in an 
> awkward way to get the newlines in the right places. Also you will have 
> trouble when you want to add punctuation immediately after a tag. Check out 
> the FAQ entry about it: 
> <http://haml.info/docs/yardoc/file.FAQ.html#q-punctuation>. I would usually 
> use something like the markdown filter here, although that might be tricky to 
> get working with the `target` attribute. Your best bet might be to just use 
> inline HTML for this link.



beer...@gmail.com



-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to haml+unsubscr...@googlegroups.com.
To post to this group, send email to haml@googlegroups.com.
Visit this group at http://groups.google.com/group/haml.
For more options, visit https://groups.google.com/d/optout.

Reply via email to