Topic: Relative Path To Absolute Path Convertor

Is there a built in function/plugin that converts
relative paths from a html page to absolute ones?

Example:
target url: http://mysite.com/folder/url.html

url content:
...
<script src="/script.js"></script>
<a href="link.html">some link</a>
...

converted content:
...
<script src="http://mysite.com/script.js"></script>
< a href="http://mysite.com/folder/link.html">some link</ a>
...

How can I accomplish this using ruby ?

Re: Relative Path To Absolute Path Convertor

are you not using rails?

if you are using rails for the javascript

javascript_include_tag

for the link you would have to mess around with the routs to allow someone to browse html in the folder (I believe) or you would make a controller called folder and define whatever views you want...

if you are not using rails you could do something like this
[code = ruby]
Class String
  @@base = "http://mysite.com"
  def to_link
    "#{@@base}/folder/#{to_s}"
  end
  def to_js
    "#{@@base}/#{to_s}"
  end
end
[/code]
then puts "<a href = #{'link.html'.to_link}>some link</a>"

untested but you could fool around with that until it worked