I'm trying to pull in a text file to the body of my HTML code, and format the line breaks into HTML
tags. The text file has a large paragraph of code, a line break, and then one more line of data. We are instructed to carry over that line break so they are separated when printing to the cgi file. This is for a class assignment, FYI. This is what I have:\[code\]#!/usr/local/bin/ruby# Name: oliver_twist.cgiputs 'Content-type: text/html'#blank lineputs#Oliver twist txt outputputs <<HTML<!DOCTYPE html><html> <head> <title>Excerpt of Oliver Twist</title> </head> <body> <h2>Excerpt of <em>Oliver Twist</em></h2>HTMLFile.open("../oliver_twist.txt") { |x| puts x.gsub(/\n/,"<br>") }puts <<HTML </body></html>HTML\[/code\]I can get it to print without the "gsub" portion, so I know that's where I am lost. Any help would be greatly appreciated!
tags. The text file has a large paragraph of code, a line break, and then one more line of data. We are instructed to carry over that line break so they are separated when printing to the cgi file. This is for a class assignment, FYI. This is what I have:\[code\]#!/usr/local/bin/ruby# Name: oliver_twist.cgiputs 'Content-type: text/html'#blank lineputs#Oliver twist txt outputputs <<HTML<!DOCTYPE html><html> <head> <title>Excerpt of Oliver Twist</title> </head> <body> <h2>Excerpt of <em>Oliver Twist</em></h2>HTMLFile.open("../oliver_twist.txt") { |x| puts x.gsub(/\n/,"<br>") }puts <<HTML </body></html>HTML\[/code\]I can get it to print without the "gsub" portion, so I know that's where I am lost. Any help would be greatly appreciated!