From: Simon Strandgaard Date: 2004-03-31T05:29:24+09:00 Subject: Re: proposal - delayed intropolation in heredoc On Tue, 30 Mar 2004 23:13:38 +0200, Simon Strandgaard wrote: > On Tue, 30 Mar 2004 21:58:06 +0900, YANAGAWA Kazuhisa wrote: >> In Message-Id: >> Simon Strandgaard writes: >> >>> Space isn't preserved.. I think you have misunderstood my proposal ;-) >> >> This particular case, you can use sprintf or String#%, can't you? [snip] > > Bommer.. Yes '%' does the trick. Silly me. I have been using this many > times before, but without realizing its potential. > > Thanks Yanagawa, this is awesome ;-) BTW: now the xhtml template looks like: def write_page(body, title, css, filename) html = <<-EOHTML.gsub(/^\s*/, '') % [title, css, body] %s %s EOHTML File.open(filename, "w+") {|f| f.write(html) } end Only drawback is that '%s' isn't that fool-proof as '#{var}' -- Simon Strandgaard