lil problem w/heredoc

Discussion in 'Ruby' started by Paul Vudmaska, Apr 7, 2004.

  1. I'm having some trouble w/heredoc.
    this works

    s += "
    <div style='border-left:1px solid
    #dddddd;padding:5;'>
    <b class=label>#{child['title']}</b><br/>
    <em title='#{child['ip']}'>#{child['client']}</em><br/>
    #{parse(child['value'])}
    <div style='border-bottom:1px solid #eeeeee;padding:8;'>
    <a
    href='javascript:add(#{child['id']})'>Reply</a>
    </div>
    <div style=margin-left:10>
    #{node(child['id'])}
    </div>
    </div>
    "
    ...but this does not..
    s += <<-EOS
    <div style='border-left:1px solid
    #dddddd;padding:5;'>
    <b class=label>#{child['title']}</b><br/>
    <em title='#{child['ip']}'>#{child['client']}</em><br/>
    #{parse(child['value'])}
    <div style='border-bottom:1px solid #eeeeee;padding:8;'>
    <a
    href='javascript:add(#{child['id']})'>Reply</a>
    </div>
    <div style=margin-left:10>
    #{node(child['id'])}
    </div>
    </div>
    EOS

    Anyone know what i'm doing wrong?

    linux,ruby1.6,mod_ruby
    Paul Vudmaska, Apr 7, 2004
    #1
    1. Advertising

  2. On Wed, 07 Apr 2004 12:16:08 +0900, Paul Vudmaska wrote:
    > I'm having some trouble w/heredoc.

    [snip]
    > ..but this does not..
    > s += <<-EOS
    > <div style='border-left:1px solid

    [snip]
    > </div>
    > EOS
    >
    > Anyone know what i'm doing wrong?
    >


    Ruby is sensitive to if there is whitespaces after the ending EOS.

    Besides that I don't see any problems.

    --
    Simon Strandgaard
    Simon Strandgaard, Apr 7, 2004
    #2
    1. Advertising

  3. Simon Strandgaard wrote:

    >On Wed, 07 Apr 2004 12:16:08 +0900, Paul Vudmaska wrote:
    >
    >
    >>I'm having some trouble w/heredoc.
    >>
    >>

    >[snip]
    >
    >
    >>..but this does not..
    >> s += <<-EOS
    >> <div style='border-left:1px solid
    >>
    >>

    >[snip]
    >
    >
    >> </div>
    >> EOS
    >>
    >>Anyone know what i'm doing wrong?
    >>
    >>
    >>

    >
    >Ruby is sensitive to if there is whitespaces after the ending EOS.
    >
    >Besides that I don't see any problems.
    >
    >--
    >Simon Strandgaard
    >
    >
    >

    !! I had a space following the EOS....now it's gone and it works. That's
    kicked my buttox a couple times but no more,
    Thank you Simon!
    :p
    Paul Vudmaska, Apr 7, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. flupke

    heredoc and variables

    flupke, Jun 4, 2004, in forum: Python
    Replies:
    7
    Views:
    3,326
    =?ISO-8859-1?Q?Xavier_Mart=EDnez?=
    Jun 7, 2004
  2. David Tran
    Replies:
    6
    Views:
    734
    Eric Hodel
    Mar 17, 2005
  3. Oliver Heins
    Replies:
    2
    Views:
    115
    Oliver Heins
    Sep 11, 2006
  4. Bob Miner
    Replies:
    3
    Views:
    93
    James Britt
    Aug 10, 2008
  5. phillyfan

    Firefox and heredoc problem

    phillyfan, Feb 1, 2006, in forum: Perl Misc
    Replies:
    3
    Views:
    166
    Tintin
    Feb 2, 2006
Loading...

Share This Page