How to add to string a large text with single and double quotes

I'm sure there must be an easier way to add a large text to a string
variable than doing

temp_string = ''a very large text"

For example my text is:

    var badge = '';
    badge += '<div class="upb_date"><span class="upb_text">Jan
8</span></div>';
    badge += '<div class="upb_event" id="upcoming_badge_1"><span
class="upb_title upb_text"><a
href="http://upcoming.org/event/80128/">COMSWARE 2007 HE SECOND
IEEE/Create-Net/...</a></span>';
    badge += ' <span class="upb_venue upb_text">@ <a
href="http://upcoming.org/venue/25891/">NOT YET DECIDED</a></span>';
    badge += '</div>';
    document.write(badge);

I want all that in a variable @badge_text. How do I do that easily?

Thanks

You can use straight Ruby for this. String has a "here" document.
Itworks liek this:

badge = <<MY_TEXT_END
  <div class="upb_date"><span class="upb_text">Jan 8</span></div>
  <div class="upb_event" id="upcoming_badge_1">
   <span class="upb_title upb_text">
      <a href="http://upcoming.org/event/80128/">
        COMSWARE 2007 HE SECOND IEEE/Create-Net/...
      </a>
   </span>
   <span class="upb_venue upb_text">@
      <a href="http://upcoming.org/venue/25891/">
        NOT YET DECIDED
      </a>
   </span>
</div>
MY_TEXT_END

badge now has all of this, with all single and double qoutes escaped
with a '\' character. Note that new lines are preserved in the string
as '\n'.

For all other info, check out "String" in
http://ruby-doc.org/docs/ProgrammingRuby/html/tut_stdtypes.html

Bart

Neeraj Kumar wrote: