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: <pan.2004.03.29.15.49.45.527862 / adslhome.dk> >> Simon Strandgaard <neoneye / adslhome.dk> 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] <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head><title>%s</title> <style type="text/css">%s</style></head> <body>%s</body></html> EOHTML File.open(filename, "w+") {|f| f.write(html) } end Only drawback is that '%s' isn't that fool-proof as '#{var}' -- Simon Strandgaard