What I basically have here is a short ruby script (I just started learning) and the purpose of it is to spider-crawl a website and return all the links it finds.
@sites = Array.new
Anemone.crawl("http://www.nemecisco.com/") do |anemone|
anemone.on_every_page do |page|
puts page.url
@sites<<page.url+"" #heres where i add something to give it a line break i think
end
anemone.after_crawl { puts @sites }
end
end
It does this fine, however when Its being outputted to the HTML, they are all clustered together as it trys to jam them on the one line.
The HTML is just the array inside the ruby script tag.
<%= @sites %>
You may notice that the array is composed of the pages name + something else. I figured a break tag would be enough but Ruby doesn’t like this and gives a bad URI exception.
Has anyone any ideas on how to put a line break after each site statement. In the HTML declaration? in the array? Any and all help appreciated.
Probably the safest thing to do is to do it manually in the ERB:
Or in Rails 2:
This way you don’t have to worry about possible HTML issues the
@sitesentries.